@fayz-ai/ui 0.31.0 → 0.33.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.
- package/dist/{chunk-UDY4KJRX.js → chunk-3XKDGBP4.js} +7 -5
- package/dist/chunk-3XKDGBP4.js.map +1 -0
- package/dist/{chunk-VDAYIQX4.js → chunk-C6PW5C5Q.js} +3 -3
- package/dist/chunk-C6PW5C5Q.js.map +1 -0
- package/dist/{chunk-NTPQRDJF.js → chunk-NXSDQ7HO.js} +4 -4
- package/dist/{chunk-NTPQRDJF.js.map → chunk-NXSDQ7HO.js.map} +1 -1
- package/dist/{chunk-VBYFN5ZL.js → chunk-PL5CUWNE.js} +138 -82
- package/dist/chunk-PL5CUWNE.js.map +1 -0
- package/dist/{chunk-ABY2HXG4.js → chunk-UFT3MA5H.js} +24 -16
- package/dist/chunk-UFT3MA5H.js.map +1 -0
- package/dist/dashboard/index.js +3 -3
- package/dist/index.js +9 -9
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/ModulePage.d.ts +8 -1
- package/dist/layout/ModulePage.d.ts.map +1 -1
- package/dist/layout/Sidebar.d.ts +6 -1
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/index.js +1 -1
- package/dist/primitives/data-table.d.ts +10 -1
- package/dist/primitives/data-table.d.ts.map +1 -1
- package/dist/primitives/date-picker.d.ts +6 -1
- package/dist/primitives/date-picker.d.ts.map +1 -1
- package/dist/primitives/header-tabs.d.ts.map +1 -1
- package/dist/primitives/index.js +3 -3
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/list-view.d.ts +3 -1
- package/dist/primitives/list-view.d.ts.map +1 -1
- package/dist/primitives/phone-field.d.ts.map +1 -1
- package/dist/stores/page-header.store.d.ts +18 -1
- package/dist/stores/page-header.store.d.ts.map +1 -1
- package/dist/styles.css +8 -1
- package/dist/theme/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-ABY2HXG4.js.map +0 -1
- package/dist/chunk-UDY4KJRX.js.map +0 -1
- package/dist/chunk-VBYFN5ZL.js.map +0 -1
- package/dist/chunk-VDAYIQX4.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/layout/SaveBar.tsx","../src/primitives/tooltip.tsx","../src/stores/page-header.store.ts","../src/primitives/hint.tsx","../src/layout/useCrossModuleBack.ts","../src/primitives/page-header.tsx","../src/layout/rail-flyout.tsx","../src/layout/Sidebar.tsx","../src/stores/layout.store.ts","../src/layout/ShellSearch.tsx","../src/layout/Topbar.tsx","../src/primitives/bottom-sheet.tsx","../src/layout/AppShell.tsx","../src/primitives/header-tabs.tsx","../src/primitives/view-tabs.tsx","../src/layout/PageTransition.tsx","../src/layout/page-trail.tsx","../src/layout/ModulePage.tsx"],"names":["React","React2","jsx","React3","React4","Hint","TooltipPrimitive2","jsxs","create","React5","React6","content","Fragment","useIsomorphicLayoutEffect","React7","ExternalLink","Crown","React8","React9","Settings","getIcon","Home","ChevronDown","Search","React10","createPortal","ChevronLeft","Menu","X","ChevronRight","CreditCard","Sparkles","React12","React13","React14","useTranslation","kids"],"mappings":";;;;;;;;;;;AAkEA,IAAM,MAAA,GAAuB,EAAE,OAAA,EAAS,KAAA,EAAO,QAAQ,KAAA,EAAM;AAK7D,IAAM,iBAAA,GAA0BA,sBAAiC,IAAI,CAAA;AACrE,IAAM,sBAA4BA,OAAA,CAAA,aAAA,CAA4B,EAAE,SAAS,KAAA,EAAO,MAAA,EAAQ,OAAO,CAAA;AAK/F,IAAI,eAAA,GAAkB,KAAA;AACtB,IAAM,YAAA,uBAAmB,GAAA,EAAgB;AACzC,SAAS,wBAAwB,CAAA,EAAY;AAC3C,EAAA,IAAI,MAAM,eAAA,EAAiB;AAC3B,EAAA,eAAA,GAAkB,CAAA;AAClB,EAAA,YAAA,CAAa,OAAA,CAAQ,CAAC,EAAA,KAAO,EAAA,EAAI,CAAA;AACnC;AAGO,SAAS,iBAAA,GAA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AAA,GAAA,EACF,CAAA;AAEJ","file":"chunk-VBYFN5ZL.js","sourcesContent":["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 /**\n * Mantém a barra à vista mesmo sem alteração pendente.\n *\n * Num formulário de CRIAÇÃO ou EDIÇÃO a barra é o caminho de sair — some-la\n * porque nada mudou ainda deixa a tela sem botão de salvar, e quem digitou\n * um valor que por acaso voltou ao original vê a barra piscar. `dirty`\n * continua sendo o que decide a MENSAGEM; isto decide só se ela aparece.\n */\n alwaysVisible?: 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 /** A barra está à vista por alteração pendente, ou só por estar num form? */\n dirty?: boolean\n saving: boolean\n message?: string\n saveLabel?: string\n discardLabel?: string\n}\n\ninterface SaveBarHandlers { onSave?: () => void; onDiscard?: () => void }\n\ninterface SaveBarEntry {\n state: SaveBarState\n handlers: SaveBarHandlers\n}\n\ninterface SaveBarApi {\n setState: React.Dispatch<React.SetStateAction<SaveBarState>>\n handlers: React.MutableRefObject<SaveBarHandlers>\n // Registrations, latest-mounted last. A form opened on top of another (a\n // \"create product\" modal inside an invoice) must hand the bar back to the\n // form below when it closes, instead of leaving it hidden.\n entries: React.MutableRefObject<SaveBarEntry[]>\n sync: () => void\n}\n\nconst HIDDEN: SaveBarState = { visible: false, saving: false }\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<SaveBarHandlers>({})\n const entries = React.useRef<SaveBarEntry[]>([])\n const api = React.useMemo<SaveBarApi>(() => ({\n setState,\n handlers,\n entries,\n sync: () => {\n const top = entries.current[entries.current.length - 1]\n handlers.current = top?.handlers ?? {}\n setState(top ? top.state : HIDDEN)\n },\n }), [])\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, alwaysVisible, saving = false, onSave, onDiscard, message, saveLabel, discardLabel }: SaveBarRegistration): void {\n const api = React.useContext(SaveBarApiContext)\n const entry = React.useRef<SaveBarEntry>({ state: HIDDEN, handlers: {} })\n\n // Keep latest handlers on the entry (no state churn from new closures).\n React.useEffect(() => {\n entry.current.handlers = { onSave, onDiscard }\n if (api && api.entries.current[api.entries.current.length - 1] === entry.current) {\n api.handlers.current = entry.current.handlers\n }\n })\n\n React.useEffect(() => {\n if (!api) return\n const list = api.entries.current\n list.push(entry.current)\n api.sync()\n return () => {\n const i = list.indexOf(entry.current)\n if (i !== -1) list.splice(i, 1)\n api.sync()\n }\n }, [api])\n\n // Drive visibility from primitives only; `api` is stable → no render loops.\n React.useEffect(() => {\n if (!api) return\n entry.current.state = { visible: dirty || !!alwaysVisible, dirty, saving, message, saveLabel, discardLabel }\n if (api.entries.current[api.entries.current.length - 1] === entry.current) api.sync()\n }, [api, dirty, alwaysVisible, 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 data-tour=\"savebar.discard\"\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 data-tour=\"savebar.save\"\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 * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { cn } from '../lib/cn'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'fayz-glass-surface z-[120] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","import * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { create } from 'zustand'\n\ninterface PageHeaderState {\n /**\n * Where a page's own header DRAWS, so it can stay in the tree that wrote it.\n *\n * This used to be the node itself, handed over through this store — and a\n * store is not a React tree. The shell rendered it under ITS providers, so a\n * title carrying anything plugin-shaped (a quote's status dropdown) threw\n * \"useStore must be used within CrmPage\" and took the page with it. Same\n * lesson the right rail already learned: the page stays where it was written\n * and portals its body in.\n */\n shellSlot: HTMLElement | null\n setShellSlot: (element: HTMLElement | null) => void\n /** A container deeper than the shell — a module's own content column — that is\n * better placed to draw the header. It wins while it is mounted. */\n outletSlot: HTMLElement | null\n setOutletSlot: (element: HTMLElement | null) => void\n /** A page is drawing its own header, so the shell must not draw one too. */\n claimed: boolean\n /** Identity of whoever owns the slot, so a late unmount can't clear a newer\n * owner's content — the exact race you get navigating form → form. */\n owner: string | null\n /** The claimed header carries a back action, i.e. what the bar is showing is\n * a SUBPAGE (\"← Contas a Pagar / Nova\"), not the module's own screen. The\n * module's tab band reads this to step aside: a form reached from a tab is\n * not one of the tabs, and leaving the strip up marks a place the user is no\n * longer at, one line under a back link that says so. */\n hasBack: boolean\n /** How many shells are currently rendering the slot. A page needs to know:\n * with no host (minimal layout, an embedded form, a modal) its header would\n * be claimed into the void, and the page must draw it inline instead. */\n hosts: number\n /**\n * Quantos OUTLETS internos estão mostrando o slot. Um outlet é um container\n * mais fundo que a shell — a coluna de conteúdo de um módulo com trilha\n * lateral — que fica em melhor posição para desenhar o cabeçalho.\n *\n * Quando existe um, a barra da shell se cala: as duas juntas desenhariam a\n * mesma migalha duas vezes, e a da shell atravessa a largura inteira,\n * empurrando a trilha do módulo para baixo do topo.\n */\n outlets: number\n /**\n * Quantos blocos de ações de página estão montados agora. A barra precisa\n * saber ANTES de decidir se existe: ela some no celular de alguns produtos, e\n * um \"Novo\" entregue a uma barra escondida simplesmente não aparecia.\n */\n actions: number\n claim: (owner: string, hasBack?: boolean) => void\n release: (owner: string) => void\n addHost: () => void\n removeHost: () => void\n addOutlet: () => void\n removeOutlet: () => void\n addActions: () => void\n removeActions: () => void\n}\n\nconst usePageHeaderStore = create<PageHeaderState>((set, get) => ({\n shellSlot: null,\n setShellSlot: (element) => set({ shellSlot: element }),\n outletSlot: null,\n setOutletSlot: (element) => set({ outletSlot: element }),\n claimed: false,\n owner: null,\n hasBack: false,\n hosts: 0,\n outlets: 0,\n actions: 0,\n claim: (owner, hasBack = false) => set({ owner, claimed: true, hasBack }),\n release: (owner) => {\n if (get().owner === owner) set({ owner: null, claimed: false, hasBack: false })\n },\n addHost: () => set((s) => ({ hosts: s.hosts + 1 })),\n removeHost: () => set((s) => ({ hosts: Math.max(0, s.hosts - 1) })),\n addOutlet: () => set((s) => ({ outlets: s.outlets + 1 })),\n removeOutlet: () => set((s) => ({ outlets: Math.max(0, s.outlets - 1) })),\n addActions: () => set((s) => ({ actions: s.actions + 1 })),\n removeActions: () => set((s) => ({ actions: Math.max(0, s.actions - 1) })),\n}))\n\n/** Declara que esta página tem ações no topo. Chamado por PageHeaderActions. */\nexport function useRegisterPageActions(): void {\n const add = usePageHeaderStore((s) => s.addActions)\n const remove = usePageHeaderStore((s) => s.removeActions)\n React.useEffect(() => {\n add()\n return remove\n }, [add, remove])\n}\n\n/** Se alguma página tem ações no topo agora. A barra usa para não sumir com\n * elas no celular, e para não existir vazia. */\nexport function useHasPageActions(): boolean {\n return usePageHeaderStore((s) => s.actions > 0)\n}\n\n/** Read the current override. The shell calls this; pages should not. */\n/** True while a page is drawing its own header into the bar's slot. */\nexport function usePageHeaderClaimed(): boolean {\n return usePageHeaderStore((s) => s.claimed)\n}\n\n/** The bar's portal target, for the page that draws into it. */\nexport function usePageTitleSlot(): HTMLElement | null {\n return usePageHeaderStore((s) => s.outletSlot ?? s.shellSlot)\n}\n\n/** Registers the bar's portal target. Called by the shell. */\nexport function usePageTitleSlotHost(): (element: HTMLElement | null) => void {\n return usePageHeaderStore((s) => s.setShellSlot)\n}\n\n/**\n * Declare that this shell renders the page-header slot. Called by the layout,\n * never by a page. Without it `PageHeader` cannot tell \"nobody claimed the bar\"\n * from \"there is no bar\", and a header would vanish instead of falling back.\n */\nexport function usePageHeaderHost(): void {\n const addHost = usePageHeaderStore((s) => s.addHost)\n const removeHost = usePageHeaderStore((s) => s.removeHost)\n React.useEffect(() => {\n addHost()\n return removeHost\n }, [addHost, removeHost])\n}\n\n/** Whether any shell OR inner outlet is showing the slot right now. */\nexport function useHasPageHeaderHost(): boolean {\n return usePageHeaderStore((s) => s.hosts > 0 || s.outlets > 0)\n}\n\n/** True when a deeper container took over drawing the header. The shell bar\n * uses this to stand down. */\nexport function useHasPageHeaderOutlet(): boolean {\n return usePageHeaderStore((s) => s.outlets > 0)\n}\n\n/**\n * Desenha o cabeçalho AQUI em vez de na barra da shell.\n *\n * Para quem tem uma coluna própria de conteúdo — um módulo com trilha lateral —,\n * onde a barra da shell, larga demais, passaria por cima da trilha.\n */\nexport function PageHeaderOutlet({ className }: { className?: string }): React.ReactElement | null {\n const setOutletSlot = usePageHeaderStore((s) => s.setOutletSlot)\n const claimed = usePageHeaderStore((s) => s.claimed)\n const addOutlet = usePageHeaderStore((s) => s.addOutlet)\n const removeOutlet = usePageHeaderStore((s) => s.removeOutlet)\n\n React.useEffect(() => {\n addOutlet()\n return removeOutlet\n }, [addOutlet, removeOutlet])\n\n // A target, not a renderer: the page portals its own header in here, keeping\n // the tree that wrote it. `empty:hidden` keeps the margin off an unused slot.\n return React.createElement('div', {\n ref: setOutletSlot,\n className: `${className ?? 'mb-4'}${claimed ? '' : ' hidden'}`,\n })\n}\n\n/**\n * Put this page's own header — a back link, a breadcrumb — into the shell's top\n * bar, replacing the page title for as long as the page is mounted.\n *\n * Prefer the `PageHeader` component: it is this hook plus the one agreed layout\n * (← + title), so every screen in every app reads the same. Reach for the hook\n * directly only for a header that genuinely is not \"back + title\".\n *\n * A form or detail screen already says where it is (\"← Novo produto\") and the\n * bar above it was saying \"Produtos\" again, one line up. Two headers stacked is\n * a whole row of vertical space spent repeating a word.\n *\n * The node is re-claimed on every change so a breadcrumb whose label depends on\n * loaded data (a record's name) updates once it arrives.\n */\n/**\n * Tells the bar that this page is drawing its own header, and whether that\n * header carries a back action. The header ITSELF goes through `PageTitlePortal`\n * — flags travel as data, JSX stays in the tree that wrote it.\n */\nexport function usePageHeader(active: boolean, options?: { back?: boolean }): void {\n const id = React.useId()\n const claim = usePageHeaderStore((s) => s.claim)\n const release = usePageHeaderStore((s) => s.release)\n const back = options?.back ?? false\n\n React.useEffect(() => {\n if (!active) { release(id); return }\n claim(id, back)\n return () => release(id)\n }, [id, active, back, claim, release])\n}\n\n/** True while the bar is showing a subpage's \"← parent / title\". See\n * `PageHeaderState.hasBack`. */\nexport function useHasPageHeaderBack(): boolean {\n return usePageHeaderStore((s) => s.hasBack)\n}\n\nexport { usePageHeaderStore }\n\n/**\n * Draws a page's own header into the bar WITHOUT leaving its React tree, so a\n * title made of plugin components still has its plugin's providers above it.\n * With nowhere to draw into it renders where it stands, as any fallback.\n */\nexport function PageTitlePortal({ children }: { children: React.ReactNode }): React.ReactElement | null {\n const slot = usePageTitleSlot()\n if (!slot) return React.createElement(React.Fragment, null, children)\n return createPortal(children, slot)\n}\n","import * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'\n\nexport interface HintProps extends React.HTMLAttributes<HTMLElement> {\n /** The tip. Nothing renders when this is empty. */\n label?: React.ReactNode\n children: React.ReactElement\n side?: 'top' | 'right' | 'bottom' | 'left'\n /** Milliseconds before it opens. 0 — an icon button gives no other clue what\n * it does, so waiting 700ms to find out is the wrong trade. */\n delayDuration?: number\n}\n\n/**\n * A styled tooltip for any control that would otherwise rely on the browser's\n * native `title` attribute.\n *\n * `title=` looks like a tooltip until you use one: it appears after a ~1s\n * delay you cannot change, in the OS's own styling, never on touch, and it is\n * skipped by several screen readers. This renders the design-system tooltip\n * instead, and — because the trigger keeps its own `aria-describedby` — the\n * text is announced rather than merely drawn.\n *\n * Self-contained on purpose: it mounts its own Provider so a caller can drop a\n * Hint anywhere without first knowing whether some ancestor set one up.\n */\nexport const Hint = React.forwardRef<HTMLElement, HintProps>(function Hint(\n { label, children, side = 'top', delayDuration = 0, ...rest },\n ref,\n) {\n // `rest` + ref repassados ao filho porque um Hint costuma envolver o gatilho\n // de OUTRA coisa — `<DropdownTrigger asChild><Hint><button/></Hint>`. Sem\n // isso o Hint engolia os handlers do dropdown e o botão virava enfeite: o\n // menu de ordenar simplesmente não abria.\n if (!label) return React.cloneElement(children, { ...rest, ref } as never)\n return (\n <TooltipPrimitive.Provider delayDuration={delayDuration}>\n <Tooltip>\n <TooltipTrigger asChild {...rest} ref={ref as never}>{children}</TooltipTrigger>\n <TooltipContent side={side} className=\"px-2 py-1 text-xs font-medium\">\n {label}\n </TooltipContent>\n </Tooltip>\n </TooltipPrimitive.Provider>\n )\n})\n","import { create } from 'zustand'\nimport { useNavReferrer, navHistoryBack, routeModule } from '@fayz-ai/core'\n\n/**\n * As rotas que SÃO linhas do menu.\n *\n * Publicadas pela shell (ver `isDestination` em AppShell) porque a decisão é\n * dela: só ela conhece o menu desta conta depois de permissão, ofício e\n * composição do tenant. Uma lista, e não um palpite por prefixo — `/customers`\n * é destino e `/customers/new` não, e nada no formato da rota diz isso.\n */\ninterface DestinationState {\n routes: Set<string>\n set: (routes: string[]) => void\n}\n\nconst useDestinationStore = create<DestinationState>((set) => ({\n routes: new Set(),\n set: (routes) => set((s) => {\n if (s.routes.size === routes.length && routes.every((r) => s.routes.has(r))) return s\n return { routes: new Set(routes) }\n }),\n}))\n\n/** Chamada pela shell a cada vez que o menu muda. */\nexport function setDestinationRoutes(routes: string[]): void {\n useDestinationStore.getState().set(routes)\n}\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 *\n * UMA TELA PRIMÁRIA NÃO VOLTA PARA LUGAR NENHUM.\n *\n * Voltar é para quem desceu — uma ficha, uma aba, um formulário. Numa linha do\n * menu é um convite errado: o Check-in mostrava \"← Agenda\" só porque a Agenda\n * foi a tela anterior, e sair de uma tela primária pela anterior não é voltar,\n * é andar em círculo. Some também o `onBack` que a página trouxe: se ela É uma\n * linha do menu, o menu é como se sai dela, e ele está na tela.\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 isDestination = useDestinationStore((s) => s.routes.has(currentPath))\n const cross = referrer && referrer.label && routeModule(referrer.path) !== routeModule(currentPath)\n ? referrer\n : null\n if (isDestination) return { onBack: undefined, parentLabel: undefined, isCrossModule: false }\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, ChevronLeft, Info } from 'lucide-react'\nimport { usePageHeader, useHasPageHeaderHost, PageTitlePortal } from '../stores/page-header.store'\nimport { useBackHandler } from '../layout/SaveBar'\nimport { useCrossModuleBack } from '../layout/useCrossModuleBack'\nimport { cn } from '../lib/cn'\nimport { Hint } from './hint'\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 description,\n headingLevel = 'h2',\n}: {\n title?: React.ReactNode\n parentLabel?: string\n onBack?: () => void\n /** O que esta tela é, em uma frase. Vira um (i) ao lado do título, e a frase\n * aparece ao passar o mouse.\n *\n * Ela era um parágrafo sob o cabeçalho — uma linha inteira, em toda visita,\n * para uma frase que se lê UMA vez e depois é ruído entre o nome da tela e o\n * número que a pessoa veio ver. No ícone ela continua a um gesto de\n * distância para quem chega, sem custar espaço para quem já sabe. */\n description?: string\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 // O (i) da descrição. Botão e não um `title=`: um tooltip só no hover não\n // existe para teclado nem para toque, e como botão ele recebe foco, abre no\n // foco e é tocável. Escondido no celular — lá o título é centrado e sem\n // largura sobrando, e um ícone ao lado o tira do meio.\n const info = description ? (\n <Hint label={description} side=\"bottom\">\n <button\n type=\"button\"\n aria-label={description}\n onClick={(e) => e.preventDefault()}\n className=\"hidden shrink-0 text-muted-foreground/60 transition-colors hover:text-foreground focus-visible:text-foreground focus-visible:outline-none md:inline-flex\"\n >\n <Info className=\"h-3.5 w-3.5\" />\n </button>\n </Hint>\n ) : null\n\n // TWO SHAPES, ONE HEADER.\n //\n // A pointer reads left to right along a wide bar, so the desktop keeps the\n // breadcrumb it always had: \"← Pedidos / Pedido #1138\". A phone does not have\n // that width, and it has a convention older than this app — the screen's name\n // CENTRED in the bar, its way out on the left in the system tint.\n //\n // Centred IN THE BAR, which is why the title is taken out of the flow on\n // mobile: this header is one item in a row that also holds a hamburger, a\n // module tab strip and the page's action buttons, so a title centred inside\n // its own box lands wherever those happen to leave it — which is to say\n // somewhere different on every screen. `absolute left-1/2` measures against\n // the bar (the shell marks it `relative`), so the name sits in the same\n // place on all of them. Above `md` everything returns to normal flow.\n const centred =\n 'absolute left-1/2 top-1/2 max-w-[58%] -translate-x-1/2 -translate-y-1/2 truncate' +\n ' md:static md:max-w-none md:translate-x-0 md:translate-y-0'\n\n const titleNode =\n title === '' ? (\n // Title still waiting on data: a pulsing bar, otherwise the line appears\n // from nowhere and shoves the rest when the record lands.\n <span className={cn(centred, '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 that\n // only ever renders a breadcrumb was leaving the page with no heading\n // for a screen reader to land on.\n <Heading className={cn(centred, 'min-w-0 font-semibold text-foreground md:truncate md:font-medium')}>{title}</Heading>\n ) : (\n <span className={cn(centred, 'min-w-0 font-semibold text-foreground md:truncate md:font-medium')}>{title}</span>\n )\n\n // No back path means a top-level page: no way out to draw, so the phone gets\n // the name alone — still in the middle of the bar, so that arriving at a\n // screen with a back and one without does not move the title.\n if (!onBack) {\n if (!title) return null\n return (\n <div className=\"contents text-[15px] md:block md:text-lg\">\n {titleNode}\n {info}\n </div>\n )\n }\n\n return (\n <nav className=\"flex min-w-0 items-center gap-1.5 text-[15px] text-muted-foreground md:text-sm\">\n <button\n type=\"button\"\n onClick={onBack}\n className=\"fz-ios-tint inline-flex min-w-0 shrink-0 items-center gap-0.5 transition-colors md:gap-1 md:text-muted-foreground md:hover:text-foreground\"\n >\n <ChevronLeft className=\"h-5 w-5 shrink-0 md:hidden\" />\n <ArrowLeft className=\"hidden h-3.5 w-3.5 shrink-0 md:block\" />\n {/* The phone says \"Voltar\" and not the parent's name: at this width the\n name truncates, and a truncated destination is worse than none. */}\n <span className=\"truncate md:hidden\">Voltar</span>\n <span className=\"hidden truncate md:inline\">{parentLabel ?? 'Voltar'}</span>\n </button>\n <span aria-hidden className=\"hidden shrink-0 md:inline\">/</span>\n {title != null && titleNode}\n {info}\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 /** Ver `SidebarItem.badgeTone`: vermelho é para o que pede ação. */\n badgeTone?: 'default' | 'destructive'\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 /** Ver `SidebarItem.badgeTone`: vermelho é para o que pede ação. */\n badgeTone?: 'default' | 'destructive'\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, 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 /** `destructive` para contagem que PEDE AÇÃO — mensagem por ler. As outras\n * contagens do menu (sessões recentes, itens de um catálogo) são\n * informação, e pintar todas de vermelho ensina a ignorar o vermelho. */\n badgeTone?: 'default' | 'destructive'\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 /** O shell ainda não sabe o que esta conta tem: o rail espera em esqueleto. */\n navLoading?: boolean\n /** A leitura da configuração falhou; esta é a mensagem. */\n navError?: string | null\n navErrorLabel?: string\n navRetryLabel?: string\n onNavRetry?: () => void\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.\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 */\n navTop?: React.ReactNode\n /**\n * A row above the first destination, outside the scrolling list and outside\n * the rail-swap animation — for the one entry that is a MODE and not a page\n * (the counter/POS takeover). It stays put while the list below it swaps.\n */\n beforeNav?: 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 row (\"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/** 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 badgeTone: item.badgeTone,\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 badgeTone: child.badgeTone,\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(\n 'rounded-full px-2 py-0.5 text-xs font-semibold',\n item.badgeTone === 'destructive'\n ? 'bg-destructive text-destructive-foreground'\n : 'bg-primary text-primary-foreground',\n !isExternal && !item.premium && 'ml-auto',\n )}>\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\n/**\n * A porta que um grupo abre: o primeiro destino interno dele.\n *\n * Grupo no rail não é uma tela — é uma gaveta. Clicar nela e ficar onde se\n * estava obriga um segundo clique para chegar em algum lugar, e o lugar é\n * sempre o mesmo: o primeiro filho. Links externos são pulados porque abrir\n * outra aba não é navegar aqui dentro.\n */\nfunction firstDestinationOf(item: NavigationItem): string | undefined {\n return item.children?.find((child) => !child.href)?.route ?? item.route\n}\n\nfunction NavGroup({\n item,\n collapsed,\n activeRoute,\n onNavigate,\n childConnector,\n flyout,\n open,\n onOpen,\n}: {\n item: NavigationItem\n collapsed: boolean\n activeRoute: string | null\n onNavigate: (route: string) => void\n childConnector?: boolean\n flyout?: RailFlyoutHandle\n /** Accordion: quem manda no aberto/fechado é o rail, não a linha. */\n open: boolean\n onOpen: (open: boolean) => void\n}) {\n const isChildActive = item.children?.some((c) => c.route === activeRoute) || item.route === activeRoute\n const Icon = getIcon(item.icon)\n\n // Abrir o grupo já leva ao primeiro destino dele; fechar não navega — sair de\n // uma gaveta não é pedir outra tela.\n const handleHeaderClick = () => {\n if (open) { onOpen(false); return }\n onOpen(true)\n const destination = firstDestinationOf(item)\n if (destination && destination !== activeRoute) onNavigate(destination)\n }\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 const destination = firstDestinationOf(item)\n if (destination) onNavigate(destination)\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={handleHeaderClick}\n data-tour={`nav.${item.route}`}\n aria-expanded={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 {/* A CONTA do filho.\n Ela já viajava até aqui — calculada pelo vigia, contribuída\n à navegação, fundida no item — e morria por não ter onde\n aparecer: esta linha desenhava ícone, rótulo, link externo e\n coroa, e ignorava `badge`. O rail (recolhido) desenhava; a\n barra aberta, não. */}\n {child.badge !== undefined && (\n <span\n className={cn(\n 'ml-1.5 inline-flex h-[18px] min-w-[18px] shrink-0 items-center justify-center rounded-full px-1.5 text-[10px] font-semibold',\n child.badgeTone === 'destructive'\n ? 'bg-destructive text-destructive-foreground'\n : 'bg-sidebar-accent text-sidebar-accent-foreground',\n )}\n >\n {child.badge}\n </span>\n )}\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 // `nav.<route>` on group children too, matching the top-level rows\n // above — without it a guided tour cannot point at \"Cardápio\",\n // \"Reservas\" or any other row that lives under a group (the normal\n // case in an app that groups its rail).\n <button data-tour={`nav.${child.route}`} 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\n/**\n * As costelas do rail enquanto ele não chegou. CINCO, e não sete.\n *\n * O esqueleto não é uma previsão — ninguém sabe quantas linhas a conta tem\n * antes da configuração. Ele é só a promessa de que ALGO vem ali. Sete barras\n * ocupavam metade da coluna e prometiam um menu específico; cinco dizem a mesma\n * coisa sem fingir que sabem o tamanho, e a diferença entre elas e o rail real\n * deixa de ser um salto.\n *\n * Fixo de propósito: sortear larguras a cada render faria o esqueleto tremer\n * enquanto espera.\n */\nconst SKELETON_ROWS = [\n { width: 56, group: false },\n { width: 68, group: true },\n { width: 48, group: false },\n { width: 60, group: true },\n { width: 52, group: false },\n] as const\n\nexport function Sidebar({\n navigation,\n navLoading = false,\n navError,\n navErrorLabel,\n navRetryLabel,\n onNavRetry,\n logo,\n collapsed,\n onToggle,\n onNavigate,\n currentPath: currentPathProp = '/',\n user: _user,\n orgSwitcher,\n topContent,\n identity,\n navTop,\n beforeNav,\n footerContent,\n borderless,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel: _searchLabel,\n sectionLabels,\n navKey,\n navDirection = 'forward',\n navChildConnector,\n drawer,\n}: SidebarProps) {\n const currentPath = currentPathProp\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\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 // Accordion de um grupo só. Dois grupos abertos empurram o resto do rail para\n // fora da tela e fazem o usuário rolar para achar o que já estava à vista —\n // abrir um fecha o outro. O estado mora AQUI, e não em cada linha, porque é\n // justamente a relação entre as linhas que está sendo decidida.\n const groupWithActiveRoute = React.useMemo(() => {\n const groups = navigation.filter((item) => item.children && item.children.length > 0)\n return groups.find((item) =>\n item.route === activeRoute || item.children!.some((child) => child.route === activeRoute),\n )?.id ?? null\n }, [navigation, activeRoute])\n\n const [openGroup, setOpenGroup] = React.useState<string | null>(groupWithActiveRoute)\n\n // A rota manda: chegar em /agenda por qualquer caminho (link, deep link,\n // voltar do navegador) deixa o grupo dela aberto.\n React.useEffect(() => {\n if (groupWithActiveRoute) setOpenGroup(groupWithActiveRoute)\n }, [groupWithActiveRoute])\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\n key={item.id}\n item={item}\n collapsed={collapsed}\n activeRoute={activeRoute}\n onNavigate={handleNavigate}\n childConnector={navChildConnector}\n flyout={flyout}\n open={openGroup === item.id}\n onOpen={(next) => setOpenGroup(next ? item.id : null)}\n />\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 // A largura da GAVETA vai em `style`, logo abaixo — ver o porquê lá.\n collapsed ? 'w-16' : !drawer && 'w-56',\n )}\n // A gaveta do celular é mais larga que o rail do desktop, e de propósito:\n // lá os 2rem a menos devolvem espaço à coluna de conteúdo, que divide a\n // tela com o rail; aqui não há divisão — a gaveta cobre a página —, então\n // estreitar não compra nada e só trunca nome de seção mais cedo.\n //\n // E vai em `style`, não em classe: quem gera o CSS é o Tailwind do APP, e\n // ele não varre este fonte. Classe nova aqui simplesmente não existe do\n // outro lado — `w-56` só funcionava por já estar no CSS publicado, e\n // qualquer substituta (`w-72`, `w-[min(...)]`) saía sem regra nenhuma,\n // deixando a gaveta sem largura e espremida contra a borda.\n style={drawer && !collapsed ? { width: 'min(18rem, 85vw)' } : undefined}\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 // `logo === null` é uma opinião, não a falta de uma: quer dizer\n // \"esta casa não é marcada pelo produto\". A linha da marca então\n // não existe, e o rail abre direto no seletor de conta — o ícone da\n // casa, o nome e o chevron, numa linha só. `undefined` continua\n // caindo no rótulo padrão, que é o que um app sem logo sempre teve.\n logo === null && !topContent && 'hidden',\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 // 36px de alvo, não 28: é um controle para o POLEGAR, e ficava\n // menor que o próprio selo do produto ao lado — pequeno demais\n // para acertar e leve demais para parecer o fechar da gaveta.\n className=\"fz-tap flex h-9 w-9 shrink-0 items-center justify-center rounded-button text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label=\"Close menu\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n )}\n </div>\n {identity && (\n // Sem a linha da marca acima, a conta encosta no topo da janela. O ar\n // que a marca ocupava continua sendo necessário: é o que separa o\n // conteúdo do rail da borda do navegador.\n <div\n className={cn(\n 'px-2 pb-2',\n logo === null && !topContent && 'pt-3',\n collapsed && 'flex justify-center',\n )}\n >\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 {/* A busca saiu daqui para o meio da barra da página. O que sobra neste\n lugar é a SAÍDA de um contexto (Configurações, Análises, um módulo que\n tomou o trilho) — o host a entrega em `navTop`. Sem contexto, o lugar\n não existe: uma faixa vazia sob o seletor de conta só empurrava a\n navegação para baixo. */}\n {navTop && (\n <div className={cn('px-2 pb-2 pt-2', collapsed && 'flex justify-center')}>\n {withCollapsed(navTop, collapsed)}\n </div>\n )}\n\n {beforeNav && (\n <div className={cn('px-2 pb-1 empty:hidden', collapsed && 'flex justify-center')}>\n {withCollapsed(beforeNav, collapsed)}\n </div>\n )}\n\n {/* Enquanto o shell ainda não sabe o que esta conta tem, o rail espera\n em esqueleto. Uma lista curta que depois cresce é pior que nenhuma:\n ela muda embaixo do olho de quem já começou a ler, e por um instante\n promete um sistema menor do que o que a conta tem.\n\n ── Por que ele ocupa o espaço desde o primeiro quadro ──────────────\n Antes o esqueleto entrava por `setTimeout(140ms)`, e nesses 140ms o\n rail ficava VAZIO — a lista real já está `hidden`. Eram três estados\n em sequência: branco, esqueleto, rail. O branco é o que se lia como\n salto, porque é o único em que a coluna não tem altura nenhuma.\n\n Agora ele está montado o tempo todo da espera e só a OPACIDADE é\n adiada: numa resposta de 80ms o usuário não vê barra cinza nenhuma\n (elas nunca chegam a aparecer), e numa lenta a coluna já tinha a\n altura certa antes de ficar visível. O atraso continua cobrindo a\n resposta rápida; o que ele deixou de cobrar é o quadro em branco. */}\n {/* A leitura falhou. Antes disso o shell desenhava o rail PADRÃO DO PACOTE\n — uma linha, \"Painel\" — e o seletor oferecia \"criar área de trabalho\":\n a resposta de quem não tem conta nenhuma, dada a quem tem sete e não\n conseguiu lê-las. Um erro que se parece com um estado normal é pior\n que um erro, porque ninguém vai atrás dele. */}\n {navError && !navLoading && (\n <div className=\"flex-1 px-3 py-4\">\n <p className=\"text-sm font-medium text-sidebar-foreground\">\n {navErrorLabel ?? 'Não foi possível carregar o menu'}\n </p>\n <p className=\"mt-1 text-xs leading-relaxed text-sidebar-muted\">{navError}</p>\n {onNavRetry && (\n <button\n type=\"button\"\n onClick={onNavRetry}\n className=\"fz-tap mt-3 rounded-button bg-sidebar-accent px-2.5 py-1.5 text-xs font-medium text-sidebar-accent-foreground transition-colors hover:brightness-110\"\n >\n {navRetryLabel ?? 'Tentar de novo'}\n </button>\n )}\n </div>\n )}\n\n {navLoading && (\n <nav\n aria-busy\n aria-label=\"Carregando menu\"\n className=\"fz-rail-skeleton flex-1 space-y-1 p-2\"\n >\n {SKELETON_ROWS.map((row, i) => (\n <div key={i} className=\"flex h-9 items-center gap-3 rounded-button px-2.5\">\n <span className=\"h-4 w-4 shrink-0 rounded bg-sidebar-foreground/10\" />\n {!collapsed && (\n <>\n {/* Larguras desiguais: barras idênticas leem como tabela, não\n como um menu que está chegando. */}\n <span className=\"h-3 rounded bg-sidebar-foreground/10\" style={{ width: `${row.width}%` }} />\n {/* Duas linhas com seta, porque o rail real tem rubricas: um\n esqueleto todo de folhas anuncia um menu mais raso do que\n o que vai chegar. */}\n {row.group && (\n <span className=\"ml-auto h-3 w-3 shrink-0 rounded bg-sidebar-foreground/[0.07]\" />\n )}\n </>\n )}\n </div>\n ))}\n </nav>\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 hidden={navLoading || !!navError}\n className={cn(\n 'relative flex-1 p-2',\n // Entra em fade: o rail é a primeira coisa que alguém lê depois de\n // escolher a conta, e aparecer de uma vez lê como sobressalto.\n 'duration-300 animate-in fade-in',\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', collapsed ? 'px-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 justify-center gap-1' : 'gap-1'\n )}>\n {/* The user menu is a row when there is room and a portrait when there\n is not — it has to be TOLD which, like every other slot here. */}\n {withCollapsed(userMenuSlot, collapsed)}\n\n {/* Spacer pushes icons to right when expanded */}\n {!collapsed && <div className=\"flex-1\" />}\n\n {/* Notification slot or default bell */}\n {withCollapsed(notificationSlot, collapsed) ?? (\n <button\n {...(collapsed\n ? flyout.rowProps({\n key: 'notifications',\n label: unreadCount > 0 ? `Notificações (${unreadCount})` : 'Notificações',\n })\n : {})}\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 {...(collapsed ? flyout.rowProps({ key: 'expand-sidebar', label: 'Expandir menu' }) : {})}\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 { create } from 'zustand'\n\ninterface LayoutState {\n sidebarOpen: boolean\n sidebarCollapsed: boolean\n mobileDrawerOpen: boolean\n /**\n * A próxima troca de rota NÃO fecha a gaveta.\n *\n * \"Voltar para o início\" navega, mas o que ele faz é trocar o TRILHO: a\n * pessoa segue escolhendo para onde ir, dentro do menu. Fechar ali devolvia\n * a tela de onde ela estava saindo e obrigava a reabrir o menu para o passo\n * seguinte. Consumido uma vez e rearmado em false, para que um destino de\n * verdade continue fechando.\n */\n drawerKeepOpenOnce: boolean\n commandPaletteOpen: boolean\n /**\n * O que a paleta já deve estar procurando quando abrir.\n *\n * A busca do trilho filtra o trilho; quando o que se procura não está lá,\n * ela ESCALA para a paleta — e escalar não pode custar digitar de novo o\n * que já foi digitado. Zerado ao fechar, para que o ⌘K seco abra limpo.\n */\n commandPaletteQuery: string\n setMobileDrawerOpen: (open: boolean) => void\n keepDrawerOpenOnce: () => void\n toggleSidebar: () => void\n setSidebarCollapsed: (collapsed: boolean) => void\n toggleMobileDrawer: () => void\n setCommandPaletteOpen: (open: boolean, query?: string) => void\n}\n\nexport const useLayoutStore = create<LayoutState>((set) => ({\n sidebarOpen: true,\n sidebarCollapsed: false,\n mobileDrawerOpen: false,\n drawerKeepOpenOnce: false,\n commandPaletteOpen: false,\n commandPaletteQuery: '',\n\n toggleSidebar: () =>\n set((state) => ({ sidebarOpen: !state.sidebarOpen })),\n\n setSidebarCollapsed: (collapsed) =>\n set({ sidebarCollapsed: collapsed }),\n\n toggleMobileDrawer: () =>\n set((state) => ({ mobileDrawerOpen: !state.mobileDrawerOpen })),\n\n setMobileDrawerOpen: (open) => set({ mobileDrawerOpen: open }),\n keepDrawerOpenOnce: () => set({ drawerKeepOpenOnce: true }),\n\n // Opening search closes the mobile drawer. The palette is a full-screen\n // surface on a phone, and leaving the drawer mounted behind it means the user\n // dismisses the palette onto a menu they had already navigated away from.\n // Handled here so every entry point behaves the same — the rail's search\n // field, the topbar button and the ⌘K shortcut.\n setCommandPaletteOpen: (open, query) =>\n set(open\n ? { commandPaletteOpen: true, mobileDrawerOpen: false, commandPaletteQuery: query ?? '' }\n : { commandPaletteOpen: false, commandPaletteQuery: '' }),\n}))\n","import * as React from 'react'\nimport { CornerDownLeft, Search } from 'lucide-react'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { cn } from '../lib/cn'\n\n/** \"⌘\" on a Mac, \"Ctrl \" everywhere else — the hint has to name the key the\n * reader actually has, or it is decoration. */\nexport function shortcutKey(): string {\n if (typeof navigator === 'undefined') return '⌘'\n return /Mac|iPhone|iPad/u.test(navigator.platform || navigator.userAgent) ? '⌘' : 'Ctrl '\n}\n\n/**\n * A única busca da casca, centrada na barra da página.\n *\n * Ela era uma linha da trilha. A trilha é onde se TROCA de tela, e buscar não é\n * um destino — é a travessia de todas elas, então pertence à faixa que fica\n * parada enquanto a seleção da trilha anda. Centrada e não encostada numa\n * ponta: no meio da barra ela fica equidistante de onde quer que o cursor\n * esteja, e lê como porta de entrada do produto em vez de mais um controle\n * enfileirado ao lado do título.\n *\n * Botão, não campo, no modo padrão: quem digita digita na paleta, e um input\n * que rouba o cursor no clique brigaria com ⌘K pelo mesmo trabalho. O modo\n * CONTEXTUAL (`onValueChange`) é a exceção — ali ele filtra o que a trilha já\n * está mostrando, e não há paleta para disputar.\n */\nexport interface ShellSearchProps {\n /** Placeholder. In a context the host names WHAT is being filtered here —\n * \"Buscar relatórios\", \"Buscar em Configurações\". */\n label?: string\n /** `rail` paints it with the sidebar tokens; on a dark rail the page tokens\n * would be dark text on dark. */\n tone?: 'bar' | 'rail'\n /** Collapsed rail: the magnifier alone, and it goes straight to the palette —\n * there is no room to type, so there is nothing to filter. */\n collapsed?: boolean\n /** Contextual mode. With a handler the control is a FIELD that filters what\n * the rail is showing; without one it stays a button onto the palette. */\n value?: string\n onValueChange?: (value: string) => void\n /** The way out to the whole product, shown once something is typed. */\n searchAllLabel?: string\n className?: string\n}\n\n/** The one search affordance of the shell — first field of the rail, under the\n * workspace picker and whatever switch the host hung below it.\n *\n * It searches WHERE YOU ARE first. In a context (Settings, a module that took\n * the rail) that is the list in front of you; on the app rail it is the app's\n * own destinations. That is the answer to the question people actually ask\n * from a screen — \"where is the report I was just in\" — and the reason it is a\n * field and not a button: the palette is a different act, over everything the\n * tenant owns, and jumping straight to it turned every local look-up into a\n * global one.\n *\n * The global search is never more than one keystroke away: Enter escalates and\n * CARRIES the typed text into the palette, and the row under the field says so\n * in words as soon as there is something to carry. ⌘K still opens it cold. */\nexport function ShellSearch({\n label = 'Search',\n tone = 'bar',\n collapsed = false,\n value,\n onValueChange,\n searchAllLabel = 'Search everywhere',\n className,\n}: ShellSearchProps) {\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n const rail = tone === 'rail'\n const contextual = !!onValueChange && !collapsed\n const query = value ?? ''\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n const escalate = () => setCommandPaletteOpen(true, query)\n\n const surface = rail\n ? 'bg-sidebar-accent/40 text-sidebar-muted hover:bg-sidebar-accent/70 hover:text-sidebar-foreground'\n : 'bg-accent/40 text-muted-foreground hover:bg-accent/70 hover:text-foreground'\n // Foco discreto: num trilho escuro `sidebar-accent-foreground` é quase\n // branco, e um anel de 2px nessa cor desenhava uma caixa acesa em volta do\n // campo — mais forte que o item selecionado do próprio menu. Um anel fino e\n // a superfície um tom acima já dizem \"o cursor está aqui\".\n const ring = rail\n ? 'focus-within:bg-sidebar-accent/70 focus-within:ring-1 focus-within:ring-sidebar-accent-foreground/25'\n : 'focus-within:bg-accent/70 focus-within:ring-1 focus-within:ring-ring/40'\n\n if (!contextual) {\n return (\n <button\n onClick={escalate}\n aria-keyshortcuts=\"Meta+K Control+K\"\n className={cn(\n // Tonal surface, no outline. A 1px border here is a hard edge\n // competing with every other hard edge; a lighter fill of the same\n // hue reads as \"a field\" without drawing a box — and leaves the\n // outline treatment free to mean focus, which it must.\n 'fz-tap group flex items-center rounded-lg transition-colors',\n collapsed ? 'h-9 w-9 justify-center' : 'h-9 w-full gap-2.5 px-2.5',\n surface,\n 'focus-visible:outline-none focus-visible:ring-2',\n rail ? 'focus-visible:ring-sidebar-accent-foreground/50' : 'focus-visible:ring-ring/50',\n className,\n )}\n aria-label={label}\n title={collapsed ? label : undefined}\n >\n <Search className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left text-[13px]\">{label}</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 opacity-70 transition-opacity group-hover:opacity-100\">\n {shortcutKey()}K\n </span>\n </>\n )}\n </button>\n )\n }\n\n return (\n <div className={cn('flex flex-col gap-1', className)}>\n <div\n className={cn(\n 'group flex h-9 w-full items-center gap-2.5 rounded-lg px-2.5 transition-colors',\n surface,\n 'focus-within:outline-none',\n ring,\n )}\n >\n <Search className=\"h-4 w-4 shrink-0\" />\n <input\n ref={inputRef}\n type=\"search\"\n value={query}\n onChange={(e) => onValueChange!(e.target.value)}\n onKeyDown={(e) => {\n // Enter is the escalation: what is typed here goes on being typed\n // over there. Escape empties the filter first and only gives the\n // rail back on a second press — leaving a rail filtered down to\n // three rows with no visible cause is how a menu looks broken.\n if (e.key === 'Enter') { e.preventDefault(); escalate() }\n if (e.key === 'Escape' && query) { e.preventDefault(); onValueChange!('') }\n }}\n placeholder={label}\n aria-label={label}\n aria-keyshortcuts=\"Meta+K Control+K\"\n className={cn(\n 'min-w-0 flex-1 border-none bg-transparent p-0 text-[13px] outline-none',\n // `search` inputs paint their own clear button in WebKit, on top of\n // ours and in the browser's grey.\n '[&::-webkit-search-cancel-button]:appearance-none',\n rail\n ? 'text-sidebar-foreground placeholder:text-sidebar-muted'\n : 'text-foreground placeholder:text-muted-foreground',\n )}\n />\n {/* O atalho enquanto o campo está vazio: ali ele cabe e é a única coisa\n que a linha tem a dizer. Digitou, ele sai — a partir daí quem\n anuncia a busca global é a linha de baixo, e um ⌘K ao lado de um\n filtro local prometeria que este campo É a paleta. */}\n {!query && (\n <span className=\"shrink-0 text-[11px] font-medium tabular-nums opacity-70 transition-opacity group-hover:opacity-100\">\n {shortcutKey()}K\n </span>\n )}\n </div>\n\n {/* A saída para o produto inteiro, dita em palavras assim que há o que\n levar. Sem ela, filtrar o trilho e não achar nada é um beco: a pessoa\n apaga o que digitou e recomeça em outro lugar, quando a resposta\n estava a um Enter.\n Sem lupa própria: o ícone já está no campo logo acima, e repeti-lo\n fazia a linha ler como um SEGUNDO campo de busca. Ela se alinha ao\n texto digitado (mesma sangria de 36px) porque é a continuação daquela\n frase, não um controle novo. */}\n {query && (\n <button\n onClick={escalate}\n className={cn(\n 'fz-tap flex w-full items-center gap-2 rounded-lg py-1.5 pl-9 pr-2.5 text-left text-[12px] transition-colors',\n rail\n ? 'text-sidebar-muted hover:bg-sidebar-accent/50 hover:text-sidebar-foreground'\n : 'text-muted-foreground hover:bg-accent/60 hover:text-foreground',\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{searchAllLabel}</span>\n <CornerDownLeft className=\"h-3.5 w-3.5 shrink-0 opacity-60\" aria-hidden />\n </button>\n )}\n </div>\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 { createPortal } from 'react-dom'\nimport { ChevronLeft } from 'lucide-react'\n\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// The phone's sheet.\n//\n// One material and one behaviour for every \"which one?\" asked on a phone: the\n// tab that stands for several screens, the workspace and unit picker, whatever\n// comes next. A dropdown answers this question on a desktop because there is\n// room between the trigger and the bottom of the window; on a phone there is\n// not, and a dialog in the middle of the screen puts the list where the thumb\n// is not. It rises from the bottom edge, in the same glass the tab bar is made\n// of, and it goes away by being pushed back down.\n// ---------------------------------------------------------------------------\n\n/**\n * Drag-to-dismiss.\n *\n * A sheet that only closes by a backdrop tap or a button is a sheet you have\n * to AIM at. Returns the handlers for the panel plus the live offset to draw\n * it at. `canDrag` keeps the gesture from eating the sheet's own scroll — a\n * pull-down only becomes a dismissal when the list is already at its top.\n */\nexport function useSheetDrag({ onDismiss, canDrag }: { onDismiss: () => void; canDrag?: () => boolean }) {\n const [offset, setOffset] = React.useState(0)\n const [dragging, setDragging] = React.useState(false)\n const start = React.useRef<{ y: number; t: number } | null>(null)\n\n const onPointerDown = (e: React.PointerEvent) => {\n // Mouse drags are not what this is for, and swallowing them breaks text\n // selection on the desktop preview of the same component.\n if (e.pointerType === 'mouse') return\n if (canDrag && !canDrag()) return\n start.current = { y: e.clientY, t: e.timeStamp }\n }\n\n const onPointerMove = (e: React.PointerEvent) => {\n if (!start.current) return\n const dy = e.clientY - start.current.y\n // Upward is the sheet's own scroll: hand it back rather than rubber-band.\n if (dy <= 0) { setOffset(0); setDragging(false); return }\n if (!dragging && dy < 4) return\n setDragging(true)\n setOffset(dy)\n }\n\n const end = (e: React.PointerEvent) => {\n if (!start.current) return\n const dy = e.clientY - start.current.y\n const dt = Math.max(1, e.timeStamp - start.current.t)\n const velocity = dy / dt // px/ms\n start.current = null\n setDragging(false)\n // A short, fast flick counts as much as a long, slow pull — the second is\n // the only one a distance threshold alone would catch.\n if (dy > 96 || (dy > 24 && velocity > 0.5)) onDismiss()\n else setOffset(0)\n }\n\n return {\n offset,\n dragging,\n handlers: { onPointerDown, onPointerMove, onPointerUp: end, onPointerCancel: end },\n }\n}\n\n/** Lets a row inside the sheet ask for the animated dismissal instead of\n * yanking the sheet out of the tree. */\nconst SheetCloseContext = React.createContext<(() => void) | null>(null)\n\n/** Dismiss the sheet this is rendered in, playing its exit. */\nexport function useSheetClose(): () => void {\n const close = React.useContext(SheetCloseContext)\n return close ?? (() => {})\n}\n\nexport interface BottomSheetProps {\n /** Small-caps heading above the content. */\n title?: React.ReactNode\n /** When set, a back row replaces the title — a nested level. */\n onBack?: () => void\n backLabel?: string\n /** Rendered in the sheet's scroll area. */\n children: React.ReactNode\n /** Plays the exit, then this. */\n onClose: () => void\n /** Phones only by default: above `md` the caller has room for a popover. */\n desktop?: boolean\n className?: string\n /** Accessible name when `title` is a node rather than text. */\n label?: string\n}\n\nexport function BottomSheet({\n title,\n onBack,\n backLabel = 'Voltar',\n children,\n onClose,\n desktop = false,\n className,\n label,\n}: BottomSheetProps) {\n // The entrance is a keyframe (.fz-sheet-in in styles.css): it runs off the\n // element existing. A mount-then-flip-a-flag entrance depends on a\n // requestAnimationFrame landing between two paints, and a tab the browser is\n // throttling never gets it — the sheet then sits off-screen with its own\n // dismiss controls out of reach. Only the EXIT needs state, because\n // unmounting has to wait for it.\n const [leaving, setLeaving] = React.useState(false)\n const scroller = React.useRef<HTMLDivElement | null>(null)\n\n const close = React.useCallback(() => {\n setLeaving(true)\n window.setTimeout(onClose, 200)\n }, [onClose])\n\n const drag = useSheetDrag({\n onDismiss: close,\n canDrag: () => (scroller.current?.scrollTop ?? 0) <= 0,\n })\n\n // Escape goes back one level before it closes — what the gesture it stands\n // in for would do.\n React.useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return\n if (onBack) onBack()\n else close()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [close, onBack])\n\n React.useEffect(() => {\n const previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n return () => { document.body.style.overflow = previous }\n }, [])\n\n // PORTAL, e não onde o chamador mora.\n //\n // `position: fixed` mede contra o viewport ATÉ existir um ancestral com\n // transform, filter, backdrop-filter ou `will-change: transform` — aí passa a\n // medir contra ele. A folha nasce dentro de conteúdo de página, e a primeira\n // que abriu de dentro da trilha de duas panes do menu (`w-[200%]` com\n // `will-change-transform`) saiu com o DOBRO da largura da tela, metade dela\n // para fora. Montada no body, a folha é do viewport, sempre.\n const [host, setHost] = React.useState<HTMLElement | null>(null)\n React.useEffect(() => { setHost(document.body) }, [])\n if (!host) return null\n\n return createPortal(\n <SheetCloseContext.Provider value={close}>\n <div\n className={cn('fixed inset-0 z-[70]', !desktop && 'md:hidden')}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={label ?? (typeof title === 'string' ? title : undefined)}\n >\n <div\n className={cn('absolute inset-0 bg-black/40', leaving ? 'fz-backdrop-out' : 'fz-backdrop-in')}\n onClick={close}\n />\n <div\n {...drag.handlers}\n style={drag.offset ? { transform: `translateY(${drag.offset}px)` } : undefined}\n className={cn(\n 'fayz-glass-sheet absolute inset-x-0 bottom-0 touch-pan-y rounded-t-[22px] will-change-transform',\n leaving ? 'fz-sheet-out' : 'fz-sheet-in',\n // Mid-drag the inline transform IS the position; a transition would\n // make the sheet lag the thumb that is holding it.\n drag.dragging && 'transition-none',\n !drag.dragging && !leaving && 'transition-transform duration-200 ease-out',\n className,\n )}\n >\n {/* Grab handle — the affordance that says \"drag me down\", and a second\n dismiss target for a thumb that misses the backdrop. */}\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Fechar\"\n className=\"flex w-full justify-center pb-1 pt-2.5\"\n >\n <span aria-hidden className=\"h-1 w-9 rounded-full bg-foreground/20\" />\n </button>\n\n {onBack ? (\n <button\n type=\"button\"\n onClick={onBack}\n className=\"fz-ios-tint fz-tap flex items-center gap-0.5 px-3 pb-1 pt-1 text-[15px]\"\n >\n <ChevronLeft className=\"h-5 w-5\" />\n <span>{backLabel}</span>\n </button>\n ) : null}\n\n {title != null && (\n <p className=\"px-5 pb-2 pt-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">\n {title}\n </p>\n )}\n\n <div ref={scroller} className=\"fz-safe-b max-h-[70vh] overflow-y-auto overscroll-contain px-3 pb-4\">\n {children}\n </div>\n </div>\n </div>\n </SheetCloseContext.Provider>,\n host,\n )\n}\n\n/** The card every sheet list sits in — the settings index's card, so a list of\n * destinations looks the same wherever it is asked for. */\nexport function SheetCard({ children, className }: { children: React.ReactNode; className?: string }) {\n return <div className={cn('divide-y overflow-hidden rounded-card border bg-card', className)}>{children}</div>\n}\n\nexport interface SheetRowProps {\n icon?: React.ReactNode\n label: React.ReactNode\n sublabel?: React.ReactNode\n /** Tag on the right — \"matriz\", a count. */\n hint?: React.ReactNode\n active?: boolean\n /** Draws a chevron: this row goes somewhere, or opens another level. */\n chevron?: boolean\n disabled?: boolean\n onClick?: () => void\n title?: string\n}\n\n/** One row. 52px because a list you scroll with a thumb needs rows a thumb can\n * land on without aiming. */\nexport function SheetRow({\n icon,\n label,\n sublabel,\n hint,\n active,\n chevron,\n disabled,\n onClick,\n title,\n}: SheetRowProps) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n title={title}\n aria-current={active ? 'true' : undefined}\n className={cn(\n 'fz-tap group flex min-h-[52px] w-full items-center gap-3 px-3 text-left transition-colors disabled:opacity-60',\n active ? 'bg-primary/5' : 'hover:bg-muted/50',\n )}\n >\n {icon && (\n <span\n className={cn(\n 'flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors',\n active ? 'bg-primary/10 text-primary' : 'bg-muted text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary',\n )}\n >\n {icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className={cn('block truncate text-sm font-medium leading-tight', active && 'text-primary')}>{label}</span>\n {sublabel != null && <span className=\"block truncate text-xs text-muted-foreground\">{sublabel}</span>}\n </span>\n {hint != null && <span className=\"shrink-0 text-[11px] text-muted-foreground\">{hint}</span>}\n {chevron && (\n <svg aria-hidden viewBox=\"0 0 24 24\" className=\"h-4 w-4 shrink-0 text-muted-foreground/50\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <path d=\"m9 18 6-6-6-6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )}\n </button>\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 ChevronRight,\n ChevronLeft,\n ChevronUp,\n Search,\n X,\n Crown,\n ExternalLink,\n type LucideIcon,\n} from 'lucide-react'\nimport { Sidebar, type NavigationItem, type SidebarUser, type SidebarProps } from './Sidebar'\nimport { ShellSearch } from './ShellSearch'\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 { useCrossModuleBack, setDestinationRoutes } from './useCrossModuleBack'\nimport { recordNavigation } from '@fayz-ai/core'\nimport { BottomSheet, SheetCard, SheetRow, useSheetDrag } from '../primitives/bottom-sheet'\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 * Sub-destinations behind this tab. A rail row like \"Agenda\" is a heading\n * over half a dozen screens; on a phone that heading has ONE slot, so\n * tapping it used to drop the user on whichever child happened to be first\n * and hide the rest behind \"Mais\". With children present the tab opens a\n * sheet and the user picks — the same choice the rail offers, sized for a\n * thumb.\n */\n children?: BottomNavChild[]\n}\n\n/** One row in a tab's sub-destination sheet. */\nexport interface BottomNavChild {\n label: string\n icon?: string\n route: string\n badge?: string | number\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. */\n/**\n * A route that CREATES something rather than going somewhere.\n *\n * The rail lists \"Inserir\" next to \"Listar\" under Clientes, and on a 208px\n * column that is free. A phone menu is a list of PLACES: offering \"Listar\" or\n * \"Inserir\" as a choice makes the user answer a question to reach the only\n * screen they asked for, and the create path is already the \"+\" on that\n * screen. So a menu drops the verb — and a section whose only remaining child\n * is one destination stops being a choice at all and just navigates.\n */\nexport function isCreateRoute(route?: string): boolean {\n return !!route && /\\/(new|create)$/.test(route)\n}\n\n/**\n * Where the phone's \"Mais\" tab goes. A route and not a flag — see the note on\n * `openMenu` in AppShell.\n *\n * `/more`, e não `/menu`: cardápio é `/menu`, e é uma rota PÚBLICA — a\n * storefront serve o cardápio nela (ver STATIC_PATTERNS) e a entrega guarda o\n * caminho em `delivery.menuPath`. Essa rota tem dono há muito mais tempo do que\n * a tela de navegação do celular, e é a que aparece em link de cliente. A que\n * se muda é a nova.\n */\nexport const MENU_ROUTE = '/more'\n\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 /** Repassado ao rail: espera em esqueleto em vez de pintar uma lista curta. */\n navLoading?: boolean\n navError?: string | null\n navErrorLabel?: string\n navRetryLabel?: string\n onNavRetry?: () => void\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 /** Pinned row above the first destination — see Sidebar's `beforeNav`. */\n sidebarBeforeNav?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n bottomNav?: BottomNavItem[]\n /**\n * The APP's own menu, when `navigation` is showing a contextual rail.\n *\n * On /settings (or inside a module's own menu) the rail swaps its rows for\n * that context's, which is right for a column standing beside the app. It is\n * wrong for the phone's \"Mais\" screen: that screen IS the app's menu, and\n * reading the swapped rows made /settings offer its own tabs as the way out\n * of /settings — a door back into the room you are in. Given this, \"Mais\"\n * always shows the app; without it, it falls back to `navigation`.\n */\n appNavigation?: NavigationItem[]\n /**\n * The workspace/unit control, shaped for a phone.\n *\n * `orgSwitcher` and `sidebarIdentity` are built for a rail: a dropdown that\n * opens downward with the window's height to spend. On a 390px screen that\n * same menu starts at the top edge and answers the app's most-asked question\n * (\"where am I?\") farthest from the thumb. Given this, the \"Mais\" screen\n * renders it instead of the rail's node.\n */\n mobileIdentity?: React.ReactNode\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 /**\n * The page draws its own top bar, so the shell contributes none on desktop.\n * The card is untouched: its border and surface are what make the page and\n * the companion column read as one window.\n */\n immersive?: boolean\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 primary = false,\n}: {\n title?: string\n back?: AppShellProps['pageBack']\n /** Esta rota é uma linha do menu — ver `isDestination` em AppShell. */\n primary?: boolean\n}) {\n // VOLTAR É PARA ONDE SE VEIO, NÃO PARA O PAI DECLARADO.\n //\n // `pageBack` vem da ROTA: /settings/profile sabe que seu pai é /settings, e\n // desenhava \"← Configurações\" mesmo para quem chegou ali vindo da Agenda.\n // Seguir esse link não é voltar, é descer um degrau lateral — e a cada vez a\n // pessoa fica mais longe de onde estava, com o histórico do navegador\n // guardando o caminho todo. As telas que desenham o próprio cabeçalho já\n // resolviam isso (PageHeader chama o mesmo gancho); a faixa da shell era a\n // única que ainda não.\n //\n // Dentro do mesmo módulo o pai declarado continua valendo: ele é mais\n // específico que \"a página anterior\", e ali as duas coisas coincidem.\n const resolved = useCrossModuleBack(back?.onBack, back?.label)\n if (!title && !back) return null\n // Numa tela primária o nome basta: nem o pai da rota nem a página anterior\n // são \"de onde se veio\" — chegou-se aqui pelo menu.\n const crumb = primary ? { parentLabel: undefined, onBack: undefined } : resolved\n return (\n <PageHeaderCrumb\n title={title}\n parentLabel={crumb.parentLabel}\n onBack={crumb.onBack}\n headingLevel=\"h1\"\n />\n )\n}\n\n// ---------------------------------------------------------------------------\n// Sidebar layout\n// ---------------------------------------------------------------------------\n\nfunction SidebarLayout({\n navigation = [],\n navLoading = false,\n navError,\n navErrorLabel,\n navRetryLabel,\n onNavRetry,\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 sidebarBeforeNav,\n sidebarFooterContent,\n frame,\n immersive,\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 mobileBackToMenu,\n menuNavigation,\n menuOpen = false,\n menuLingering = false,\n menuLeaving = false,\n onMenuClose,\n onMenuDismiss,\n mobileIdentity,\n pagePrimary = false,\n mobileHeader = 'minimal',\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n railOpen,\n}: {\n navigation?: NavigationItem[]\n navLoading?: boolean\n navError?: string | null\n navErrorLabel?: string\n navRetryLabel?: string\n onNavRetry?: () => void\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 /** Pinned row above the first destination — see Sidebar's `beforeNav`. */\n sidebarBeforeNav?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n frame?: boolean\n immersive?: 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 /** Phone-only way out of a screen the bottom bar cannot return to. */\n mobileBackToMenu?: () => void\n /** The app's own menu for the \"Mais\" screen — see AppShellProps.appNavigation. */\n menuNavigation?: NavigationItem[]\n /** The phone's menu route is the current one. */\n menuOpen?: boolean\n /** The menu route is gone but its exit is still playing. */\n menuLingering?: boolean\n /** Play the exit now. */\n menuLeaving?: boolean\n /** Leave the menu route (history back). */\n onMenuClose?: () => void\n /** Start the exit and run `navigate` immediately, so the animation plays\n * over the destination instead of over /menu's own 404. */\n onMenuDismiss?: (navigate?: () => void) => void\n /** Phone-shaped workspace/unit control — see AppShellProps.mobileIdentity. */\n mobileIdentity?: React.ReactNode\n /** The route is a menu row: name it, do not offer a way back. */\n pagePrimary?: 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 navLoading={navLoading}\n navError={navError}\n navErrorLabel={navErrorLabel}\n navRetryLabel={navRetryLabel}\n onNavRetry={onNavRetry}\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 beforeNav={sidebarBeforeNav}\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 // The headings belong to whichever menu is being shown. On a\n // contextual rail they describe ITS rows, and pairing them with the\n // app's would have titled the app menu \"Configurações\".\n sectionLabels={menuNavigation ? undefined : sidebarSectionLabels}\n navKey={sidebarNavKey}\n navDirection={sidebarNavDirection}\n navChildConnector={sidebarNavChildConnector}\n />\n </div>\n\n {/* Main content — the top bar, then the inset framed card UNDER it.\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=\"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 {/* Emoldurado, a barra corre POR FORA do cartão, sobre a moldura — que\n é pintada na cor do menu (o `md:bg-sidebar` da raiz da shell). Com\n isso o topo do menu e a barra da página viram UMA faixa só de ponta\n a ponta, e o cartão do conteúdo passa a arredondar por baixo dela,\n em vez de o arredondamento começar no alto da tela e a faixa escura\n terminar no meio do caminho.\n Sem moldura ela continua sem superfície própria, tomando o que a\n coluna pinta — pintá-la de `card` sobre uma página sem moldura fazia\n uma tira mais clara atravessando o topo, lida como um widget posto\n sobre o conteúdo; a linha embaixo é o que separa. */}\n <div className={cn(\n // `relative`: the page title centres itself against THIS box on a\n // phone (see PageHeaderCrumb) — the bar is the thing it has to be in\n // the middle of, not whichever group it happens to be rendered in.\n 'relative flex shrink-0 items-center justify-between gap-3 px-4 py-2',\n menuOpen && 'invisible md:visible',\n // 44px on a phone — the height every other bar in this product now\n // uses (the \"Mais\" screen, a sheet's header) and the height a phone's\n // own navigation bar has. Desktop keeps its 56px band.\n 'min-h-[44px] md:min-h-14 border-b border-border',\n // On a phone this band IS the navigation bar, so it is made of the\n // same glass as the tab bar below it and the sheets between them —\n // one material for the chrome, the page reading through all of it.\n 'fayz-glass-topbar',\n // Sobre a moldura, os tokens do menu. O que a barra mostra (título,\n // abas do módulo, botões) é escrito com `foreground`/`border`/`muted`\n // comuns: num app de menu escuro isso seria texto escuro sobre preto.\n // Remapear as variáveis aqui converte a barra inteira de uma vez, sem\n // cada página saber em que superfície caiu. A linha de baixo sai: a\n // borda de cima do cartão já é a costura.\n // Altura TRAVADA em 56px na moldura, não mínima: esta faixa e a do\n // assistente são desenhadas em subárvores diferentes, e o que alinha\n // o topo dos dois cartões é as duas terem exatamente a mesma altura.\n // Com `min-h` bastava um controle mais alto de um lado para o cartão\n // daquele lado descer sozinho.\n frame && 'fz-on-band md:h-14 md:border-b-0 md:text-sidebar-foreground md:[--accent-foreground:var(--sidebar-accent-foreground)] md:[--accent:var(--sidebar-accent)] md:[--background:var(--sidebar)] md:[--border:var(--sidebar-border)] md:[--card:var(--sidebar)] md:[--foreground:var(--sidebar-foreground)] md:[--muted-foreground:var(--sidebar-muted)] md:[--muted:var(--sidebar-accent)]',\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 // Immersive pages draw their own window bar. Keeping ours would be two\n // bars stating one thing — but only on desktop: on a phone this band\n // is where the hamburger lives, and the page's bar sits under it.\n immersive && 'md:hidden',\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 {/* Phone-only back to the menu this screen was opened from. Sits\n where the hamburger used to, which is where a thumb goes for\n \"out of here\". */}\n {mobileBackToMenu && (\n <button\n type=\"button\"\n onClick={mobileBackToMenu}\n className=\"fz-ios-tint fz-tap -ml-1 inline-flex shrink-0 items-center gap-0.5 text-[15px] md:hidden\"\n >\n <ChevronLeft className=\"h-5 w-5\" />\n <span>Voltar</span>\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} primary={pagePrimary} />}\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 {/* A busca, no meio da faixa. Ela era a primeira linha do trilho, e o\n trilho é onde se TROCA de tela: buscar não é um destino, é a\n travessia de todas elas — pertence à faixa que fica parada\n enquanto a seleção do trilho anda. Centrada, fica equidistante de\n onde quer que o cursor esteja e lê como porta de entrada do\n produto, não como mais um controle enfileirado ao lado do título.\n Só no desktop: no celular a barra tem 44px e três coisas já\n disputando a largura, e a busca do telefone mora na tela \"Mais\". */}\n <div className=\"hidden min-w-0 flex-1 justify-center px-2 md:flex\">\n <ShellSearch tone=\"bar\" label={searchLabel} className=\"w-full max-w-[280px]\" />\n </div>\n {/* `flex-1` só a partir de md, onde existe a busca no meio para os dois\n lados equilibrarem. No celular a busca não é desenhada, e um lado\n direito reivindicando metade da barra roubava essa metade do\n TÍTULO — um breadcrumb como \"← Relatórios / DRE —…\" truncava com\n meia tela vazia ao lado. Abaixo de md ele ocupa o que os botões\n pedem, e o resto é do nome da tela. */}\n <div className=\"flex min-w-0 shrink-0 items-center justify-end gap-2 md:flex-1\">\n {/* Pages portal their primary action buttons here */}\n {/* O que cai aqui é pintado pela cor da FAIXA, não pela do papel.\n A barra é da cor do trilho; um botão `bg-primary` de uma marca\n escura nasce preto sobre preto. `--primary-on-rail` é a mesma\n marca quando ela lê bem aqui, e a tinta do item ativo do trilho\n quando não — ver `railSafePrimary`. */}\n <div ref={setActionsSlot} className=\"flex items-center gap-2\" style={{ '--primary': 'var(--primary-on-rail)', '--primary-foreground': 'var(--primary-on-rail-foreground)' } as React.CSSProperties} />\n {topbarEnd}\n </div>\n </div>\n\n {/* O cartão do conteúdo, agora ABAIXO da barra: o arredondamento do\n topo encosta na faixa escura em vez de começar junto com ela.\n A trilha da página (PageRail) mora dentro dele — a barra passa por\n cima das duas, que é o que faz dela uma faixa inteira. */}\n <div data-frame={frame || undefined} className={cn(\n 'relative flex min-w-0 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 'fz-page-surface',\n frame && 'md:mb-2 md:ml-2 md:rounded-xl md:border md:border-border md:bg-content',\n // Sem barra no desktop (páginas imersivas desenham a sua) o cartão\n // ficaria colado no alto da janela: a folga de cima volta.\n frame && immersive && 'md:mt-2',\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 immersive && 'md:overflow-hidden',\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 {/* Page content.\n Hidden under /menu: that route belongs to the SHELL, and the\n app router has no page for it — so what the menu slid up over\n was \"Não encontrado\". Only while the route IS /menu: on the way\n out the route is already the destination, and the menu has to\n come down over it, not over a blank. */}\n <main className={cn('min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0', menuOpen && 'invisible md:visible')}>\n {children}\n </main>\n\n {/* App-wide floating SaveBar (spans the content column, not the sidebar) */}\n <SaveBar />\n </div>\n </div>\n </div>\n\n {/* Mobile navigation. With a bottom bar the phone gets the full-screen\n \"Mais\" screen (iOS Settings shape); without one the hamburger still\n opens the rail as a drawer, which is the only nav that layout has. */}\n {/* `barOwnsNav`, not `hasBottomNav`: the bar RETRACTS on a screen like\n /settings, and the retracted flag is what reaches this component. Read\n that one and the screen whose only way out is \"Mais\" got the desktop\n rail as a drawer instead — the very thing the phone screen replaced. */}\n {(menuOpen || menuLingering) && (\n <MobileMoreScreen\n navigation={menuNavigation ?? navigation}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n onSignOut={onSignOut}\n orgSwitcher={orgSwitcher}\n mobileIdentity={mobileIdentity}\n identity={sidebarIdentity}\n notificationSlot={notificationSlot}\n searchLabel={searchLabel}\n sectionLabels={sidebarSectionLabels}\n leaving={menuLeaving}\n onDismiss={onMenuDismiss}\n onClose={() => onMenuClose?.()}\n />\n )}\n {mobileMenuOpen && !barOwnsNav && (\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 beforeNav={sidebarBeforeNav}\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 mobileBackToMenu,\n menuNavigation,\n menuOpen = false,\n menuLingering = false,\n menuLeaving = false,\n onMenuClose,\n onMenuDismiss,\n mobileIdentity,\n pagePrimary = 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 /** Phone-only way out of a screen the bottom bar cannot return to. */\n mobileBackToMenu?: () => void\n /** The app's own menu for the \"Mais\" screen — see AppShellProps.appNavigation. */\n menuNavigation?: NavigationItem[]\n /** The phone's menu route is the current one. */\n menuOpen?: boolean\n /** The menu route is gone but its exit is still playing. */\n menuLingering?: boolean\n /** Play the exit now. */\n menuLeaving?: boolean\n /** Leave the menu route (history back). */\n onMenuClose?: () => void\n /** Start the exit and run `navigate` immediately, so the animation plays\n * over the destination instead of over /menu's own 404. */\n onMenuDismiss?: (navigate?: () => void) => void\n /** Phone-shaped workspace/unit control — see AppShellProps.mobileIdentity. */\n mobileIdentity?: React.ReactNode\n /** The route is a menu row: name it, do not offer a way back. */\n pagePrimary?: 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 data-frame={frame || undefined} className={cn('fz-page-surface 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 // `relative` + glass for the same reason as the sidebar\n // layout's band: on a phone this IS the navigation bar.\n 'relative flex min-h-[44px] md:min-h-12 shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-2',\n menuOpen && 'invisible md:visible',\n 'fayz-glass-topbar',\n !(pageHeaderClaimed || pageBack || hasPageActions) && 'md:hidden',\n )}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {mobileBackToMenu && (\n <button\n type=\"button\"\n onClick={mobileBackToMenu}\n className=\"fz-ios-tint fz-tap -ml-1 inline-flex shrink-0 items-center gap-0.5 text-[15px] md:hidden\"\n >\n <ChevronLeft className=\"h-5 w-5\" />\n <span>Voltar</span>\n </button>\n )}\n {!pageHeaderClaimed && <ShellPageTitle title={showTitle ? pageTitle : undefined} back={pageBack} primary={pagePrimary} />}\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 {/* O que cai aqui é pintado pela cor da FAIXA, não pela do papel.\n A barra é da cor do trilho; um botão `bg-primary` de uma marca\n escura nasce preto sobre preto. `--primary-on-rail` é a mesma\n marca quando ela lê bem aqui, e a tinta do item ativo do trilho\n quando não — ver `railSafePrimary`. */}\n <div ref={setActionsSlot} className=\"flex shrink-0 items-center gap-2\" style={{ '--primary': 'var(--primary-on-rail)', '--primary-foreground': 'var(--primary-on-rail-foreground)' } as React.CSSProperties} />\n </div>\n )}\n {/* Hidden under /menu — see the sidebar layout's note. */}\n <div className={cn('min-h-0 flex-1 overflow-y-auto pb-16 md:pb-0', menuOpen && 'invisible md:visible')}>\n {children}\n </div>\n </div>\n </div>\n </main>\n\n {/* App-wide floating SaveBar */}\n <SaveBar />\n\n {/* Mobile navigation — same split as the sidebar layout: the bar's\n \"Mais\" opens the full-screen screen, a bare burger opens the rail. */}\n {/* `barOwnsNav`, not `hasBottomNav`: the bar RETRACTS on a screen like\n /settings, and the retracted flag is what reaches this component. Read\n that one and the screen whose only way out is \"Mais\" got the desktop\n rail as a drawer instead — the very thing the phone screen replaced. */}\n {(menuOpen || menuLingering) && (\n <MobileMoreScreen\n navigation={menuNavigation ?? navigation}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n onSignOut={onSignOut}\n orgSwitcher={orgSwitcher}\n mobileIdentity={mobileIdentity}\n notificationSlot={notificationSlot}\n leaving={menuLeaving}\n onDismiss={onMenuDismiss}\n onClose={() => onMenuClose?.()}\n />\n )}\n {mobileMenuOpen && !barOwnsNav && (\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// \"Mais\" — full-screen navigation on a phone.\n//\n// The phone used to get the DESKTOP rail slid in from the left: a 208px column\n// of 32px rows over a dimmed app, with a collapse toggle and a search field\n// built for a pointer. It works, and it reads as a website on a phone.\n//\n// This is the SAME object the settings index already is — a list of\n// destinations in inset grouped cards — down to the row, the icon tile and the\n// chevron, because two screens that do the same job in the same product should\n// not be two designs. Picking a section that has children PUSHES, the way a\n// phone does it, instead of growing an accordion under the finger that opened\n// it. Theme colours throughout: the rail is dark because it is a column beside\n// the app, and this is the app, full width.\n// ---------------------------------------------------------------------------\ninterface MobileMoreScreenProps {\n navigation: NavigationItem[]\n user?: AppShellUser\n currentPath?: string\n onNavigate?: (route: string) => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n onSignOut?: () => void\n orgSwitcher?: React.ReactNode\n /** Phone-shaped workspace/unit control: a full-bleed row that opens a sheet.\n * Preferred over the rail's dropdown, which is built for a column. */\n mobileIdentity?: React.ReactNode\n /** The current workspace row the rail shows under its brand. */\n identity?: React.ReactNode\n notificationSlot?: React.ReactNode\n searchLabel?: string\n sectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** The shell is playing this screen's exit — see `dismissMenu` there. */\n leaving?: boolean\n /** Start the exit AND navigate in the same beat. Without it the exit plays\n * over /menu, a route the app router has no page for, so the 220ms of\n * animation are 220ms of \"Não encontrado\". */\n onDismiss?: (navigate?: () => void) => void\n onClose: () => void\n}\n\nfunction MobileMoreScreen({\n navigation,\n user,\n currentPath,\n onNavigate,\n onProfile,\n onSettings,\n onBilling,\n onSignOut,\n orgSwitcher,\n mobileIdentity,\n identity,\n notificationSlot,\n searchLabel,\n sectionLabels,\n leaving = false,\n onDismiss,\n onClose,\n}: MobileMoreScreenProps) {\n // The pushed section, if any. One level is all the rail has, so a single\n // slot beats a stack that can never hold two.\n const [pushed, setPushed] = React.useState<NavigationItem | null>(null)\n const [query, setQuery] = React.useState('')\n const scroller = React.useRef<HTMLDivElement | null>(null)\n\n // \"Concluído\" e o gesto vão pelo SHELL, não por `onDismiss` direto.\n //\n // `onDismiss` recebe a navegação de quem chama; chamado vazio, ele toca a\n // saída e não vai a lugar nenhum — que foi exatamente o que aconteceu: o\n // botão animava e deixava o usuário em /menu. Quem sabe para onde sair daqui\n // é o shell (a tela de origem, ou a primeira aba), e é ele que está atrás de\n // `onClose`. `onDismiss` fica para as linhas que trazem o próprio destino.\n const close = React.useCallback(() => { onClose() }, [onClose])\n\n const drag = useSheetDrag({\n onDismiss: close,\n // Only from the top of the list, and only from the root level — a drag on\n // a pushed section would dismiss the screen the back button is for.\n canDrag: () => !pushed && (scroller.current?.scrollTop ?? 0) <= 0,\n })\n\n // Escape goes BACK one level before it closes, which is what the swipe it\n // stands in for would do.\n React.useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return\n if (pushed) setPushed(null)\n else close()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [close, pushed])\n\n React.useEffect(() => {\n const previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n return () => { document.body.style.overflow = previous }\n }, [])\n\n const path = currentPath ?? ''\n const isActive = (route?: string) =>\n !!route && (route === '/' ? path === '/' || path === '' : path === route || path.startsWith(route + '/'))\n\n const go = (item: { route?: string; href?: string }) => {\n if (item.href) {\n window.open(item.href, '_blank', 'noopener,noreferrer')\n return\n }\n if (!item.route) return\n // The route change and the exit start together — `onDismiss` runs the\n // navigation now and keeps the screen mounted over the destination while\n // it slides away. NOT `close()`: that one's navigation is a history back,\n // and would undo the step just taken.\n const route = item.route\n if (onDismiss) onDismiss(() => onNavigate?.(route))\n else onNavigate?.(route)\n }\n\n // Search flattens: on a phone, typing is a shortcut PAST the hierarchy, so\n // a hit buried two levels down has to surface as its own row.\n const q = query.trim().toLowerCase()\n const flat: NavigationItem[] = React.useMemo(\n () => navigation.flatMap((n) => (n.children?.length ? n.children : [n])),\n [navigation],\n )\n const searching = q.length > 0\n const hits = searching ? flat.filter((n) => n.label.toLowerCase().includes(q)) : []\n\n const sections: Array<{ label?: string; items: NavigationItem[] }> = React.useMemo(() => {\n const out: Array<{ label?: string; items: NavigationItem[] }> = []\n for (const key of ['main', 'secondary', 'settings'] as const) {\n const items = navigation.filter((n) => n.section === key)\n if (!items.length) continue\n // Runs of consecutive items sharing a `group` become their own card —\n // the same reading the rail gives, which is why the two never disagree.\n let run: { label?: string; items: NavigationItem[] } | null = null\n for (const item of items) {\n const label = item.group ?? sectionLabels?.[key]\n if (run && run.label === label) run.items.push(item)\n else { run = { label, items: [item] }; out.push(run) }\n }\n }\n return out\n }, [navigation, sectionLabels])\n\n return (\n <div\n className={cn(\n 'fixed inset-0 z-[65] flex flex-col bg-background text-foreground will-change-transform md:hidden',\n leaving ? 'fz-sheet-out' : 'fz-sheet-in',\n drag.dragging && 'transition-none',\n !drag.dragging && !leaving && 'transition-transform duration-200 ease-out',\n )}\n style={drag.offset ? { transform: `translateY(${drag.offset}px)` } : undefined}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={pushed?.label ?? 'Menu'}\n >\n {/* Navigation bar — back on the left, dismiss on the right, exactly\n where a thumb already expects them. Glass, so the list scrolls\n THROUGH it instead of stopping at a painted strip. */}\n <div {...drag.handlers} className=\"fayz-glass-topbar fz-safe-t z-10 shrink-0 touch-pan-y px-2\">\n {/* An iOS navigation bar: the screen's name in the MIDDLE, its controls\n on the sides. Three columns and not a space-between row, because a\n centred title that shifts with the width of the back label is a\n title that never sits still between screens. */}\n <div className=\"grid h-11 grid-cols-[1fr_auto_1fr] items-center gap-2\">\n <div className=\"flex min-w-0 justify-start\">\n {pushed && (\n <button\n type=\"button\"\n onClick={() => setPushed(null)}\n className=\"fz-ios-tint fz-tap -ml-1 flex items-center gap-0.5 rounded-button py-1 pl-1 pr-2 text-[15px]\"\n >\n <ChevronLeft className=\"h-5 w-5\" />\n <span>Voltar</span>\n </button>\n )}\n </div>\n <h1 className=\"truncate px-1 text-[15px] font-semibold\">{pushed?.label ?? 'Mais'}</h1>\n <div className=\"flex min-w-0 items-center justify-end gap-1\">\n {!pushed && notificationSlot}\n <button\n type=\"button\"\n onClick={close}\n className=\"fz-ios-tint fz-tap rounded-button px-2 py-1 text-[15px] font-semibold\"\n >\n Concluído\n </button>\n </div>\n </div>\n </div>\n\n {/* Two panes on one track: the root list and the pushed section slide as\n a unit, which is the phone's own back-and-forward and the reason the\n two never appear at once. */}\n <div className=\"min-h-0 flex-1 overflow-hidden\">\n <div\n className={cn(\n // Sem `will-change-transform`: ele promove a trilha a bloco de\n // contenção, e qualquer `position: fixed` desenhado dentro dela\n // (uma folha, um popover) passa a medir contra 200% da tela.\n 'flex h-full w-[200%] transition-transform duration-[280ms] ease-out',\n pushed && '-translate-x-1/2',\n )}\n >\n {/* Pane 1 — the index. */}\n <div\n ref={scroller}\n className={cn(\n 'fz-safe-b h-full w-1/2 overflow-y-auto overscroll-contain px-4 pb-10 transition-opacity duration-200',\n pushed && 'pointer-events-none opacity-0',\n )}\n >\n {/* Search — first thing under the title, the way a settings index\n does it, because on a phone typing beats scrolling a rail. */}\n <div className=\"relative mb-5 mt-4\">\n <Search aria-hidden className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder={searchLabel ?? 'Buscar'}\n aria-label={searchLabel ?? 'Buscar'}\n className=\"h-10 w-full rounded-card border bg-card pl-9 pr-9 text-sm placeholder:text-muted-foreground focus:border-ring focus:outline-none\"\n />\n {query && (\n <button\n type=\"button\"\n onClick={() => setQuery('')}\n aria-label=\"Limpar\"\n className=\"absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n )}\n </div>\n\n {searching ? (\n hits.length ? (\n <MoreCard>\n {hits.map((item) => (\n <MoreRow key={item.id} item={item} active={isActive(item.route)} onClick={() => go(item)} />\n ))}\n </MoreCard>\n ) : (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">Nada encontrado</p>\n )\n ) : (\n <>\n {/* Account card — the workspace and the person, at the top,\n where every phone puts the account. */}\n {(mobileIdentity || orgSwitcher || identity || user) && (\n <div className=\"mb-6 divide-y overflow-hidden rounded-card border bg-card\">\n {/* A phone-shaped control is already a row of this card, so\n it goes in full-bleed. The rail's node is not: it is\n written in rail tokens and came out light grey on white\n here, so it keeps its inset and gets the tokens remapped\n in place — re-skinning beats a second copy of it. */}\n {mobileIdentity ?? ((orgSwitcher || identity) && (\n <div\n className=\"px-1 py-1 empty:hidden\"\n style={{\n ['--sidebar' as string]: 'var(--card)',\n ['--sidebar-foreground' as string]: 'var(--card-foreground)',\n ['--sidebar-muted' as string]: 'var(--muted-foreground)',\n ['--sidebar-border' as string]: 'var(--border)',\n ['--sidebar-accent' as string]: 'var(--muted)',\n ['--sidebar-accent-foreground' as string]: 'var(--foreground)',\n } as React.CSSProperties}\n >\n {orgSwitcher ?? identity}\n </div>\n ))}\n {user && (\n <button\n type=\"button\"\n onClick={() => (onDismiss ? onDismiss(() => onProfile?.()) : onProfile?.())}\n className=\"fz-tap flex min-h-[60px] w-full items-center gap-3 px-3 text-left transition-colors hover:bg-muted/50\"\n >\n {user.avatarUrl ? (\n <img src={user.avatarUrl} alt=\"\" className=\"h-10 w-10 rounded-full object-cover\" />\n ) : (\n <span className=\"flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-sm font-semibold text-primary\">\n {(user.fullName || user.email || '?').charAt(0).toUpperCase()}\n </span>\n )}\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm font-medium leading-tight\">{user.fullName || user.email}</span>\n <span className=\"block truncate text-xs text-muted-foreground\">{user.email}</span>\n </span>\n <ChevronRight aria-hidden className=\"h-4 w-4 shrink-0 text-muted-foreground/50\" />\n </button>\n )}\n </div>\n )}\n\n {sections.map((section, si) => (\n <div key={`${section.label ?? 'run'}-${si}`} className=\"mb-6 space-y-1.5\">\n {section.label && (\n <p className=\"px-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">\n {section.label}\n </p>\n )}\n <MoreCard>\n {section.items.map((item) => (\n <MoreRow\n key={item.id}\n item={item}\n active={isActive(item.route)}\n // A section with children PUSHES; the rail's accordion\n // would grow the list under the thumb that opened it.\n onClick={() => {\n const places = (item.children ?? []).filter((c) => !isCreateRoute(c.route))\n if (places.length > 1) return setPushed(item)\n // One place behind the heading is not a choice.\n return go(places[0] ?? item)\n }}\n />\n ))}\n </MoreCard>\n </div>\n ))}\n\n {(onSettings || onBilling) && (\n <div className=\"mb-6\">\n <MoreCard>\n {onSettings && (\n <MoreActionRow icon={Settings} label=\"Configurações\" onClick={() => (onDismiss ? onDismiss(() => onSettings()) : onSettings())} />\n )}\n {onBilling && (\n <MoreActionRow icon={CreditCard} label=\"Plano e cobrança\" onClick={() => (onDismiss ? onDismiss(() => onBilling()) : onBilling())} />\n )}\n </MoreCard>\n </div>\n )}\n\n {onSignOut && (\n <div className=\"mb-6\">\n <MoreCard>\n <button\n type=\"button\"\n onClick={() => (onDismiss ? onDismiss(() => onSignOut()) : onSignOut())}\n className=\"fz-tap flex min-h-[48px] w-full items-center justify-center px-3 text-sm font-medium text-destructive transition-colors hover:bg-destructive/5\"\n >\n Sair\n </button>\n </MoreCard>\n </div>\n )}\n </>\n )}\n </div>\n\n {/* Pane 2 — the pushed section. Kept mounted through the exit so the\n slide back has something to slide. */}\n <div\n className={cn(\n 'fz-safe-b h-full w-1/2 overflow-y-auto overscroll-contain px-4 pb-10',\n !pushed && 'pointer-events-none',\n )}\n aria-hidden={!pushed || undefined}\n >\n <div className=\"pt-4\" />\n <MoreCard>\n {(pushed?.children ?? []).filter((child) => !isCreateRoute(child.route)).map((child) => (\n <MoreRow key={child.id} item={child} active={isActive(child.route)} onClick={() => go(child)} />\n ))}\n </MoreCard>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/** Inset grouped card — the same container the settings index uses, so the\n * two lists are one design and not two. */\nfunction MoreCard({ children }: { children: React.ReactNode }) {\n return <div className=\"divide-y overflow-hidden rounded-card border bg-card\">{children}</div>\n}\n\n/** One destination row — SettingsPage's row, to the pixel. */\nfunction MoreRow({\n item,\n active,\n onClick,\n}: {\n item: NavigationItem\n active?: boolean\n onClick: () => void\n}) {\n const Icon = bottomNavIcon(item.icon, Home)\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-current={active ? 'page' : undefined}\n className={cn(\n 'fz-tap group flex w-full items-center gap-3 px-3 py-3 text-left transition-colors',\n active ? 'bg-primary/5' : 'hover:bg-muted/50',\n )}\n >\n <span\n className={cn(\n 'flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors',\n active ? 'bg-primary/10 text-primary' : 'bg-muted text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary',\n )}\n >\n <Icon className=\"h-4 w-4\" />\n </span>\n <span className={cn('min-w-0 flex-1 truncate text-sm font-medium', active && 'text-primary')}>\n {item.label}\n </span>\n {item.premium && <Crown aria-hidden className=\"h-3.5 w-3.5 shrink-0 text-primary\" />}\n {item.badge != null && item.badge !== '' && (\n <span className=\"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground\">\n {item.badge}\n </span>\n )}\n {item.href ? (\n <ExternalLink aria-hidden className=\"h-4 w-4 shrink-0 text-muted-foreground/50\" />\n ) : (\n <ChevronRight aria-hidden className=\"h-4 w-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5\" />\n )}\n </button>\n )\n}\n\n/** Same row, for a shell action (settings, billing) rather than a route. */\nfunction MoreActionRow({\n icon: Icon,\n label,\n onClick,\n}: {\n icon: LucideIcon\n label: string\n onClick: () => void\n}) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"fz-tap group flex w-full items-center gap-3 px-3 py-3 text-left transition-colors hover:bg-muted/50\"\n >\n <span className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary\">\n <Icon className=\"h-4 w-4\" />\n </span>\n <span className=\"min-w-0 flex-1 truncate text-sm font-medium\">{label}</span>\n <ChevronRight aria-hidden className=\"h-4 w-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5\" />\n </button>\n )\n}\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 {/* `logo === null` = esta casa não é marcada pelo produto (ver Sidebar). */}\n {logo === null ? null : (\n <div className=\"flex items-center gap-3\">\n {logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n )}\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 // Clicar na saída de contexto troca o trilho e a gaveta FICA. Armado\n // aqui e não no botão porque `navTop` é um nó do app: a gaveta é que\n // sabe que está aberta, o botão não.\n navTop={sidebarProps.navTop ? (\n <div onClickCapture={() => useLayoutStore.getState().keepDrawerOpenOnce()}>\n {sidebarProps.navTop}\n </div>\n ) : undefined}\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// ---------------------------------------------------------------------------\n// Sub-destination sheet — opened by a tab that stands for more than one screen.\n//\n// The rail row \"Agenda\" is a heading over Calendário, Check-in, Confirmações…\n// On a phone that heading gets ONE slot, so tapping it used to land on\n// whichever child sorted first and bury the rest under \"Mais\". The sheet gives\n// the choice back at thumb size, in the same glass the bar below it is made\n// of, so the two read as one piece of chrome.\n// ---------------------------------------------------------------------------\nfunction MobileNavSheet({\n title,\n items,\n currentPath,\n onNavigate,\n onClose,\n}: {\n title: string\n items: BottomNavChild[]\n currentPath?: string\n onNavigate?: (route: string) => void\n onClose: () => void\n}) {\n const path = currentPath ?? ''\n const isActive = (route: string) =>\n route === '/' ? path === '/' || path === '' : path === route || path.startsWith(route + '/')\n return (\n <BottomSheet title={title} label={title} onClose={onClose}>\n <SheetCard>\n {items.map((child) => {\n const ChildIcon = bottomNavIcon(child.icon, Home)\n return (\n <SheetRow\n key={child.route}\n icon={<ChildIcon className=\"h-4 w-4\" />}\n label={child.label}\n hint={child.badge != null && child.badge !== '' ? child.badge : undefined}\n active={isActive(child.route)}\n chevron\n onClick={() => onNavigate?.(child.route)}\n />\n )\n })}\n </SheetCard>\n </BottomSheet>\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 // Which tab has its sub-destination sheet open, by index. Index and not\n // route because two tabs may legitimately share a landing route.\n const [openSheet, setOpenSheet] = React.useState<number | null>(null)\n // The sheet closes itself on pick, but a navigation from anywhere else\n // (deep link, back button) must not leave it standing over the new screen.\n React.useEffect(() => { setOpenSheet(null) }, [currentPath])\n React.useEffect(() => { if (retracted) setOpenSheet(null) }, [retracted])\n\n const sheetItem = openSheet != null ? (items[openSheet] as BottomNavRouteItem | undefined) : undefined\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 <>\n <nav\n aria-label=\"Navegação principal\"\n aria-hidden={retracted || undefined}\n className={cn(\n // Liquid glass, not a painted strip: the bar sits ON the content, so\n // the content keeps showing through it as a wash. An opaque bar in the\n // page's own colour just cut the screen short; an opaque bar in the\n // RAIL's dark colour made a phone look like it had a second theme.\n 'fz-safe-b fixed inset-x-0 bottom-0 z-50 flex min-h-16 items-stretch justify-around md:hidden',\n 'fayz-glass-bar text-foreground',\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 // One child is not a choice — that tab just navigates.\n const children = isMore || isAssistant\n ? undefined\n : (item as BottomNavRouteItem).children?.filter((c) => !isCreateRoute(c.route))\n const hasChoices = !!children && children.length > 1\n const sheetOpen = openSheet === i\n const isActive = isMore\n ? !!moreOpen\n : isAssistant\n ? !!assistantOpen\n : sheetOpen\n ? true\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={() => {\n // Whatever else a tab opens, it replaces the sub-sheet: two\n // overlays from the same bar, stacked, is a dead end.\n if (isMore) { setOpenSheet(null); return onMore?.() }\n if (isAssistant) { setOpenSheet(null); return onAssistant?.() }\n if (hasChoices) return setOpenSheet(sheetOpen ? null : i)\n // The heading's own route is its first child, which may be the\n // create screen once the verbs are dropped. Prefer the place.\n onNavigate?.(children?.[0]?.route ?? route!)\n }}\n aria-current={isActive && route && !hasChoices ? 'page' : undefined}\n aria-expanded={isMore || isAssistant ? isActive : hasChoices ? sheetOpen : undefined}\n aria-haspopup={hasChoices ? 'menu' : 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 <span className=\"relative flex items-center\">\n <Icon className=\"h-5 w-5 shrink-0\" />\n {/* A tab that opens a sheet must say so BEFORE the tap, or the\n sheet reads as a mis-tap. A caret is the cheapest promise. */}\n {hasChoices && (\n <ChevronUp\n aria-hidden\n className={cn(\n 'absolute -right-3 top-1/2 h-3 w-3 -translate-y-1/2 transition-transform',\n sheetOpen && 'rotate-180',\n )}\n />\n )}\n </span>\n <span className=\"max-w-full truncate text-[11px] leading-tight\">{label}</span>\n </button>\n )\n })}\n </nav>\n\n {sheetItem?.children && (\n <MobileNavSheet\n title={sheetItem.label}\n items={sheetItem.children.filter((c) => !isCreateRoute(c.route))}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onClose={() => setOpenSheet(null)}\n />\n )}\n </>\n )\n}\n\n// ---------------------------------------------------------------------------\n// AppShell — main entry point\n// ---------------------------------------------------------------------------\n\nexport function AppShell({\n variant,\n contentFrame,\n navigation = [],\n // Declarados em AppShellProps desde sempre e nunca desestruturados aqui: o\n // esqueleto do rail so existia no caminho que nao e o que o app usa.\n navLoading = false,\n navError = null,\n navErrorLabel,\n navRetryLabel,\n onNavRetry,\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 sidebarBeforeNav,\n sidebarFooterContent,\n bottomNav,\n appNavigation,\n mobileIdentity,\n onBottomNavAction,\n onAssistantToggle,\n assistantOpen,\n mobileHeader = 'minimal',\n immersive = false,\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 // See AppShellProps.appNavigation.\n const menuNavigation = appNavigation ?? navigation\n\n // QUEM ESCREVE O HISTÓRICO.\n //\n // `useCrossModuleBack` — o gancho que faz \"← Voltar\" apontar para de onde a\n // pessoa veio em vez do pai declarado da rota — lê uma pilha que ninguém\n // preenchia. O gancho existia, o PageHeader já o chamava, e a pilha estava\n // vazia em toda sessão: o referrer era sempre nulo e o back contextual nunca\n // acontecia. Quem sabe a rota e o nome dela é a shell, então é ela que\n // registra.\n //\n // O rótulo é do MÓDULO, não da tela: \"Agenda\", e não \"Check-in\". É o que se\n // lê num botão de voltar — o destino, pelo nome que a pessoa reconhece.\n const routeLabel = React.useCallback((path: string): string => {\n let best: { route: string; label: string } | undefined\n const consider = (route?: string, label?: string) => {\n if (!route || !label) return\n // A raiz só casa com a raiz. Tratada como prefixo ela casa com TUDO, e\n // toda tela do aplicativo passava a se chamar \"Dashboard\" no histórico.\n if (route === '/') { if (path !== '/') return }\n else if (path !== route && !path.startsWith(route + '/')) return\n if (!best || route.length > best.route.length) best = { route, label }\n }\n for (const item of menuNavigation) {\n consider(item.route, item.label)\n // Um filho só empresta o nome dele se for mais específico que o do pai —\n // é a mesma regra do prefixo mais longo, e é o que mantém \"Agenda\" no\n // lugar de \"Confirmações\" quando o pai já casa.\n for (const child of item.children ?? []) consider(child.route, item.label)\n }\n return best?.label ?? pageTitle ?? ''\n }, [menuNavigation, pageTitle])\n\n React.useEffect(() => {\n if (!currentPath) return\n // O menu é chrome, não um lugar: registrá-lo faria \"voltar\" cair nele.\n if (currentPath === MENU_ROUTE) return\n const label = routeLabel(currentPath)\n if (!label) return\n recordNavigation(currentPath, label)\n }, [currentPath, routeLabel])\n\n // UMA TELA PRIMÁRIA NÃO TEM DE ONDE VOLTAR.\n //\n // O \"voltar\" que segue o histórico é para quem DESCEU: uma ficha, uma aba de\n // configuração, um formulário. Numa linha do menu ele é um convite errado —\n // o Painel apareceu com \"← Financeiro / Dashboard\" só porque o Financeiro foi\n // a tela anterior, e sair de uma tela primária pela anterior não é voltar,\n // é andar em círculo. O menu é como se sai daqui, e ele está na tela.\n const destinationRoutes = React.useMemo(() => {\n const routes: string[] = []\n for (const item of menuNavigation) {\n if (item.route) routes.push(item.route)\n for (const child of item.children ?? []) if (child.route) routes.push(child.route)\n }\n return routes\n }, [menuNavigation])\n const isDestination = !!currentPath && destinationRoutes.includes(currentPath)\n\n // Publicada para quem desenha o próprio cabeçalho. Uma página que monta um\n // PageHeader chama `useCrossModuleBack` direto, sem passar pela faixa da\n // shell — foi por aí que o Check-in continuou dizendo \"← Agenda\" mesmo\n // sendo uma linha do menu.\n React.useEffect(() => {\n setDestinationRoutes(destinationRoutes)\n }, [destinationRoutes])\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 // Third signal: /settings, by name. It is the shell's OWN route — where\n // `onSettings` goes — and it is not a destination the bar can take you back\n // to; you leave it the way you came in. The contextual rail that serves it\n // has already swapped `navigation` for its own rows by the time we look, so\n // asking the menu would only get the wrong menu's answer.\n //\n // Deliberately NOT \"any route the rail does not list\": a module's own rail\n // (CRM, Agenda) does the same swap, and that rule took the bar away from\n // /clients — a tab — for the same reason it took it away from /settings.\n const inSettings = !!currentPath && (currentPath === '/settings' || currentPath.startsWith('/settings/'))\n const barRetracted = !!pageBack || pageClaimedBack || inSettings\n const mobileDrawerOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileDrawerOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n // With the bar gone, /settings had no way out on a phone: its own tabs go\n // DOWN, and the one control that went up was the bar we just took away. The\n // way in was the \"Mais\" screen, so that is where back goes. Only when the\n // screen has not already drawn a back of its own, and only where the bar is\n // the navigation (the band hides it from md up anyway).\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 // …a menos que o que navegou tenha sido a saída de contexto do próprio\n // menu (\"← Voltar para o início\"), que troca o trilho em vez de levar a\n // algum lugar. Ver drawerKeepOpenOnce na store.\n if (useLayoutStore.getState().drawerKeepOpenOnce) {\n useLayoutStore.setState({ drawerKeepOpenOnce: false })\n return\n }\n setMobileDrawerOpen(false)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentPath])\n // THE MENU IS A PLACE, NOT A FLAG.\n //\n // It used to be an overlay toggled by a boolean, which meant it had no\n // position in history: /settings opened it, and closing it returned to\n // /settings — the screen it was opened to get OUT of — so the two bounced\n // off each other forever. As a route it behaves like every other screen:\n // going to it is forward, closing it is back, and back lands wherever the\n // user actually came from.\n const menuRouteOpen = barOwnsNav && currentPath === MENU_ROUTE\n const firstDestination = React.useMemo(() => {\n const first = bottomNav?.find((i) => !('kind' in i) || i.kind === 'route') as BottomNavRouteItem | undefined\n return first?.route ?? '/'\n }, [bottomNav])\n\n // Where the menu was opened from, so closing it knows what \"back\" means.\n const menuOrigin = React.useRef<string | undefined>(undefined)\n\n const openMenu = React.useCallback(() => {\n if (!barOwnsNav) { setMobileDrawerOpen(true); return }\n window.clearTimeout(menuTimer.current)\n setMenuLeaving(false)\n setMenuLingering(false)\n menuOrigin.current = currentPath\n onNavigate?.(MENU_ROUTE)\n }, [barOwnsNav, currentPath, onNavigate, setMobileDrawerOpen])\n\n // NAVEGA PRIMEIRO, ANIMA DEPOIS.\n //\n // A ordem inversa é o que piscava: a tela tocava os 220ms de saída AINDA em\n // /menu — uma rota que o roteador do aplicativo não conhece, então o que\n // aparecia por baixo era \"Não encontrado\" — e só então trocava de rota. Com a\n // rota trocada primeiro, o que a folha descobre ao descer já é o destino.\n //\n // `lingering` é o que segura a tela montada depois de `currentPath` deixar de\n // ser /menu: sem isso o React a arranca no mesmo quadro e não sobra saída\n // nenhuma para animar.\n const [menuLeaving, setMenuLeaving] = React.useState(false)\n const [menuLingering, setMenuLingering] = React.useState(false)\n const menuTimer = React.useRef<number | undefined>(undefined)\n\n const dismissMenu = React.useCallback((navigate?: () => void) => {\n window.clearTimeout(menuTimer.current)\n setMenuLingering(true)\n setMenuLeaving(true)\n navigate?.()\n menuTimer.current = window.setTimeout(() => {\n setMenuLeaving(false)\n setMenuLingering(false)\n }, 240)\n }, [])\n\n React.useEffect(() => () => window.clearTimeout(menuTimer.current), [])\n\n const closeMenu = React.useCallback(() => {\n if (!barOwnsNav) { setMobileDrawerOpen(false); return }\n const from = menuOrigin.current\n menuOrigin.current = undefined\n // /settings' only way out IS the menu, so going \"back\" there would put the\n // user on the screen they just left by the one door it has — the bounce\n // this route was introduced to end. Everywhere else, back is back: the\n // menu undoes the step that opened it.\n const cameFromSettings = !!from && (from === '/settings' || from.startsWith('/settings/'))\n dismissMenu(() => {\n // SAIR É NAVEGAR, NÃO VOLTAR.\n //\n // `history.back()` parecia o gesto certo — desfazer o passo que abriu o\n // menu — e é justamente ele que não dá para conferir: a volta é\n // assíncrona, então não há instante em que dê para olhar a rota e\n // corrigir se ela não mudou. Uma verificação depois de um tempo qualquer\n // corre contra a própria volta: as duas navegam, e quem chega por último\n // ganha. Foi assim que \"Concluído\" virou um botão que às vezes deixava o\n // usuário exatamente onde estava, em /menu.\n //\n // Ir direto para onde o menu foi aberto é a mesma intenção, dita de um\n // jeito que sempre acontece. Sobra uma entrada de /menu na pilha: o botão\n // voltar do sistema reabre o menu uma vez, o que é estranho — e bem menos\n // que um Concluído que não conclui.\n const back = !cameFromSettings && from && from !== MENU_ROUTE ? from : firstDestination\n onNavigate?.(back)\n })\n }, [barOwnsNav, setMobileDrawerOpen, onNavigate, firstDestination, dismissMenu])\n\n // /menu is a phone screen. Reached on a desktop — a deep link, a window\n // widened while it was open — it would sit on a route the app has no page\n // for, so it hands over to the first tab instead.\n React.useEffect(() => {\n if (!menuRouteOpen || typeof window === 'undefined') return\n const wide = window.matchMedia('(min-width: 768px)')\n const settle = () => { if (wide.matches) onNavigate?.(firstDestination) }\n settle()\n wide.addEventListener('change', settle)\n return () => wide.removeEventListener('change', settle)\n }, [menuRouteOpen, onNavigate, firstDestination])\n\n const mobileBackToMenu =\n hasBottomNav && barOwnsNav && inSettings && !pageBack && !pageClaimedBack\n ? openMenu\n : undefined\n\n const bottomBar = hasBottomNav ? (\n <MobileBottomNav\n items={bottomNav!}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onAction={onBottomNavAction}\n onMore={() => (menuRouteOpen ? closeMenu() : openMenu())}\n moreOpen={barOwnsNav ? menuRouteOpen : 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 // O estado de espera do rail SO existia no caminho de cima: este\n // branch repassava trinta props e deixava estas cinco para tras, e\n // como e ele que o app usa, o esqueleto nunca chegava a montar.\n navLoading={navLoading}\n navError={navError}\n navErrorLabel={navErrorLabel}\n navRetryLabel={navRetryLabel}\n onNavRetry={onNavRetry}\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 sidebarBeforeNav={sidebarBeforeNav}\n sidebarFooterContent={sidebarFooterContent}\n frame={contentFrame}\n immersive={immersive}\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 mobileBackToMenu={mobileBackToMenu}\n menuNavigation={menuNavigation}\n menuOpen={menuRouteOpen}\n pagePrimary={isDestination}\n menuLingering={menuLingering}\n menuLeaving={menuLeaving}\n onMenuClose={closeMenu}\n onMenuDismiss={dismissMenu}\n mobileIdentity={mobileIdentity}\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 mobileBackToMenu={mobileBackToMenu}\n menuNavigation={menuNavigation}\n menuOpen={menuRouteOpen}\n pagePrimary={isDestination}\n menuLingering={menuLingering}\n menuLeaving={menuLeaving}\n onMenuClose={closeMenu}\n onMenuDismiss={dismissMenu}\n mobileIdentity={mobileIdentity}\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 * A control that belongs to THIS tab — the menu of actions for the cardápio\n * the tab names, say.\n *\n * Sibling of the tab button, never inside it: a button inside a button is\n * invalid, and the click would have to be untangled from the tab's own. It\n * still reads as part of the tab because it sits in the same box, before the\n * next tab's gap.\n */\n trailing?: React.ReactNode\n /**\n * Esta aba nomeia algo DESLIGADO — um cardápio desativado, uma unidade\n * fechada. Fica fraca, com o mesmo peso que a interface dá ao que existe mas\n * não está no ar. Continua clicável: desligado é um estado, não um bloqueio.\n */\n dim?: boolean\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 * Stamp each tab with `data-tour=\"<anchorPrefix>.<value>\"` so a guided tour\n * can point at it. Only the MODULE nav band passes this ('modnav') — a\n * record's own tab strip stays unanchored, so the namespace never collides.\n */\n anchorPrefix?: string\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, anchorPrefix, ...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 // Com um controle próprio (o \"⋯\" de um cardápio), a aba passa a ser uma\n // CAIXA: o botão e o controle dividem o mesmo sublinhado e a mesma\n // altura, senão o controle fica boiando ao lado de uma aba que termina\n // antes dele. Sem controle, a aba continua sendo só o botão.\n const box = cn(\n 'relative flex shrink-0 items-center gap-1.5 whitespace-nowrap text-sm transition-colors',\n fill ? 'h-full' : 'pb-1.5',\n active ? 'font-medium text-foreground' : 'text-muted-foreground hover:text-foreground',\n tab.dim && 'opacity-50 hover:opacity-100',\n )\n const inner = (\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 </>\n )\n const underline = active\n ? <span className=\"absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-foreground\" />\n : null\n\n if (!tab.trailing) {\n return (\n <button\n key={tab.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tour={anchorPrefix ? `${anchorPrefix}.${tab.value}` : undefined}\n onClick={() => onChange(tab.value)}\n className={box}\n >\n {inner}\n {underline}\n </button>\n )\n }\n\n return (\n <div key={tab.value} className={box}>\n {/* O botão perde o `pb` e o sublinhado: os dois são da caixa agora,\n que é o que mantém rótulo, contagem e controle na mesma linha e\n sobre o mesmo traço. */}\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tour={anchorPrefix ? `${anchorPrefix}.${tab.value}` : undefined}\n onClick={() => onChange(tab.value)}\n className=\"flex items-center gap-1.5 whitespace-nowrap\"\n >\n {inner}\n </button>\n {tab.trailing}\n {underline}\n </div>\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 ────────────────────────────────────────────────────────────────\n * **This is the only way a screen switches what it is showing.** Not a rounded\n * pill group floating in the body, not a bordered pair of buttons beside the\n * search field, not a strip of chips — five screens of the same product had\n * grown four different shapes in four different positions for one question, and\n * a person moving between them re-learned the control every time.\n *\n * It scales where the alternatives do not: ten tabs (Financeiro) read the same\n * as two (Reservas), the rule ties the band to the shell bar so the control is\n * at the same height on every screen, and `count`/`badge` carry the numbers and\n * status dots that a pill group has nowhere to put.\n *\n * `SegmentedControl` (and a bare `TabsList`) stays for what it was built for: a\n * compact toggle INSIDE a card or beside a single control — a date range, a\n * chart's unit. If it is the first thing at the top of the page, it is wrong.\n * A screen that also has secondary view modes uses `ViewTabs` in the\n * `PageViewBar` immediately below this band. Screen navigation never moves to\n * the right-side action slot.\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 // Fica NA TELA enquanto a página rola: a faixa diz em que aba você está,\n // e essa pergunta continua valendo na linha 200 da tabela — voltar ao\n // topo só para trocar de aba é o que ela existe para evitar. Opaca, e\n // pintada com a superfície que a shell publica (`--page-surface`):\n // emoldurada é `content`, sem moldura é `background`, e escolher errado\n // deixa o conteúdo aparecendo por baixo do texto das abas.\n style={{ background: 'var(--page-surface, hsl(var(--background)))' }}\n className={cn(\n 'sticky top-0 z-20 -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 // 48px no desktop, a mesma altura do subcabeçalho dos painéis do\n // assistente à direita (TasksFilterBar, NotebookPanel). Eram 34 aqui e\n // 48 lá: os dois fios que fecham as duas faixas paravam em alturas\n // diferentes, lado a lado na mesma tela. `min-h` e não `h` porque a\n // faixa QUEBRA — doze abas no Financeiro — e uma altura fixa cortaria a\n // segunda linha.\n 'md:min-h-[2.5rem]',\n className,\n )}\n >\n <HeaderTabs {...props} className=\"-mb-px\" />\n {/* `ml-auto` e não só o `justify-between` do pai: quando a faixa QUEBRA\n — doze abas no Financeiro —, o slot vira o único item da segunda\n linha e o `justify-between` o deixa encostado à esquerda, debaixo das\n abas erradas, com cara de controle perdido. Encostado à direita ele\n continua sendo \"o lado direito da faixa\" nas duas situações. */}\n {actions && <div className=\"ml-auto 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// ViewTabs — os MODOS de ver a mesma tela (Funil · Lista · Conversão;\n// Contagens · Auditoria de Uso), no lado ESQUERDO do subheader.\n//\n// É o par do padrão \"filtros e exibição à direita\": toda tela que tem mais de\n// uma leitura do mesmo conjunto usa ESTE componente, em vez de cada uma\n// desenhar o próprio SegmentedControl num canto diferente. O SegmentedControl\n// continua existindo para o que ele é — um campo de formulário com poucas\n// opções —, mas um MODO de tela é navegação, e navegação tem um desenho só.\n//\n// Deliberadamente quieto: texto e um sublinhado de tinta no ativo, sem a\n// moldura de pílula — ele senta logo abaixo da faixa de abas do módulo, e duas\n// fileiras de pílulas empilhadas leem como dois menus brigando.\n// ---------------------------------------------------------------------------\n\nexport interface ViewTabOption<T extends string> {\n value: T\n label: string\n}\n\nexport interface ViewTabsProps<T extends string> {\n value: T\n onChange: (value: T) => void\n options: Array<ViewTabOption<T>>\n 'aria-label'?: string\n className?: string\n}\n\nexport function ViewTabs<T extends string>({ value, onChange, options, 'aria-label': ariaLabel, className }: ViewTabsProps<T>) {\n return (\n <div role=\"tablist\" aria-label={ariaLabel} className={cn('flex items-center gap-1', className)}>\n {options.map((o) => {\n const active = o.value === value\n return (\n <button\n key={o.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => onChange(o.value)}\n className={cn(\n 'rounded-button px-2.5 py-1 text-sm transition-colors',\n active\n ? 'bg-primary/10 font-medium text-primary'\n : 'text-muted-foreground hover:bg-muted hover:text-foreground',\n )}\n >\n {o.label}\n </button>\n )\n })}\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'\n\n// ---------------------------------------------------------------------------\n// PageTrail — quem é o PAI da tela que está desenhando agora.\n//\n// Uma migalha (\"← Entrega / Embalagens\") precisa de duas coisas que moram em\n// lugares diferentes: o nome do nível de cima, que só o container sabe, e o\n// nome do nível atual, que só a folha sabe. Sem um caminho entre os dois cada\n// container desenhava a própria seta \"para não perder o caminho de volta\" — e\n// foi assim que Configurações ficou com dois cabeçalhos empilhados: um da\n// barra da shell (\"Configurações\") e um escrito à mão dentro do plugin\n// (\"← Entrega\"), desalinhados, para uma coisa só.\n//\n// Aqui o container apenas DECLARA o nível dele. Quem desenha é sempre a folha,\n// uma vez só, pelo mesmo PageHeader que o resto do app usa — uma seta na tela,\n// nunca duas.\n// ---------------------------------------------------------------------------\n\nexport interface PageTrailCrumb {\n /** Nome do nível — a palavra antes da barra para quem vem abaixo. */\n label: string\n /** Rota (hash) deste nível. É também a IDENTIDADE dele: uma tela cuja rota é\n * igual à do nível não é filha dele, é ele — sem isso a lista de Locais,\n * que É a aba, viraria \"← Locais / Locais\". */\n href: string\n /** Como voltar. Sem isso, a própria rota. */\n onNavigate?: () => void\n}\n\nconst EMPTY: PageTrailCrumb[] = []\nconst PageTrailContext = React.createContext<PageTrailCrumb[]>(EMPTY)\n\n/** Declara um nível para tudo que renderizar abaixo. */\nexport function PageTrail({\n label,\n href,\n onNavigate,\n children,\n}: PageTrailCrumb & { children: React.ReactNode }) {\n const parent = React.useContext(PageTrailContext)\n // Identidade estável: a folha memoiza o nó do cabeçalho a partir daqui, e um\n // array novo a cada render faria a reivindicação da barra recomeçar sem fim.\n const trail = React.useMemo(\n () => [...parent, { label, href, onNavigate }],\n [parent, label, href, onNavigate],\n )\n return <PageTrailContext.Provider value={trail}>{children}</PageTrailContext.Provider>\n}\n\nexport function usePageTrail(): PageTrailCrumb[] {\n return React.useContext(PageTrailContext)\n}\n\n/**\n * O nível imediatamente acima de `href`, ou undefined quando não há trilha —\n * fora de Configurações a página segue sem migalha, como sempre foi.\n */\nexport function usePageTrailParent(href?: string): PageTrailCrumb | undefined {\n const trail = React.useContext(PageTrailContext)\n return React.useMemo(() => {\n const above = href ? trail.filter((c) => c.href !== href) : trail\n return above[above.length - 1]\n }, [trail, href])\n}\n\nexport function navigateToCrumb(crumb: PageTrailCrumb): void {\n if (crumb.onNavigate) crumb.onNavigate()\n else window.location.hash = crumb.href\n}\n\n/**\n * A rota em que a tela está AGORA, no formato dos `href` da trilha (\"/settings/\n * financial-commissions\"). É a identidade que faltava para uma folha se\n * reconhecer na trilha sem que cada uma escrevesse a própria rota à mão.\n *\n * A querystring cai fora: `#/conversations?personId=…` é a mesma tela que\n * `#/conversations`, e um parâmetro no fim quebraria a comparação por igualdade.\n */\nexport function useCurrentRouteHref(): string {\n const read = () => {\n if (typeof window === 'undefined') return ''\n const hash = window.location.hash.replace(/^#/, '')\n const clean = hash.split('?')[0]!\n return clean.startsWith('/') ? clean : `/${clean}`\n }\n const [href, setHref] = React.useState(read)\n React.useEffect(() => {\n const handler = () => setHref(read())\n window.addEventListener('hashchange', handler)\n // Uma navegação por `pushState` não emite `hashchange`, e a shell usa as\n // duas — sem isto a migalha ficaria apontando para o pai da tela anterior.\n handler()\n return () => window.removeEventListener('hashchange', handler)\n }, [])\n return href\n}\n\n/**\n * O \"voltar\" que a TRILHA já conhece, para uma tela que não declarou um.\n *\n * Uma folha que desenha o próprio cabeçalho toma a barra da shell — e, sem\n * `onBack`, tomava junto a seta que a ROTA tinha declarado. Era o caso de toda\n * aba de Configurações: a shell sabia dizer \"← Configurações\", a aba desenhava\n * \"Regras de Comissão\" por cima, e o caminho de volta sumia da tela.\n */\nexport function useTrailBack(href?: string): { onBack?: () => void; parentLabel?: string } {\n const current = useCurrentRouteHref()\n const parent = usePageTrailParent(href ?? current)\n return React.useMemo(\n () => parent ? { onBack: () => navigateToCrumb(parent), parentLabel: parent.label } : {},\n [parent],\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 { ViewTabs } from '../primitives/view-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'\nimport { useTrailBack } from './page-trail'\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\n// ---------------------------------------------------------------------------\n// PageViewBar — a SEGUNDA banda do layout, logo sob a faixa de abas do módulo:\n// os MODOS de ver a tela (ViewTabs) à esquerda, filtros/exibição à direita.\n// FIXA como a faixa de abas — rola-se a tabela, não o controle dela — e é o\n// LAYOUT quem a desenha: a página só publica o conteúdo por aqui, nunca\n// reimplementa a banda.\n// ---------------------------------------------------------------------------\n\nlet viewBarSlot: HTMLElement | null = null\nlet viewBarCount = 0\nconst viewBarListeners = new Set<() => void>()\nfunction viewBarNotify() { viewBarListeners.forEach((l) => l()) }\nfunction viewBarSubscribe(l: () => void) { viewBarListeners.add(l); return () => { viewBarListeners.delete(l) } }\n\nfunction ViewBarHost() {\n const active = React.useSyncExternalStore(viewBarSubscribe, () => viewBarCount > 0)\n return (\n <div\n // A mesma superfície e o mesmo sangramento da faixa de abas acima; cola\n // logo abaixo dela (top = min-h da faixa) e anula o mb-4 que ela deixa.\n // marginTop inline e não `-mt-4`: o container do shell aplica `space-y`\n // (margin-top nos filhos) que vence a utility no cascade e empurrava a\n // banda 24px para baixo da faixa de abas.\n style={{ background: 'var(--page-surface, hsl(var(--background)))', marginTop: '-1rem' }}\n className={cn(\n 'sticky top-[2.4rem] z-10 -mx-3 mb-3 border-b border-border px-3 py-1 md:top-[2.5rem] md:-mx-6 md:px-6',\n !active && 'hidden',\n )}\n >\n <div\n ref={(el) => { viewBarSlot = el; viewBarNotify() }}\n className=\"flex min-h-7 items-center justify-between gap-2\"\n />\n </div>\n )\n}\n\n/** A página publica o conteúdo da banda (esquerda = modos, direita = filtros).\n * Fora de um módulo com faixa (sem host montado), desenha inline — a tela\n * continua funcionando num contexto sem layout. */\nexport function PageViewBar({ children }: { children: React.ReactNode }) {\n const slot = React.useSyncExternalStore(viewBarSubscribe, () => viewBarSlot)\n React.useEffect(() => {\n viewBarCount++\n viewBarNotify()\n return () => { viewBarCount--; viewBarNotify() }\n }, [])\n if (slot) return createPortal(children, slot)\n return <div className=\"mb-4 flex items-center justify-between gap-2\">{children}</div>\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 /**\n * O que este item é, para quem desenha navegação.\n *\n * `'action'` marca a filha que abre um FORMULÁRIO (\"Novo\", \"Entrada\",\n * \"Saída\"). Ela não entra em controle de navegação nenhum: um formulário é\n * subpágina, a subpágina toma a barra e ESCONDE a faixa — então o controle\n * desaparecia no clique, que é o oposto do que um controle de navegação faz.\n * O caminho para o formulário é o botão de cabeçalho da lista, que já existe\n * em todas essas telas (\"Nova entrada\", \"Novo Produto\").\n *\n * Padrão `'view'`: uma tela que fica na faixa e a mantém.\n */\n kind?: 'view' | 'action'\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 // Every module sub-nav entry is a tour anchor for free, the same way\n // Sidebar does `nav.<route>` — this is how a guided tour can point at\n // \"Contas a Pagar\" without the plugin lifting a finger.\n data-tour={`modnav.${item.id}`}\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 data-tour={`modnav.${child.id}`}\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 // Mesma regra do desktop: ação abre formulário, formulário esconde a faixa.\n const kids = (item.children ?? []).filter((c) => c.kind !== 'action')\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 const shown = (item?.children ?? []).filter((c) => c.kind !== 'action')\n if (shown.length < 2) 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 {shown.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 /** O que esta tela é, em uma frase. Vira um (i) ao lado do título no\n * breadcrumb, e a frase aparece ao passar o mouse ou ao focar — em vez de um\n * parágrafo gastando uma linha antes do conteúdo, em toda visita. */\n description?: 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, description, icon, onBack, parentLabel, actions, backStyle, inline }: SubpageHeaderProps) {\n const t = useTranslation()\n const appStyle = useBackStyle()\n const hasShellBar = useHasPageHeaderHost() && !inline\n\n // Sem `onBack` declarado, a folha ainda tem caminho de volta: o nível que o\n // container acima dela declarou na trilha (PageTrail). Era o buraco de toda\n // aba de Configurações — a ROTA sabia dizer \"← Configurações\", a aba\n // desenhava o próprio cabeçalho por cima e a seta sumia da barra, deixando a\n // tela sem saída no celular, onde o rail não existe.\n const trail = useTrailBack()\n const declaredBack = onBack ?? trail.onBack\n const declaredParent = parentLabel ?? trail.parentLabel\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(declaredBack, declaredParent)\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 ? declaredBack : cross.onBack\n const effectiveParentLabel = inline ? declaredParent : 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} description={description} />\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 description={description}\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, description, icon: Icon, onBack, parentLabel, actions,\n}: {\n title: string\n subtitle?: string\n description?: 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} description={description} />\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 // Clicar num pai leva à filha padrão — mas as OUTRAS filhas continuam\n // existindo, e é aí que estava o buraco: a faixa desenhava só os pais, então\n // \"Estoque\" caía em Histórico e Entrada, Saída, Contagens e Auditoria de Uso\n // não tinham como ser abertas por menu nenhum. O mesmo valia para \"Novo\" em\n // Produtos e para qualquer par de telas irmãs num grupo. `MobileTabs` já\n // abria as filhas numa segunda fileira; o desktop não tinha nada.\n //\n // Child views use the same secondary view band as CRM (ViewTabs inside\n // PageViewBar). A right-aligned segmented control made navigation look like a\n // filter and created a second visual grammar for the same screen-level choice.\n function defaultChild(item: ModuleNavItem) {\n // Mesma regra do desktop: ação abre formulário, formulário esconde a faixa.\n const kids = (item.children ?? []).filter((c) => c.kind !== 'action')\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 // Só VISTAS. As filhas de ação (\"Novo\", \"Entrada\") abrem formulário, e\n // formulário é subpágina: a barra passa a ser dela e a faixa some junto com\n // este controle. Clicar numa aba e ver a aba sumir é o sintoma; a causa é ter\n // posto ação dentro de navegação. Elas continuam alcançáveis pelo botão de\n // cabeçalho da lista, que é onde o resto do produto já as põe.\n //\n // E com uma vista só não há o que navegar: um controle de um segmento é\n // decoração que ocupa a faixa.\n const kids = (activeItem?.children ?? []).filter((c) => c.kind !== 'action')\n // Qual filha está aberta. Nenhuma marcada acontece num detalhe alcançado a\n // partir de uma delas; aí a primeira segura o controle em vez de ele aparecer\n // sem nada selecionado.\n const activeKid = kids.find((c) => c.active)?.id ?? kids[0]?.id\n\n const childControl = kids.length > 1 && activeKid ? (\n <PageViewBar>\n <ViewTabs\n aria-label={activeItem?.label}\n options={kids.map((c) => ({ value: c.id, label: c.label }))}\n value={activeKid}\n onChange={(id: string) => kids.find((c) => c.id === id)?.onClick?.()}\n />\n <span />\n </PageViewBar>\n ) : undefined\n\n return (\n <>\n <PageTabs\n tabs={tabs}\n value={activeItem?.id ?? nav[0]?.id ?? ''}\n onChange={onChange}\n anchorPrefix=\"modnav\"\n />\n {childControl}\n </>\n )\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 {!onSubpage && <ViewBarHost />}\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"]}
|