@the-portland-company/shell 0.76.14 → 0.76.18
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/CHANGELOG.md +35 -0
- package/dist/app-chrome.cjs +138 -17
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.d.cts +7 -2
- package/dist/app-chrome.d.ts +7 -2
- package/dist/app-chrome.js +10 -5
- package/dist/app-chrome.js.map +1 -1
- package/dist/{chunk-HSC6EYRR.js → chunk-GGM4AD43.js} +6 -1769
- package/dist/chunk-GGM4AD43.js.map +1 -0
- package/dist/chunk-TUK2IEL5.js +2002 -0
- package/dist/chunk-TUK2IEL5.js.map +1 -0
- package/dist/index-Cu5frXRQ.d.cts +990 -0
- package/dist/index-DJ3qBzfQ.d.ts +990 -0
- package/dist/index.cjs +170 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -36
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +131 -15
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +4 -929
- package/dist/native.d.ts +4 -929
- package/dist/native.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-HSC6EYRR.js.map +0 -1
- package/dist/chunk-MY6G3LMN.js +0 -125
- package/dist/chunk-MY6G3LMN.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/native/orgFilter.ts","../src/native/standardNavIcons.ts","../src/native/standardNav.ts","../src/native/index.tsx"],"names":["Fragment"],"mappings":";;;;;;;;;AASO,IAAM,oBAAA,GAAuB,CAAA;AAK7B,SAAS,UAAA,CAAoC,MAAoB,KAAA,EAAoB;AAC1F,EAAA,MAAM,CAAA,GAAI,UAAU,KAAK,CAAA;AACzB,EAAA,IAAI,CAAC,CAAA,EAAG,OAAO,CAAC,GAAG,IAAI,CAAA;AACvB,EAAA,OAAO,KAAK,MAAA,CAAO,CAAC,MAA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ong to many organizations (a consultant managing a dozen\n * committees) got a 288 px panel showing seven rows and a near-invisible macOS\n * scrollbar — measured 2026-09-04: \"I cannot select other organizations\".\n * The panel now grows with the viewport and, above this threshold, gains a\n * type-to-filter box so any org is one keystroke away.\n */\nexport const ORG_FILTER_THRESHOLD = 8\n\nexport type FilterableOrg = { id: string; name: string | null }\n\n/** Case- and accent-insensitive substring match on the org name (or id prefix). */\nexport function filterOrgs<T extends FilterableOrg>(orgs: readonly T[], query: string): T[] {\n const q = normalize(query)\n if (!q) return [...orgs]\n return orgs.filter((o) => normalize(o.name ?? '').includes(q) || o.id.toLowerCase().startsWith(q))\n}\n\nexport function shouldShowOrgFilter(count: number): boolean {\n return count > ORG_FILTER_THRESHOLD\n}\n\nfunction normalize(s: string): string {\n return s\n .normalize('NFD')\n .replace(/[̀-ͯ]/g, '')\n .toLowerCase()\n .trim()\n}\n","import type { NavIcon } from './index'\nimport type { StandardNavIconKey } from './standardNav'\nimport {\n LuActivity,\n LuBriefcase,\n LuChartColumn,\n LuChartNoAxesColumn,\n LuCircleUser,\n LuClipboardList,\n LuClock,\n LuCreditCard,\n LuCrosshair,\n LuDollarSign,\n LuDoorOpen,\n LuFileText,\n LuFlag,\n LuHouse,\n LuLandmark,\n LuLayoutDashboard,\n LuLayoutGrid,\n LuLifeBuoy,\n LuList,\n LuMail,\n LuMap,\n LuMapPin,\n LuMessageSquare,\n LuMousePointerClick,\n LuPencil,\n LuPhone,\n LuSend,\n LuSettings,\n LuShare2,\n LuSignpost,\n LuTarget,\n LuUpload,\n LuUser,\n LuUsers,\n LuUsersRound,\n} from 'react-icons/lu'\n\n/**\n * The canonical icon map for standardPolitogyNav — ONE definition so every\n * app renders identical glyphs (including the Organization Settings branch:\n * briefcase / settings / creditCard / dollarSign / share).\n */\nexport const standardNavIcons: Record<StandardNavIconKey, NavIcon> = {\n home: LuHouse,\n users: LuUsers,\n mail: LuMail,\n messageSquare: LuMessageSquare,\n layout: LuLayoutDashboard,\n activity: LuActivity,\n lifeBuoy: LuLifeBuoy,\n grid: LuLayoutGrid,\n list: LuList,\n upload: LuUpload,\n edit: LuPencil,\n fileText: LuFileText,\n send: LuSend,\n clock: LuClock,\n user: LuUser,\n barChart: LuChartColumn,\n briefcase: LuBriefcase,\n settings: LuSettings,\n creditCard: LuCreditCard,\n dollarSign: LuDollarSign,\n share: LuShare2,\n // Campaign / Petition mode slots.\n phone: LuPhone,\n map: LuMap,\n mapPin: LuMapPin,\n target: LuTarget,\n flag: LuFlag,\n layoutDashboard: LuLayoutDashboard,\n usersRound: LuUsersRound,\n mousePointerClick: LuMousePointerClick,\n clipboardList: LuClipboardList,\n circleUser: LuCircleUser,\n crosshair: LuCrosshair,\n landmark: LuLandmark,\n chartNoAxes: LuChartNoAxesColumn,\n doorOpen: LuDoorOpen,\n signpost: LuSignpost,\n}\n","import { standardNavIcons } from './standardNavIcons'\nimport type { NavIcon, NavItem } from './index'\n\n// ---------------------------------------------------------------------------\n// standardPolitogyNav — the canonical Politogy VRM menu, per operating Mode.\n//\n// This is the single source of truth for the navigation every politogy app\n// renders. The RELATIONSHIP tree is extracted verbatim from VRM core's\n// relationship-mode sidebar (`getRelationshipLinkItems`); the CAMPAIGN and\n// PETITION trees mirror VRM core's mode-scoped menus. Apps consume the same\n// menu everywhere; an app that owns one of the items (e.g. the standalone\n// Contacts app) nests its own pages as that item's children while every other\n// entry links out to another *.politogyvrm.com app as an absolute URL —\n// full-page navigation with SSO shared across the domain.\n//\n// Which tree an app renders is NOT the user's live mode selection — it is the\n// app's own mode, mapped from the app registry (see `POLITOGY_APPS[app].mode`),\n// EXCEPT for a DUAL-MODE app (`POLITOGY_APPS[app].dual`, today: a2p — Specs/A2P:\n// \"the SMS/MMS delivery engine for Relationship Mode and Campaign Mode\"). A\n// dual app has no single fixed mode: its EFFECTIVE mode is resolved per-visit\n// by `resolveActiveMode` (mode-preference.ts) — `?mode=` query param on the\n// current URL → the `politogy_active_mode` cookie (written by every pinned app\n// and core whenever their own mode is known) → the app's own `dual.defaultMode`\n// — and THAT resolved value substitutes for `meta.mode` wherever this function\n// or the Mode pill would otherwise read it. A campaign-scoped, non-dual app\n// (phonebank / canvass / signs) always renders the Campaign tree; an unscoped\n// app (forms / surveys / polls / contacts) always renders Relationship, exactly\n// as before. Switching modes is a full-page navigation between mode homes (the\n// Mode pill's job), and each destination is itself pinned (or, for a2p,\n// resolved) — so the tree is deterministic from app identity + the mode\n// resolution above, never a value an app has to pass.\n// ---------------------------------------------------------------------------\n\n/**\n * Icon slots used by the standard menus. The shell stays icon-library-agnostic:\n * callers map each key to their own icon components (lucide, react-icons, …).\n * A missing key simply renders that row without an icon.\n */\nexport type StandardNavIconKey =\n | 'home'\n | 'users'\n | 'mail'\n | 'messageSquare'\n | 'layout'\n | 'activity'\n | 'lifeBuoy'\n | 'grid'\n | 'list'\n | 'upload'\n | 'edit'\n | 'fileText'\n | 'send'\n | 'clock'\n | 'user'\n | 'barChart'\n | 'briefcase'\n | 'settings'\n | 'creditCard'\n | 'dollarSign'\n | 'share'\n // Campaign / Petition mode slots.\n | 'phone'\n | 'map'\n | 'mapPin'\n | 'target'\n | 'flag'\n // Left-Navigation §9 Lucide slots.\n | 'layoutDashboard'\n | 'usersRound'\n | 'mousePointerClick'\n | 'clipboardList'\n | 'circleUser'\n | 'crosshair'\n | 'landmark'\n | 'chartNoAxes'\n | 'doorOpen'\n | 'signpost'\n\n/** The operating Mode whose nav tree to build. Defaults to `relationship`. */\nexport type StandardNavMode = 'relationship' | 'campaign' | 'petition'\n\n/**\n * Per-feature availability for the Campaign tree. Campaign Mode ships its apps\n * incrementally: a disabled feature is omitted from the nav entirely (rather\n * than rendered as a dead/disabled row), and its flag flips to `true` in a\n * later patch release as the app goes live. Dashboard and Voter Contact are\n * core-hosted and always present, so they carry no flag.\n */\nexport interface CampaignFeatureAvailability {\n a2p: boolean\n phonebank: boolean\n canvass: boolean\n signs: boolean\n tribes: boolean\n polling: boolean\n}\n\n/**\n * Launch state at this shell version: every Campaign feature is deployed and\n * live (a2p / phonebank / canvass / signs .politogyvrm.com all serve the app\n * behind SSO as of 2026-07-24), so no row is hidden. The flags remain so a\n * future feature can ship dark, and so a caller can hide one per-deployment.\n */\nexport const CAMPAIGN_FEATURE_AVAILABILITY: CampaignFeatureAvailability = {\n a2p: true,\n phonebank: true,\n canvass: true,\n signs: true,\n tribes: true,\n polling: true,\n}\n\n/** Absolute origins for the standalone Campaign / Petition apps. */\nconst A2P_ORIGIN = 'https://a2p.politogyvrm.com/'\nconst PHONEBANK_ORIGIN = 'https://phonebank.politogyvrm.com/'\nconst CANVASS_ORIGIN = 'https://canvass.politogyvrm.com/'\nconst SIGNS_ORIGIN = 'https://signs.politogyvrm.com/'\nconst POLLS_ORIGIN = 'https://polls.politogyvrm.com/'\n// app.politogyvrm.com (VRM core) is retired (Reference/UI-Platform →\n// \"Retirement of app.politogyvrm.com\", DECIDED 2026-10-07). These are its V2\n// replacements: Settings owns org settings/billing, Dashboard owns the\n// Relationship/Campaign dashboards and Battleground, auth owns the Politogy\n// ID account pages (my-profile, invite acceptance).\nconst SETTINGS_ORIGIN = 'https://settings.politogyvrm.com/'\nconst DASHBOARD_ORIGIN = 'https://dashboard.politogyvrm.com/'\nconst AUTH_ORIGIN = 'https://auth.politogyvrm.com/'\n// Tribes is a page inside the standalone Contacts app (Specs/Tribes: Tribes is\n// implemented as an extension of Contacts). Matches app-shell.tsx's `/tribes`.\nconst CONTACTS_TRIBES = 'https://contacts.politogyvrm.com/tribes'\n// Petition Mode is its own standalone app on its own subdomain (the petitions\n// repo deploys production to petition-mode.politogyvrm.com).\nconst PETITION_MODE_ORIGIN = 'https://petition-mode.politogyvrm.com/'\n\nexport interface StandardNavOptions {\n /**\n * @deprecated app.politogyvrm.com (VRM core) is retired (Reference/UI-Platform\n * → \"Retirement of app.politogyvrm.com\"). Every row this tree used to resolve\n * against VRM core now points at its V2 host directly, so this is unused.\n * Kept only so existing callers don't need to drop the field immediately.\n */\n coreBaseUrl?: string\n /** Icon component per slot; omitted slots render icon-less rows. */\n icons?: Partial<Record<StandardNavIconKey, NavIcon>>\n /**\n * App-local override for the \"Contacts\" item. `children` are used verbatim\n * (NOT absolutized) so the owning app nests its own routes; `href` (also\n * verbatim) feeds active-detection for the group header. When omitted, the\n * item carries VRM core's own contacts sub-pages as absolute links.\n * (Relationship tree only.)\n */\n contactsItem?: {\n href?: string\n children?: NavItem[]\n /**\n * Live contact count shown right-aligned on the Contacts row, already\n * formatted for display (\"31.9K\"). Only the owning app knows it.\n * (Specs/Contacts design: `Contacts · 31.9K`.)\n */\n count?: string | number | null\n }\n /**\n * Top-level rows to OMIT, by label (case-insensitive), e.g. `['Polls','CTAs']`.\n * The Specs/Contacts design rail lists Relationship → Collect → Account with\n * exactly Dashboard · Contacts · Email broadcast · SMS/MMS blast / Calls to\n * action · Forms · Surveys / My profile · Organization settings; apps that\n * still surface Polls / CTAs keep them by default. A section row with no\n * remaining items is dropped too.\n */\n hiddenItems?: string[]\n /**\n * App-local override for the Petition-mode \"Dashboard\" entry, same contract\n * as `contactsItem`: `href`/`children` used verbatim so the Petitions app\n * nests its own routes under the entry. (Petition tree only.)\n */\n petitionsItem?: { href?: string; children?: NavItem[] }\n /**\n * The trailing \"Support\" row. VRM core opens its SupportRequestModal here;\n * other apps supply their own handler (`onClick`) or a link (`href`).\n * Omitted or `false` → no Support row. Appended to every mode's tree.\n */\n supportItem?: { onClick?: () => void; href?: string } | false\n /**\n * Which mode's tree to build. Default `relationship`, whose output is\n * byte-for-byte what this function produced before modes existed.\n */\n mode?: StandardNavMode\n /**\n * Active organization id (full UUID). EVERY link in EVERY tree carries it as\n * `?org=<uuid>` — the same convention the Mode switcher and My Account menu\n * use — so the destination app opens on the same org instead of the user's\n * default one. Omit it only when the caller genuinely has no active org yet.\n */\n activeOrgId?: string | null\n /**\n * Per-feature Campaign availability overrides, merged over\n * `CAMPAIGN_FEATURE_AVAILABILITY`. Only meaningful for the Campaign tree.\n */\n campaignAvailability?: Partial<CampaignFeatureAvailability>\n}\n\n/**\n * Drop the top-level rows named in `hidden` (case-insensitive label match),\n * then any section row left with no rows beneath it.\n */\nfunction applyHiddenItems(items: NavItem[], hidden?: string[]): NavItem[] {\n if (!hidden || hidden.length === 0) return items\n const drop = new Set(hidden.map((h) => h.trim().toLowerCase()))\n const kept = items.filter((i) => i.kind === 'section' || !drop.has(i.label.toLowerCase()))\n return kept.filter((item, idx) => {\n if (item.kind !== 'section') return true\n const next = kept[idx + 1]\n return !!next && next.kind !== 'section'\n })\n}\n\n/**\n * One sub-item of a standalone app, as a path RELATIVE to that app's origin\n * (`''` is the app root). Resolved against the origin and given the active-org\n * query param, exactly like the parent row it hangs under.\n */\ntype CrossAppLeaf = { label: string; icon: StandardNavIconKey; path: string }\n\nconst CONTACTS_APP = 'https://contacts.politogyvrm.com'\n\nconst APP_CONTACTS_CHILDREN = [\n { label: 'Dashboard', icon: 'grid' as const, href: `${CONTACTS_APP}/` },\n { label: 'All Contacts', icon: 'list' as const, href: `${CONTACTS_APP}/contacts` },\n { label: 'Tribes', icon: 'users' as const, href: `${CONTACTS_APP}/tribes` },\n { label: 'Import', icon: 'upload' as const, href: `${CONTACTS_APP}/import` },\n { label: 'Fields', icon: 'layout' as const, href: `${CONTACTS_APP}/fields` },\n { label: 'Activity', icon: 'activity' as const, href: `${CONTACTS_APP}/activity` },\n { label: 'Duplicates', icon: 'fileText' as const, href: `${CONTACTS_APP}/duplicates` },\n]\n\n// Email Broadcast now points at the standalone Email Engine V2 app\n// (email.politogyvrm.com, Specs/Email-Engine six tabs + Deliverability). The\n// V1 surface inside VRM core stays reachable as the last child while both run\n// in parallel. Absolute hrefs so active-detection lights this group when the\n// user is inside the Email app (same pattern as Contacts / Forms / Surveys).\nconst EMAIL_APP = 'https://email.politogyvrm.com'\nconst APP_EMAIL_CHILDREN = [\n { label: 'Dashboard', icon: 'grid' as const, href: `${EMAIL_APP}/dashboard` },\n { label: 'Creative Canvas', icon: 'edit' as const, href: `${EMAIL_APP}/canvas` },\n { label: 'Sender Information', icon: 'mail' as const, href: `${EMAIL_APP}/sender` },\n { label: 'Recipients', icon: 'user' as const, href: `${EMAIL_APP}/recipients` },\n { label: 'Send & Automate', icon: 'send' as const, href: `${EMAIL_APP}/send` },\n { label: 'Statistics', icon: 'barChart' as const, href: `${EMAIL_APP}/statistics` },\n { label: 'Deliverability', icon: 'activity' as const, href: `${EMAIL_APP}/deliverability` },\n]\n// Organization Settings — promoted from the My Account menu into the left nav\n// (HITL directive 2026-07-23). Mirrors the main app's former page IA, now\n// served by the standalone Settings app (settings.politogyvrm.com, Specs/\n// Organization-Settings v12) rather than VRM core: /organization-settings/:tab,\n// with Subscription & Billing carrying its own third level\n// (/organization-settings/subscription-billing/:tab). This is the canonical\n// depth-3 example the nav renderers support.\ntype CoreBranch = CrossAppLeaf & { children?: CrossAppLeaf[] }\n\nconst ORG_SETTINGS_CHILDREN: CoreBranch[] = [\n { label: 'General', icon: 'settings', path: 'organization-settings' },\n {\n label: 'Subscription & Billing',\n icon: 'creditCard',\n path: 'organization-settings/subscription-billing',\n children: [\n { label: 'Current Plan', icon: 'fileText', path: 'organization-settings/subscription-billing/current-plan' },\n { label: 'SMS, MMS & Email Usage', icon: 'activity', path: 'organization-settings/subscription-billing/text-email' },\n { label: 'Wallet', icon: 'dollarSign', path: 'organization-settings/subscription-billing/wallet' },\n { label: '10DLC', icon: 'messageSquare', path: 'organization-settings/subscription-billing/10dlc' },\n { label: 'Billing History', icon: 'clock', path: 'organization-settings/subscription-billing/billing-history' },\n ],\n },\n { label: 'Email', icon: 'mail', path: 'organization-settings/email-settings' },\n { label: 'Users', icon: 'users', path: 'organization-settings/users' },\n { label: 'Shared Links', icon: 'share', path: 'organization-settings/shared-links' },\n]\n\n// The NEW standalone acquisition apps (forms./surveys./polls.politogyvrm.com)\n// replace the legacy in-core \"Forms & Surveys\" system (HITL directive\n// 2026-07-23; removal plan: politogy/docs/legacy-forms-removal-plan.md).\n// Absolute cross-app links — SSO carries the session.\nconst APP_FORMS_CHILDREN = [\n { label: 'Forms', icon: 'list' as const, href: 'https://forms.politogyvrm.com/?tab=forms' },\n { label: 'Canvas', icon: 'edit' as const, href: 'https://forms.politogyvrm.com/?tab=canvas' },\n { label: 'Submissions', icon: 'fileText' as const, href: 'https://forms.politogyvrm.com/?tab=submissions' },\n]\n// The Surveys sub-menu mirrors the app's tab strip: Surveys / Canvas / Results.\n// Canvas and Results are survey-scoped routes (/surveys/:id/canvas), so with no\n// survey selected the list page carries a ?view= param — distinct hrefs, so\n// active-detection singles out exactly one (identical hrefs were the earlier\n// all-active bug; query params ARE compared, hashes are not).\nconst APP_SURVEYS_CHILDREN = [\n { label: 'Surveys', icon: 'list' as const, href: 'https://surveys.politogyvrm.com/surveys' },\n { label: 'Canvas', icon: 'edit' as const, href: 'https://surveys.politogyvrm.com/surveys?view=canvas' },\n { label: 'Results', icon: 'barChart' as const, href: 'https://surveys.politogyvrm.com/surveys?view=results' },\n]\nconst APP_POLLS_CHILDREN = [\n { label: 'Command Center', icon: 'grid' as const, href: 'https://polls.politogyvrm.com/' },\n { label: 'New Poll', icon: 'edit' as const, href: 'https://polls.politogyvrm.com/polls/new' },\n]\n// Standalone CTAs app (ctas.politogyvrm.com, Specs/CTAs) — same pattern as\n// Forms/Surveys/Polls above. This is also now the target for the\n// \"Calls to action\" row in the Relationship tree (the legacy in-core feature\n// it used to render was retired with app.politogyvrm.com).\nconst APP_CTAS_CHILDREN = [\n { label: 'CTAs', icon: 'list' as const, href: 'https://ctas.politogyvrm.com/' },\n { label: 'Canvas', icon: 'edit' as const, href: 'https://ctas.politogyvrm.com/?tab=canvas' },\n]\n\n// ---------------------------------------------------------------------------\n// Campaign app sub-navigation.\n//\n// Reference/UI-Platform v13 (Left bar → Navigation): \"The canonical VRM nav\n// tree — PARENT GROUPS WITH SUB-ITEMS. The app's own pages nest under their\n// group.\" The Campaign tree shipped as eight flat rows with no `children`, so\n// the Navigation Display control's \"Both\" and \"Sub Menu\" modes had nothing to\n// expand in the left bar of a2p / phonebank / canvass / signs — the three modes\n// rendered an identical sidebar and the control looked broken.\n//\n// Each list below is the app's OWN section list, taken verbatim from that app's\n// in-app tab strip (its `components/Shell.tsx`), so the sidebar sub-menu and the\n// page tab strip name the same sections in the same order — the sidebar/tab\n// agreement Reference/UI-Platform exists to enforce.\n// ---------------------------------------------------------------------------\n\n/** a2p/components/Shell.tsx `TABS` — the six A2P tabs. */\nconst APP_A2P_CHILDREN: CrossAppLeaf[] = [\n { label: 'Dashboard', icon: 'grid', path: 'dashboard' },\n { label: 'Compose', icon: 'edit', path: 'compose' },\n { label: 'Recipients', icon: 'user', path: 'recipients' },\n { label: 'Tech Check', icon: 'activity', path: 'tech-check' },\n { label: 'Status', icon: 'clock', path: 'status' },\n { label: 'Conversations', icon: 'messageSquare', path: 'conversations' },\n]\n\n/** phonebank/components/Shell.tsx `NAV` — the Manager console's sections. */\nconst APP_PHONEBANK_CHILDREN: CrossAppLeaf[] = [\n { label: 'Dashboard', icon: 'grid', path: '' },\n { label: 'Campaigns', icon: 'phone', path: 'campaigns' },\n { label: 'Inbound', icon: 'messageSquare', path: 'inbound' },\n { label: 'Reports', icon: 'barChart', path: 'reports' },\n]\n\n/** canvass/components/Shell.tsx `SECTIONS` — the manager console's sections. */\nconst APP_CANVASS_CHILDREN: CrossAppLeaf[] = [\n { label: 'Dashboard', icon: 'grid', path: '' },\n { label: 'Campaigns', icon: 'target', path: 'campaigns' },\n { label: 'Canvassers', icon: 'users', path: 'canvassers' },\n]\n\n/**\n * signs/components/Shell.tsx `SECTIONS`. Review Queue is Manager+ in the app's\n * tab strip; the shared tree carries no role input, so the row is listed for\n * everyone and the ROUTE enforces it — /review renders a \"available to Managers\n * and Admins\" notice and loads no queue data for a volunteer (signs\n * app/review/page.tsx). Listing it keeps sidebar and tab strip identical for the\n * managers who use it rather than re-opening per-app nav drift.\n */\nconst APP_SIGNS_CHILDREN: CrossAppLeaf[] = [\n { label: 'Map', icon: 'map', path: '' },\n { label: 'Placements', icon: 'list', path: 'placements' },\n { label: 'Review Queue', icon: 'fileText', path: 'review' },\n { label: 'Recovery', icon: 'flag', path: 'recovery' },\n { label: 'Reports', icon: 'barChart', path: 'reports' },\n]\n\n/**\n * Build the standard Politogy VRM menu for the given `mode` (default\n * `relationship`), in the exact order and wording the main app renders it. See\n * `StandardNavOptions` for the app-specific hooks (`contactsItem`,\n * `supportItem`) and the Campaign inputs (`activeOrgId`, `campaignAvailability`).\n */\nexport function standardPolitogyNav(opts: StandardNavOptions): NavItem[] {\n // Left-Navigation §8.1: every row is a Lucide icon + label. Callers may\n // override per slot; otherwise the shared Lucide map applies.\n const icon = (key: StandardNavIconKey): NavIcon | undefined => opts.icons?.[key] ?? standardNavIcons[key]\n\n // EVERY link this tree emits leaves the current app (core routes are\n // cross-app for a standalone app, and the app-owned rows are supplied by the\n // caller), so each one carries the active org as `?org=<full-uuid>` — the\n // full id is the only collision-free selector (contacts-api matches exact id\n // first, then a short suffix that can collide across a user's orgs). Without\n // it a multi-org user following a bare cross-app link lands in whatever org\n // the destination defaults to; the cookie is only the fallback for a bare\n // URL, the param is the explicit selector. Active-detection ignores `org`\n // (isNavItemActive's ACTIVE_IGNORED_PARAMS) so stamping it selects nothing\n // differently, and it keeps the org in the address bar for bookmarking.\n const orgParam = opts.activeOrgId ? `org=${opts.activeOrgId}` : ''\n const withOrg = (url: string): string =>\n orgParam ? `${url}${url.includes('?') ? '&' : '?'}${orgParam}` : url\n\n const leaves = (origin: string, children: CrossAppLeaf[]): NavItem[] =>\n appLeaves(origin, children)\n const branches = (origin: string, children: CoreBranch[]): NavItem[] => {\n const o = origin.replace(/\\/+$/, '')\n return children.map((c) => ({\n label: c.label,\n icon: icon(c.icon),\n href: withOrg(`${o}/${c.path}`),\n children: c.children ? leaves(origin, c.children) : undefined,\n }))\n }\n\n // Sub-items of a standalone app: `origin` + the app-relative path, carrying\n // the active org the way the parent row does. Trailing slash on the origin\n // is normalized so `''` yields the app root and `x` yields `/x`. An optional\n // `modeParam` (a DUAL app entered from a mode other than its own default,\n // e.g. the Relationship tree's a2p row) is stamped on every leaf too, so the\n // destination resolves the same mode the row that got you there was in.\n const appLeaves = (\n origin: string,\n children: CrossAppLeaf[],\n modeParam?: StandardNavMode,\n ): NavItem[] => {\n const base = origin.replace(/\\/+$/, '')\n return children.map((c) => {\n const url = c.path ? `${base}/${c.path}` : `${base}/`\n const withMode = modeParam ? `${url}${url.includes('?') ? '&' : '?'}mode=${modeParam}` : url\n return { label: c.label, icon: icon(c.icon), href: withOrg(withMode) }\n })\n }\n\n // Left-Navigation §9.4: ACCOUNT is the last section in every mode.\n const accountRows = (): NavItem[] => [\n { kind: 'section', label: 'Account' },\n // My Profile moved to the Politogy ID account app (auth.politogyvrm.com)\n // with the retirement of app.politogyvrm.com.\n { label: 'My profile', icon: icon('circleUser'), href: withOrg(`${AUTH_ORIGIN}my-profile`) },\n {\n label: 'Organization settings',\n icon: icon('settings'),\n // Organization settings moved to the standalone Settings app\n // (settings.politogyvrm.com, Specs/Organization-Settings v12).\n href: withOrg(`${SETTINGS_ORIGIN}organization-settings`),\n children: branches(SETTINGS_ORIGIN, ORG_SETTINGS_CHILDREN),\n },\n ]\n\n const buildRelationship = (): NavItem[] => {\n const contacts: NavItem = opts.contactsItem\n ? {\n label: 'Contacts',\n icon: icon('usersRound'),\n href: opts.contactsItem.href,\n children: opts.contactsItem.children,\n badge: opts.contactsItem.count ?? undefined,\n }\n : {\n label: 'Contacts',\n icon: icon('usersRound'),\n href: withOrg(`${CONTACTS_APP}/`),\n children: APP_CONTACTS_CHILDREN.map((c) => ({\n label: c.label,\n icon: icon(c.icon),\n href: withOrg(c.href),\n })),\n }\n\n // Specs/Contacts design rail (Reference/UI-Platform → Left bar: section\n // rows via `kind: 'section'`, sentence-case labels). Three groups:\n // RELATIONSHIP Dashboard · Contacts · Email broadcast · SMS/MMS blast\n // COLLECT Calls to action · Forms · Surveys (· Polls · CTAs)\n // ACCOUNT My profile · Organization settings\n return [\n { kind: 'section', label: 'Relationship' },\n // Dashboard moved to the standalone Dashboard app (dashboard.politogyvrm.com,\n // Specs/Relationship-Dashboard) with the retirement of app.politogyvrm.com.\n { label: 'Dashboard', icon: icon('layoutDashboard'), href: withOrg(DASHBOARD_ORIGIN) },\n contacts,\n {\n label: 'Email broadcast',\n icon: icon('mail'),\n href: withOrg(`${EMAIL_APP}/dashboard`),\n children: APP_EMAIL_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) })),\n },\n {\n // SMS/MMS Blast is the a2p app entered in RELATIONSHIP mode (a2p is\n // dual-mode; Specs/A2P). The `?mode=relationship` param pins the\n // destination's tree so the row that got you there is the row that\n // lights up on arrival.\n label: 'SMS/MMS blast',\n icon: icon('messageSquare'),\n href: withOrg(`${A2P_ORIGIN}?mode=relationship`),\n children: appLeaves(A2P_ORIGIN, APP_A2P_CHILDREN, 'relationship'),\n },\n { kind: 'section', label: 'Collect' },\n // Calls to action moved to the standalone CTAs app (ctas./runtime.\n // politogyvrm.com, Specs/CTAs) with the retirement of app.politogyvrm.com.\n {\n label: 'Calls to action',\n icon: icon('mousePointerClick'),\n href: withOrg('https://ctas.politogyvrm.com/'),\n children: APP_CTAS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) })),\n },\n {\n label: 'Forms',\n icon: icon('fileText'),\n href: withOrg('https://forms.politogyvrm.com/'),\n children: APP_FORMS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) })),\n },\n {\n label: 'Surveys',\n icon: icon('clipboardList'),\n href: withOrg('https://surveys.politogyvrm.com/surveys'),\n children: APP_SURVEYS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) })),\n },\n // Polls (polls.politogyvrm.com) — kept in the default Collect section;\n // apps that want it hidden pass `hiddenItems: ['Polls']`. Regression:\n // dropped entirely in 03c4dc2 when app.politogyvrm.com retired; restored\n // here (this row is independent of the retired app).\n {\n label: 'Polls',\n icon: icon('chartNoAxes'),\n href: withOrg(POLLS_ORIGIN),\n children: APP_POLLS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) })),\n },\n ...accountRows(),\n ]\n }\n\n // Campaign tree — Dashboard + the 7 Campaign Mode features. Dashboard and\n // Voter Contact are core-hosted (VRM core /campaign/*); the rest link out to\n // standalone apps and are gated by CAMPAIGN_FEATURE_AVAILABILITY.\n const buildCampaign = (): NavItem[] => {\n const avail: CampaignFeatureAvailability = {\n ...CAMPAIGN_FEATURE_AVAILABILITY,\n ...opts.campaignAvailability,\n }\n type Gated = NavItem & { flag?: keyof CampaignFeatureAvailability }\n const rows: Gated[] = [\n // Left-Navigation §9.2: Race data -> Research -> GOTV -> Account.\n // Battleground is the Campaign landing page; there is no Campaign\n // Dashboard row, and Voter Contact and Tribes have no row.\n { kind: 'section', label: 'Race data' },\n // Battleground moved to the Dashboard app (dashboard.politogyvrm.com)\n // until a dedicated Battleground host is decided (UI-Platform route table).\n { label: 'Battleground', icon: icon('crosshair'), href: withOrg(`${DASHBOARD_ORIGIN}battleground`) },\n // District data moved to the Dashboard app (dashboard.politogyvrm.com)\n // per Reference/UI-Platform v44.\n { label: 'District data', icon: icon('landmark'), href: withOrg(`${DASHBOARD_ORIGIN}districts`) },\n { kind: 'section', label: 'Research' },\n {\n label: 'Polling',\n icon: icon('chartNoAxes'),\n href: withOrg(POLLS_ORIGIN),\n children: APP_POLLS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) })),\n flag: 'polling',\n },\n { kind: 'section', label: 'GOTV' },\n {\n label: 'Field canvassing',\n icon: icon('doorOpen'),\n href: withOrg(CANVASS_ORIGIN),\n children: appLeaves(CANVASS_ORIGIN, APP_CANVASS_CHILDREN),\n flag: 'canvass',\n },\n {\n label: 'Phone banking',\n icon: icon('phone'),\n href: withOrg(PHONEBANK_ORIGIN),\n children: appLeaves(PHONEBANK_ORIGIN, APP_PHONEBANK_CHILDREN),\n flag: 'phonebank',\n },\n {\n label: 'A2P texting',\n icon: icon('messageSquare'),\n href: withOrg(A2P_ORIGIN),\n children: appLeaves(A2P_ORIGIN, APP_A2P_CHILDREN),\n flag: 'a2p',\n },\n {\n label: 'Sign mapping',\n icon: icon('signpost'),\n href: withOrg(SIGNS_ORIGIN),\n children: appLeaves(SIGNS_ORIGIN, APP_SIGNS_CHILDREN),\n flag: 'signs',\n },\n ...accountRows(),\n ]\n const kept = rows\n .filter((r) => !r.flag || avail[r.flag])\n .map(({ flag: _flag, ...item }) => item as NavItem)\n // Drop a section left with no rows under it (e.g. Research when polling is off).\n return kept.filter((item, idx) => {\n if (item.kind !== 'section') return true\n const next = kept[idx + 1]\n return !!next && next.kind !== 'section'\n })\n }\n\n // Petition tree — the Petition Mode home (its own standalone app). The\n // Petitions app nests its own routes via `petitionsItem` (the contactsItem\n // contract); everyone else gets the minimal cross-app link. Labeled\n // Dashboard so the shared breadcrumb trail anchors correctly.\n const buildPetition = (): NavItem[] => [\n opts.petitionsItem\n ? {\n label: 'Dashboard',\n icon: icon('home'),\n href: opts.petitionsItem.href ?? withOrg(PETITION_MODE_ORIGIN),\n children: opts.petitionsItem.children,\n }\n : { label: 'Dashboard', icon: icon('home'), href: withOrg(PETITION_MODE_ORIGIN) },\n ]\n\n const mode = opts.mode ?? 'relationship'\n const built =\n mode === 'campaign'\n ? buildCampaign()\n : mode === 'petition'\n ? buildPetition()\n : buildRelationship()\n const items = applyHiddenItems(built, opts.hiddenItems)\n\n if (opts.supportItem) {\n items.push({\n label: 'Support',\n icon: icon('lifeBuoy'),\n href: opts.supportItem.href,\n onClick: opts.supportItem.onClick,\n })\n }\n\n return items\n}\n","// ---------------------------------------------------------------------------\n// Framework-agnostic chrome (sidebar + top navbar) for @the-portland-company/shell.\n//\n// The other chrome in this package (ShellChrome, Sidebar, Header, …) is built\n// on Chakra UI v2 + react-router and targets Vite SPAs. That stack cannot be\n// imported into a Next.js / React 19 / Tailwind app. This \"native\" module is a\n// dependency-light alternative: pure React (no Chakra, no emotion, no\n// react-router, no icon library) whose styling is driven entirely by the CSS\n// design tokens shipped in `@the-portland-company/shell/chrome.css`.\n//\n// It is a FAITHFUL VISUAL TWIN of the Chakra chrome (Sidebar.tsx / Header.tsx /\n// OrgPill / ModePill / NavItem / UserMenu): same 240px sidebar, brand-logo\n// slot, \"ORGANIZATION\" org pill, mode pill, solid active nav rows, pipe-\n// separated footer links + commit string, and an avatar+name+email+chevron user\n// menu — so an app rendering this looks identical to the main VRM app.\n//\n// Every app concern (nav items, org, mode, user, links, icons, the routing\n// Link component, the theme toggle) is injected via props, so both the Contacts\n// app (Next.js) and the VRM app could consume the same components.\n// ---------------------------------------------------------------------------\n\nimport type { ComponentType, CSSProperties, KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react'\nimport { Fragment, createContext, useContext, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { useTopBarIconSlotGlyph, type TopBarIconSlot } from '../lib/topbarIconSlot'\nimport { resolveBrandGlyph } from '../lib/brandGlyphs'\nimport { warnDeprecated } from '../lib/deprecation'\nimport { filterOrgs, shouldShowOrgFilter } from './orgFilter'\nimport { orgIdTail } from '../active-org'\nimport { readRailPreference, writeRailPreference } from '../nav-preference'\nimport { SpeculationRulesScript } from '../speculation/SpeculationRulesScript'\nimport {\n topBarIconButtonClass,\n TopBarTooltip,\n TopBarPanelArrow,\n NavThemeControl,\n resolveOrgLogoUrl,\n NAV_DISPLAY_OPTIONS,\n TOPBAR_GLYPH_SIZE,\n type ThemePreference,\n type NavDisplayMode,\n} from './chromeActions'\n\n// Data-backed top-bar widgets (Fuel, Notifications, Support, Nav-display) +\n// the injected-fetcher provider they hang off. One implementation for every app.\nexport {\n NavChromeProvider,\n CORE_APP_ORIGIN,\n CORE_BILLING_PATH,\n SPECS_ORIGIN,\n FuelAction,\n NotificationsAction,\n SupportAction,\n SpecOverlayAction,\n NavDisplayAction,\n NavThemeControl,\n TopBarCountBadge,\n TopBarPanelArrow,\n TopBarTooltip,\n TopBarWidgetSlot,\n TopBarPopover,\n topBarIconButtonClass,\n resolveOrgLogoUrl,\n useChromeMe,\n useChromeOrgs,\n useNavChromeFetcher,\n useNavChromeDedupedFetch,\n useThemePreference,\n} from './chromeActions'\nexport type {\n ChromeMe,\n NavChromeFetcher,\n NavDisplayMode,\n ThemePreference,\n ChromeOrgSummary,\n ChromeNotificationsPayload,\n ChromeNotificationAlert,\n ChromeNotificationReply,\n ChromeNotificationImport,\n ChromeNotificationQuarantine,\n CommunicationsFuelStatus,\n FuelChannelStatus,\n} from './chromeActions'\n\n// An icon is any component that accepts an optional size + className. This\n// matches both `lucide-react` and `react-icons` icon signatures, so consuming\n// apps pass their own icon set without this package depending on one.\nexport type NavIcon = ComponentType<{ size?: number; className?: string; strokeWidth?: number }>\n\nexport type NavItem = {\n /**\n * What this row IS. Defaults to `'link'` — every existing `NavItem[]` keeps\n * its exact type and rendering.\n *\n * `'section'` is a non-interactive heading that groups the rows beneath it:\n * uppercase, muted, letterspaced, not focusable, no hover. Only `label` is\n * read; `href`, `icon`, `onClick` and `children` are ignored.\n *\n * The legacy chrome supported this and 0.43 dropped it, so apps faked it by\n * passing `disabled` rows with no href — which looks approximately right and\n * is wrong where it counts: a disabled row announces as an unavailable\n * CONTROL to a screen reader, when it is not a control at all. A section is\n * its own kind of row (Reference/UI-Platform → Left bar).\n *\n * Deliberately a widened field rather than a discriminated union: a union\n * would make `item.href` a type error for every existing consumer that reads\n * it, turning an additive feature into a breaking change.\n */\n kind?: 'link' | 'section'\n /** Route to link to. Optional when `onClick` is supplied (renders a button). */\n href?: string\n label: string\n icon?: NavIcon\n /**\n * When supplied the row renders as a `<button>` (styled identically to the\n * link rows) instead of a routed link — used for actions like \"Support\".\n */\n onClick?: () => void\n /**\n * Disables the row: non-interactive and dimmed, with `disabledTitle` shown as\n * a hover tooltip explaining why. Mirrors `NavTab`'s existing contract so a\n * gated row looks the same whether it renders in the sidebar or a tab strip.\n * Without this, an app that gates a section (VRM dims Email / SMS until setup\n * is complete) had no way to express it and the row rendered fully clickable\n * (shell-nav-handoff §3).\n */\n disabled?: boolean\n /** Tooltip for a disabled row — say why, and how to resolve it. */\n disabledTitle?: string\n /**\n * Right-aligned count/annotation on the row — e.g. the live contact count\n * on \"Contacts\" (`31.9K`). Pre-formatted by the app; the shell only draws\n * it (Specs/Contacts design rail). Omitted/null draws nothing.\n */\n badge?: string | number | null\n /**\n * Nested sub-items. When present, the row becomes an expandable GROUP header.\n * Clicking it always toggles the children open/closed and rotates the\n * right-aligned chevron; if the item ALSO carries an `onClick`, that runs too,\n * so a parent can navigate to its section dashboard while expanding\n * (shell-nav-handoff §2). An `href` alone never navigates from a group header. The sidebar runs a single-open accordion (opening one group closes\n * the others) and auto-expands whichever group contains the active route —\n * mirroring the main VRM app's Chakra sidebar. Children render as smaller nav\n * rows on a lighter panel and support both `href` links and `onClick` actions.\n */\n children?: NavItem[]\n}\n\n// The routing primitive is injected so each app supplies its own (Next.js\n// `<Link>`, react-router `<Link>`, or a plain `<a>`). Defaults to an anchor.\nexport type NavLinkProps = {\n href: string\n className?: string\n 'aria-current'?: 'page' | undefined\n children: ReactNode\n // Optional passthrough attributes so the same injected link can back a\n // routed nav row OR a routed tab (which needs ARIA tab semantics + inline\n // token geometry). Next.js `<Link>`, react-router `<Link>` and a plain <a>\n // all accept these DOM props, and DefaultLink spreads them onto its anchor.\n role?: string\n 'aria-selected'?: boolean\n 'aria-label'?: string\n title?: string\n style?: CSSProperties\n}\nexport type NavLinkComponent = ComponentType<NavLinkProps>\n\n/**\n * URL-scheme allow-list for host-supplied hrefs. React does not neutralize\n * `javascript:`/`data:` schemes on anchor href, so any app-supplied nav/footer/\n * action href must be validated before it reaches the DOM. Permits absolute\n * http(s), mailto/tel, and in-app relative targets; everything else → '#'.\n */\nconst safeHref = (h?: string) =>\n h && /^(https?:|mailto:|tel:|\\/|#|\\.)/i.test(h.trim()) ? h : '#'\n\nconst DefaultLink: NavLinkComponent = ({ href, children, ...rest }) => (\n <a href={safeHref(href)} {...rest}>\n {children}\n </a>\n)\n\n/**\n * Default active-route test. Handles three href shapes so the CURRENT app's\n * item + sub-item select correctly in the cross-app menu (HITL 2026-07-23):\n * - relative path: exact for \"/\", prefix otherwise (legacy behavior);\n * - absolute URL: active only when its host matches window.location.host,\n * then compared by path (and query, when the href carries one — e.g.\n * forms' /?tab=canvas sub-items);\n * - query-only relative hrefs likewise compare location.search.\n *\n * The `org` param is EXCLUDED from the query comparison. Campaign / Petition\n * links carry `?org=<last6>` purely to hand the active organization to the\n * destination app (`standardPolitogyNav`'s `activeOrgId`); it scopes data, it\n * does not identify a page. Comparing it would deselect every campaign row the\n * moment an org is active, because the app's own URL bar carries no `org=`.\n */\nconst ACTIVE_IGNORED_PARAMS = new Set(['org'])\n\nexport function isNavItemActive(pathname: string, href: string): boolean {\n let targetPath = href\n let targetSearch = ''\n if (/^https?:\\/\\//i.test(href)) {\n if (typeof window === 'undefined') return false\n try {\n const u = new URL(href)\n if (u.host !== window.location.host) return false\n targetPath = u.pathname\n targetSearch = u.search\n } catch {\n return false\n }\n } else {\n const qi = href.indexOf('?')\n if (qi >= 0) {\n targetPath = href.slice(0, qi) || '/'\n targetSearch = href.slice(qi)\n }\n }\n // Every IDENTIFYING key=value in the target query must be present in the\n // location. Once the scoping params are dropped a link like\n // \"https://signs.politogyvrm.com/placements?org=abc123\" is a plain path href\n // again and falls through to the path rules below.\n const want = new URLSearchParams(targetSearch)\n for (const k of ACTIVE_IGNORED_PARAMS) want.delete(k)\n if (Array.from(want).length > 0) {\n if (typeof window === 'undefined') return false\n if (pathname !== targetPath) return false\n const have = new URLSearchParams(window.location.search)\n for (const [k, v] of want) if (have.get(k) !== v) return false\n return true\n }\n if (targetPath === '/') return pathname === '/'\n return pathname === targetPath || pathname.startsWith(`${targetPath}/`)\n}\n\n/**\n * Stable identity for an expandable nav group's accordion state. Prefers the\n * item's href; falls back to an index-scoped label so two groups can never\n * collide even when they share a label and have no href.\n */\nfunction groupKeyOf(item: NavItem, index: number): string {\n return item.href ?? `nav-group-${index}-${item.label}`\n}\n\n/** True when any of a group's children links to the active route. */\nfunction hasActiveChild(\n item: NavItem,\n pathname: string,\n activeFn: (pathname: string, href: string) => boolean,\n): boolean {\n return (item.children ?? []).some(\n (child) =>\n (child.href ? activeFn(pathname, child.href) : false) ||\n // Depth-3: a grandchild owning the route also opens the top group.\n (child.children ?? []).some((leaf) =>\n leaf.href ? activeFn(pathname, leaf.href) : false,\n ),\n )\n}\n\n/**\n * Color-coded tone classes for the sidebar environment chip, matching the main\n * VRM app: prod red, staging orange, local/dev green, unknown gray.\n */\nfunction firstLeafHref(item: NavItem): string | undefined {\n for (const c of item.children ?? []) {\n if (c.kind === 'section') continue\n if (c.href) return c.href\n const deep = firstLeafHref(c)\n if (deep) return deep\n }\n return undefined\n}\n\n/** A multi-mode app (VRM core) renders NavAppShell without a registry modeId;\n * its current mode label still decides the rail colour (Left-Navigation §5). */\nexport function modeIdFromLabel(label: string | undefined): string | undefined {\n const l = label?.trim().toLowerCase()\n return l ? l.replace(/\\s+mode$/, '') : undefined\n}\n\n/** \"Ben Edtl\" -> \"Ben E.\" (Left-Navigation §10). One word stays as is. */\nexport function shortUserName(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n if (parts.length < 2) return parts[0] ?? ''\n return `${parts[0]} ${parts[parts.length - 1][0].toUpperCase()}.`\n}\n\n/** Short environment name for the rail's build line (\"prod\", \"staging\", \"local\"). */\nexport function shortEnvLabel(label: string): string {\n const l = label.trim().toLowerCase()\n if (l === 'production') return 'prod'\n if (l === 'development') return 'dev'\n return l\n}\n\nexport function envChipClasses(label: string): string {\n const l = label.toLowerCase()\n if (l === 'production' || l === 'prod')\n return 'bg-[#fee2e2] text-[#ef4444]'\n if (l === 'staging' || l === 'stage')\n return 'bg-[#ffedd5] text-[#f97316]'\n if (l === 'local' || l === 'development' || l === 'dev')\n return 'bg-[#dcfce7] text-[#22c55e]'\n return 'bg-[rgba(107,114,128,0.16)] text-[#6b7280]'\n}\n\n// ---------------------------------------------------------------------------\n\nexport type NavBrand = {\n /** Where the logo links to. Defaults to \"/\". */\n homeHref?: string\n /**\n * Brand logo image src. When supplied this renders as the wordmark logo\n * (matching the main app's BrandLogo), and `badgeLabel`/`title`/`subtitle`\n * are used only as the no-image fallback.\n */\n logoSrc?: string\n logoAlt?: string\n /**\n * The square mark shown at the top of the COLLAPSED rail (Left-Navigation\n * §11.6) — Brand `assets.logoSquare`, the all-white vrm tile. Falls back to\n * the badge when omitted.\n */\n logoSquareSrc?: string\n /**\n * The logo URLs are still resolving from the Brand token sheet. The rail\n * reserves the logo's box and draws nothing — never the badge fallback,\n * which would flash a stand-in on every load.\n */\n logoPending?: boolean\n /** Short label shown inside the brand badge fallback (e.g. \"P\"). */\n badgeLabel: string\n title: string\n subtitle?: string\n}\n\nexport type NavOrgOption = {\n id: string\n name: string | null\n logoUrl?: string | null\n /** The org's Brand Kit icon mark; falls back to `logoUrl`, then initials. */\n iconUrl?: string | null\n brandColor?: string | null\n role?: string | null\n}\n\nexport type NavOrg = {\n name: string | null\n /** Full org id. When present, a copy affordance is shown by the label. */\n id?: string | null\n /** Optional org logo for the pill badge; falls back to initials. */\n logoUrl?: string | null\n /**\n * The org's Brand Kit icon mark, shown on the collapsed rail (32px, on its\n * white tile). Falls back to `logoUrl` scaled to fit, then initials.\n */\n iconUrl?: string | null\n /** Solid pill background (the org's brand color). Defaults to the accent. */\n brandColor?: string | null\n /** Org's secondary Brand Kit color; the card's bottom-edge gradient runs\n * primary → secondary. Falls back to the Politogy gradient when unset. */\n brandColorSecondary?: string | null\n /**\n * Organization Settings §7.1–§7.2: when the org has no logo yet, an Account\n * Admin sees an \"Upload logo\" link in the band instead of the org name.\n */\n canUploadLogo?: boolean\n uploadLogoHref?: string\n onClick?: () => void\n /**\n * The user's organizations. When present (even one), the pill renders as a\n * dropdown SWITCHER (Reference/UI-Platform \"Organization selector\": never a\n * static label in a multi-org app); selecting one calls `onSwitch(id)`.\n */\n organizations?: NavOrgOption[]\n onSwitch?: (id: string) => void\n /**\n * The active org is still resolving from the chrome API. Renders a skeleton\n * pill instead of a name. Required because the app's own workspace label is\n * NOT the organization: showing it while the real org loads flashes a wrong\n * value (Global Rules — async values shimmer, they never render a stand-in).\n */\n loading?: boolean\n}\n\nexport type NavModeOption = {\n id: string\n label: string\n icon?: NavIcon\n /**\n * Left-Navigation §7: a mode the organization does not hold is always\n * shown (never hidden), dimmed, and not selectable. Defaults to true.\n */\n available?: boolean\n /** Tooltip for an unavailable mode, e.g. \"Campaign Mode isn't active for\n * this organization.\" Appended with \"See upgrade options\" for an Account\n * Admin on a paid account (never during a trial). */\n unavailableTooltip?: string\n}\n\nexport type NavMode = {\n label: string\n icon?: NavIcon\n /**\n * Entitled modes for the active organization. With more than one option the\n * pill renders as a SELECTOR (dropdown); with zero/one it stays the classic\n * disabled single-mode pill. Selecting calls onSelect(id).\n */\n options?: NavModeOption[]\n onSelect?: (id: string) => void\n}\n\nexport type NavFooterLink = { label: string; href: string; external?: boolean }\n\nexport type NavFooter = {\n /**\n * Build metadata (env chip / commit / version / date / author). OPTIONAL:\n * omit envLabel/version/commit to render a links-only footer — apps show\n * the meta block to Super Administrators only (Reference/UI-Platform).\n */\n envLabel?: string\n version?: string\n commit?: string\n links?: NavFooterLink[]\n /** ISO date (or any Date-parseable string) of the deployed commit. */\n commitDate?: string\n /** Full name of the commit author (only the first name is shown). */\n commitAuthor?: string\n /**\n * The signed-in user, drawn as a card (avatar · name · email · chevron)\n * ABOVE the links row. Reference/UI-Platform v30 → Left bar: \"The user —\n * avatar, name, email and the user menu — lives in the left bar footer.\"\n * Clicking it opens the account menu UPWARD. `NavAppShell` fills these from\n * `topBar.user` / `topBar.userMenu` / `topBar.onSignOut` automatically, so\n * standalone `NavSidebar` consumers pass them only when they want the card.\n */\n user?: NavUser | null\n userMenu?: NavUserMenu | null\n onSignOut?: () => void\n}\n\nexport type NavSidebarProps = {\n pathname: string\n brand: NavBrand\n nav: {\n groupLabel?: string\n items: NavItem[]\n isActive?: (pathname: string, href: string) => boolean\n /**\n * Render each top-level group's CHILDREN directly at the root of the rail\n * — no parent header row, no accordion. For an app whose whole tree nests\n * under one entry (Petitions), that parent row is pure anatomy: V1 never\n * had it, it duplicates the first child's route, and it costs a level of\n * indentation. Sections render as sections; rows render with the 'flat'\n * variant (top-level geometry, wash active treatment). Top-level items\n * WITHOUT children render unchanged, so a mixed tree degrades sanely.\n */\n flatten?: boolean\n }\n org?: NavOrg | null\n mode?: NavMode | null\n footer?: NavFooter | null\n linkComponent?: NavLinkComponent\n /**\n * Small-screen expand state (owned by `NavAppShell`). The rail is never\n * hidden (Left-Navigation §11.6): at `md` and up it is the full rail, below\n * `md` it collapses to the 64px icon rail. `open` expands the collapsed\n * rail to the full rail as a modal drawer with a backdrop, and `onClose`\n * wires the backdrop, the close button, and Escape. `md` and up ignores\n * both.\n */\n open?: boolean\n onClose?: () => void\n /**\n * Expands the collapsed (below `md`) rail. When set, the square logo tile at\n * the top of the collapsed rail becomes the \"Expand navigation\" control —\n * the Left-Navigation Design draws no other toggle and no top-bar hamburger.\n */\n onOpen?: () => void\n /**\n * Closes the expanded rail after a nav-link click without counting as the\n * user's Collapse choice. Defaults to `onClose`.\n */\n onNavigate?: () => void\n}\n\n// Default org-pill BADGE background — the chrome accent, matching the main\n// app's fallback (mode primary) when an org has no explicit brand color. In a\n// Mode with its own accent this follows the Mode. Only the circular badge takes\n// it; the pill body stays neutral (Reference/UI-Platform → Left bar).\n// White initials/avatar sit on this badge, so it must clear 4.5:1 under white\n// text, not just read as \"the accent\" — hence the safe alias, not the raw one.\nconst ORG_PILL_DEFAULT = 'var(--color-accent-bg-safe,var(--color-accent))'\n\n// Left-Navigation §11.6: below `md` the rail collapses to the 64px icon rail;\n// it is never hidden. The collapse is pure CSS (`max-md:` utilities), so there\n// is one DOM tree and no hydration flash. It applies only while the rail is\n// not expanded as the small-screen drawer, which is what this context carries\n// down to the rows.\nconst RailCollapsibleContext = createContext(false)\n\n/** Returns `cls` when the small-screen collapse applies to this rail, else ''. */\nfunction useRailCollapse(): (cls: string) => string {\n const collapsible = useContext(RailCollapsibleContext)\n return (cls) => (collapsible ? cls : '')\n}\n\n/**\n * The org pill's label: the org's name, or (when an org exists but has no\n * name yet) the same 7-char id tail the address bar uses, so the pill never\n * shows a name-shaped placeholder for a real org. \"No organizations\" is\n * reserved for when there is no org at all.\n */\nfunction orgPillLabel(org: NavOrg): string {\n if (org.name) return org.name\n if (org.id) return orgIdTail(org.id) ?? 'Organization'\n return 'No organizations'\n}\n\n/**\n * The organization on the collapsed rail: its Brand Kit icon mark, 32px, on a\n * white tile (Left-Navigation §11.6). Rendered inside the same switcher\n * trigger as the full card, so the switcher stays interactive when collapsed.\n */\nfunction OrgIconMark({ org, logoSrc }: { org: NavOrg; logoSrc?: string }) {\n const rc = useRailCollapse()\n const src = resolveOrgLogoUrl(org.iconUrl) ?? logoSrc\n return (\n <span\n aria-hidden\n data-rail-org-mark=\"\"\n className={`hidden h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-[5px] bg-[#FFFFFF] text-[11px] font-bold text-neutral-800 ${rc('max-md:flex')}`}\n >\n {src ? (\n <img src={src} alt=\"\" className=\"max-h-full max-w-full object-contain\" />\n ) : (\n (org.name ?? 'Org').slice(0, 2).toUpperCase()\n )}\n </span>\n )\n}\n\nexport function NavSidebar({\n pathname,\n brand,\n nav,\n org,\n mode,\n footer,\n linkComponent,\n open,\n onClose,\n onOpen,\n onNavigate,\n}: NavSidebarProps) {\n const Link = linkComponent ?? DefaultLink\n // The small-screen collapse applies whenever the rail is not expanded as\n // the drawer (see RailCollapsibleContext).\n const collapsible = !open\n const rc = (cls: string) => (collapsible ? cls : '')\n // Focus management for the mobile drawer: on open, move focus to the close\n // button; on close, return it to whatever had focus before (the hamburger,\n // in practice). Escape closes while the drawer is open.\n const asideRef = useRef<HTMLElement>(null)\n const closeButtonRef = useRef<HTMLButtonElement>(null)\n const previouslyFocusedRef = useRef<HTMLElement | null>(null)\n useEffect(() => {\n if (open) {\n previouslyFocusedRef.current = document.activeElement as HTMLElement | null\n closeButtonRef.current?.focus()\n } else if (previouslyFocusedRef.current) {\n previouslyFocusedRef.current.focus()\n previouslyFocusedRef.current = null\n }\n }, [open])\n useEffect(() => {\n if (!open) return\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose?.()\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [open, onClose])\n // Focus trap: Tab/Shift+Tab must stay inside the drawer while it is open —\n // no `inert` attribute (React 18/19 compatibility), so this is a plain\n // keydown handler that wraps focus at the first/last focusable element.\n const trapTab = (e: ReactKeyboardEvent<HTMLElement>) => {\n if (!open || e.key !== 'Tab') return\n const root = asideRef.current\n if (!root) return\n const focusable = Array.from(\n root.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n ),\n ).filter((el) => {\n if (el.hidden) return false\n const style = window.getComputedStyle(el)\n return style.display !== 'none' && style.visibility !== 'hidden'\n })\n if (focusable.length === 0) return\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n if (e.shiftKey) {\n if (document.activeElement === first) {\n e.preventDefault()\n last.focus()\n }\n } else if (document.activeElement === last) {\n e.preventDefault()\n first.focus()\n }\n }\n const activeFn = nav.isActive ?? isNavItemActive\n const ModeIcon = mode?.icon\n // Core stores logo_url as a core-relative storage route; resolve it against\n // the core origin so it loads in EVERY app, not just app.politogyvrm.com.\n const orgLogoSrc = resolveOrgLogoUrl(org?.logoUrl)\n // Left-Navigation §6: brand-color gradient strip along the logo band's\n // bottom edge; the Politogy gradient (blue → purple → red) until the org\n // sets its own Brand Kit colors.\n const orgGradient = org?.brandColor\n ? `linear-gradient(to right, ${org.brandColor}, ${org.brandColorSecondary || org.brandColor})`\n : 'linear-gradient(to right, #007BFF, #A54B7A, #E63946)'\n // Design rail: the org card border is the org's brand color at 42% alpha\n // (`rgba(74,192,231,.42)` in the Specs/Contacts design); hairline otherwise.\n const orgCardStyle = hexToRgba(org?.brandColor, 0.42)\n ? { borderColor: hexToRgba(org?.brandColor, 0.42) as string }\n : undefined\n\n // Single-open accordion for expandable nav groups, mirroring the main VRM\n // app's Chakra sidebar. `activeGroupKey` is the group (if any) that owns the\n // current route; deriving it as a primitive string keeps the auto-expand\n // effect from firing when `nav.items` is a fresh array reference each render\n // (which would otherwise clobber a manual toggle).\n const activeGroupKey = useMemo(() => {\n for (let i = 0; i < nav.items.length; i++) {\n const item = nav.items[i]\n if (item.children && item.children.length > 0 && hasActiveChild(item, pathname, activeFn)) {\n return groupKeyOf(item, i)\n }\n }\n return null\n }, [nav.items, pathname, activeFn])\n\n // Seed the open group from the active route on first paint (no expand flash),\n // then keep it synced as the route changes. Manual toggles between route\n // changes are preserved because the effect only reruns when the *derived*\n // active group actually changes.\n const [openGroup, setOpenGroup] = useState<string | null>(activeGroupKey)\n // Org selector type-to-filter (see ./orgFilter.ts). Reset whenever the popover closes.\n const [orgFilter, setOrgFilter] = useState('')\n useEffect(() => {\n setOpenGroup(activeGroupKey)\n }, [activeGroupKey])\n const toggleGroup = (key: string) =>\n setOpenGroup((prev) => (prev === key ? null : key))\n\n return (\n <RailCollapsibleContext.Provider value={collapsible}>\n {/* Backdrop — small-screen drawer only, dismisses on click. */}\n {open ? (\n <div\n aria-hidden\n className=\"fixed inset-0 z-40 bg-black/40 md:hidden\"\n onClick={onClose}\n />\n ) : null}\n <aside\n ref={asideRef}\n id=\"politogy-nav-drawer\"\n role={open ? 'dialog' : undefined}\n aria-modal={open ? 'true' : undefined}\n aria-label={open ? 'Navigation' : undefined}\n className={clsx(\n 'fixed inset-y-0 left-0 flex flex-col border-r border-[color:var(--sidebar-line,var(--line))] bg-[color:var(--sidebar-bg,var(--nav-surface))]',\n // Never hidden: the 64px icon rail below `md`, the full rail from\n // `md` up, and the full rail as a drawer when expanded below `md`.\n open\n ? 'z-50 w-[var(--sidebar-width,236px)]'\n : 'z-30 w-[var(--sidebar-collapsed-width,64px)] md:w-[var(--sidebar-width,236px)]',\n )}\n // Pin the rail's own font explicitly to the Brand token (Reference/UI-Platform\n // \"Typography\") rather than relying on inherited `body` styles. An app that\n // sets its own body font on a sub-view (e.g. Contacts) would otherwise leak\n // into the rail purely by inheritance — one shell definition, never app-derived.\n style={{ fontFamily: 'var(--font-family, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif)' }}\n onKeyDown={trapTab}\n onClick={(e) => {\n // Any nav-link click closes the drawer — including a click on the\n // CURRENT route's link, which would otherwise strand it open since\n // `pathname` never changes to trigger NavAppShell's close effect.\n if (open && (e.target as HTMLElement).closest('a[href]')) (onNavigate ?? onClose)?.()\n }}\n >\n {/* Close button — small-screen drawer only. */}\n {open ? (\n <button\n type=\"button\"\n ref={closeButtonRef}\n onClick={onClose}\n aria-label=\"Collapse navigation\"\n className=\"absolute right-3 top-3 flex h-8 w-8 items-center justify-center rounded-full text-[color:var(--muted)] transition hover:bg-[color:var(--panel-elevated)] hover:text-[color:var(--foreground)] md:hidden\"\n >\n <CloseIcon />\n </button>\n ) : null}\n {/* Header — brand, org card, mode switcher (Specs/Contacts design\n rail: padding 16px 18px, 14px between blocks, hairline below). */}\n <div className={`flex flex-shrink-0 flex-col gap-[14px] border-b border-[color:var(--sidebar-line,var(--line))] px-[18px] py-4 ${rc('max-md:items-center max-md:px-[10px]')}`}>\n {/* Brand — the lockup directly on the rail, no plate; the square\n tile when collapsed. Badge only when no logo was supplied at all. */}\n {/* Below `md` the collapsed rail's logo tile is the expand control\n (Left-Navigation §11.6: the rail is never hidden; the user expands\n it from the rail itself). Hidden while expanded and from `md` up. */}\n {onOpen ? (\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label=\"Expand navigation\"\n aria-expanded={open ?? false}\n data-rail-toggle=\"expand\"\n className={`hidden h-8 w-8 items-center justify-center rounded-lg ${rc('max-md:flex')}`}\n >\n {brand.logoSquareSrc ? (\n <img src={brand.logoSquareSrc} alt=\"\" draggable={false} className=\"h-8 w-8 object-contain\" />\n ) : brand.logoPending ? (\n <span aria-hidden className=\"block h-8 w-8\" />\n ) : (\n <span className=\"flex h-8 w-8 items-center justify-center rounded-xl bg-[color:var(--color-accent-bg-safe,var(--color-accent))] text-sm font-black text-[#FFFFFF]\">\n {brand.badgeLabel}\n </span>\n )}\n </button>\n ) : null}\n <Link\n href={brand.homeHref ?? '/'}\n aria-label={brand.logoAlt ?? brand.title}\n className={`flex items-center gap-2.5 ${rc('max-md:justify-center')} ${onOpen ? rc('max-md:hidden') : ''}`}\n >\n {brand.logoSquareSrc ? (\n <img\n src={brand.logoSquareSrc}\n alt=\"\"\n draggable={false}\n data-rail-logo=\"square\"\n className={`hidden h-8 w-8 object-contain ${rc('max-md:block')}`}\n />\n ) : brand.logoPending ? (\n <span aria-hidden className={`hidden h-8 w-8 ${rc('max-md:block')}`} />\n ) : null}\n {brand.logoSrc ? (\n <img\n src={brand.logoSrc}\n alt={brand.logoAlt ?? brand.title}\n draggable={false}\n data-rail-logo=\"horizontal\"\n className={`h-[var(--sidebar-brand-logo-height,24px)] w-auto object-contain ${rc('max-md:hidden')}`}\n />\n ) : brand.logoPending ? (\n <span\n aria-hidden\n className={`block h-[var(--sidebar-brand-logo-height,24px)] ${rc('max-md:hidden')}`}\n />\n ) : (\n <>\n <span\n className={`flex h-9 w-9 items-center justify-center rounded-xl bg-[color:var(--color-accent-bg-safe,var(--color-accent))] text-base font-black text-[#FFFFFF] shadow-sm ${brand.logoSquareSrc ? rc('max-md:hidden') : ''}`}\n >\n {brand.badgeLabel}\n </span>\n <span className={`flex flex-col leading-tight ${rc('max-md:hidden')}`}>\n <span className=\"text-base font-extrabold tracking-[-0.01em] text-[color:var(--color-accent-fg,var(--color-accent))]\">\n {brand.title}\n </span>\n {brand.subtitle ? (\n <span className=\"text-[11px] font-semibold uppercase tracking-[0.16em] text-[color:var(--muted)]\">\n {brand.subtitle}\n </span>\n ) : null}\n </span>\n </>\n )}\n </Link>\n\n {/* Organization switcher */}\n {org ? (\n <div className={rc('max-md:flex max-md:justify-center')}>\n <div className={`mb-[7px] mt-[7px] flex items-center justify-between ${rc('max-md:hidden')}`}>\n <p className={NAV_EYEBROW_CLASS}>\n Organization\n </p>\n </div>\n {org.loading ? (\n <div className={`flex w-full items-center gap-2.5 rounded-md border border-[color:var(--line)] bg-[color:var(--panel-elevated)] px-2.5 py-2 shadow-sm ${rc('max-md:w-auto max-md:border-0 max-md:bg-transparent max-md:p-0 max-md:shadow-none')}`}>\n <span\n aria-hidden\n className=\"h-7 w-7 shrink-0 animate-pulse rounded-full bg-[color:var(--panel)]\"\n />\n <span\n aria-hidden\n className={`h-4 flex-1 animate-pulse rounded bg-[color:var(--panel)] ${rc('max-md:hidden')}`}\n />\n <span className=\"sr-only\">Loading organization</span>\n </div>\n ) : org.organizations && org.organizations.length > 0 && org.onSwitch ? (\n <details data-nav-details className=\"group relative\">\n <summary\n style={orgCardStyle}\n title={org.name ?? undefined}\n className={`flex w-full cursor-pointer list-none flex-col overflow-hidden rounded-[5px] border border-[color:var(--sidebar-card-border,var(--sidebar-line,var(--line)))] bg-[color:var(--sidebar-card-bg,var(--panel-elevated))] text-left text-[color:var(--sidebar-text,var(--foreground))] transition hover:bg-[color:var(--sidebar-row-hover-bg,var(--panel))] [&::-webkit-details-marker]:hidden ${rc('max-md:w-auto max-md:items-center max-md:overflow-visible max-md:border-0 max-md:bg-transparent')}`}\n >\n <OrgIconMark org={org} logoSrc={orgLogoSrc} />\n {/* Logo band: white, org's Primary Brand Kit logo ≤70px, never\n cropped/stretched/recolored; \"Upload logo\" for an Admin\n with no logo yet; otherwise the org's display name. */}\n <span className={`relative flex h-[var(--sidebar-org-band-height,70px)] w-full items-center justify-center bg-[#FFFFFF] px-3 py-[7px] ${rc('max-md:hidden')}`}>\n {orgLogoSrc ? (\n <img src={orgLogoSrc} alt=\"\" className=\"max-h-full max-w-[132px] object-contain\" />\n ) : org.canUploadLogo ? (\n <a\n href={org.uploadLogoHref ?? '#'}\n onClick={(e) => e.stopPropagation()}\n className=\"text-xs font-semibold text-[color:var(--color-accent-fg,var(--color-accent))] underline\"\n >\n Upload logo\n </a>\n ) : (\n <span className=\"truncate text-sm font-semibold text-neutral-800\">\n {org.name ?? 'Organization'}\n </span>\n )}\n <span aria-hidden className=\"absolute inset-x-0 bottom-0 h-[3px]\" style={{ backgroundImage: orgGradient }} />\n </span>\n <span className={`flex w-full min-w-0 items-center justify-between gap-[9px] px-[10px] py-[10px] ${rc('max-md:hidden')}`}>\n <span className=\"flex min-w-0 flex-col\">\n <span\n title={org.name ?? undefined}\n className=\"truncate text-[12px] font-semibold leading-[1.2]\"\n >\n {orgPillLabel(org)}\n </span>\n {org.id && !org.loading ? <OrgIdCopyButton id={org.id} /> : null}\n </span>\n <ChevronDown size={14} />\n </span>\n </summary>\n <div className={`absolute left-0 right-0 z-40 mt-1 max-h-[min(60vh,520px)] overflow-y-auto rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] py-1 shadow-[var(--shadow-soft)] ${rc('max-md:right-auto max-md:w-[236px]')}`}>\n {shouldShowOrgFilter(org.organizations.length) ? (\n <div className=\"sticky top-0 z-10 bg-[color:var(--panel-elevated)] px-2 pb-1 pt-1\">\n <input\n type=\"search\"\n value={orgFilter}\n onChange={(e) => setOrgFilter(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Escape') {\n setOrgFilter('')\n e.currentTarget.closest('details')?.removeAttribute('open')\n }\n }}\n placeholder={`Filter ${org.organizations.length} organizations`}\n aria-label=\"Filter organizations\"\n autoComplete=\"off\"\n className=\"w-full rounded-lg border border-[color:var(--line)] bg-[color:var(--panel)] px-3 py-1.5 text-sm text-[color:var(--foreground)] placeholder:text-[color:var(--muted)] focus:outline-none focus:ring-2 focus:ring-[color:var(--color-accent)]\"\n />\n </div>\n ) : null}\n {filterOrgs(org.organizations, orgFilter).length === 0 ? (\n <p className=\"px-3 py-2 text-sm text-[color:var(--muted)]\">No organization matches “{orgFilter}”.</p>\n ) : null}\n {filterOrgs(org.organizations, orgFilter).map((o) => {\n const selected = o.id === org.id\n return (\n <button\n key={o.id}\n type=\"button\"\n onClick={(e) => {\n // Close the <details> popover, then switch.\n e.currentTarget.closest('details')?.removeAttribute('open')\n setOrgFilter('')\n if (!selected) org.onSwitch?.(o.id)\n }}\n aria-current={selected ? 'true' : undefined}\n className={[\n 'flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm',\n selected\n ? 'font-semibold text-[color:var(--color-accent-fg,var(--color-accent))]'\n : 'font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)]',\n ].join(' ')}\n >\n <span\n style={{ backgroundColor: o.brandColor || ORG_PILL_DEFAULT }}\n className=\"flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-full text-[10px] font-bold text-[#FFFFFF]\"\n >\n {resolveOrgLogoUrl(o.logoUrl) ? (\n <img\n src={resolveOrgLogoUrl(o.logoUrl)}\n alt=\"\"\n className=\"h-full w-full object-cover\"\n />\n ) : (\n (o.name ?? 'Org').slice(0, 2).toUpperCase()\n )}\n </span>\n <span title={o.name ?? o.id} className=\"truncate\">\n {o.name ?? o.id.slice(0, 8)}\n </span>\n </button>\n )\n })}\n </div>\n </details>\n ) : (\n <button\n type=\"button\"\n onClick={org.onClick}\n style={orgCardStyle}\n title={org.name ?? undefined}\n className={`flex w-full flex-col overflow-hidden rounded-[5px] border border-[color:var(--sidebar-card-border,var(--sidebar-line,var(--line)))] bg-[color:var(--sidebar-card-bg,var(--panel-elevated))] text-left text-[color:var(--sidebar-text,var(--foreground))] transition hover:bg-[color:var(--sidebar-row-hover-bg,var(--panel))] ${rc('max-md:w-auto max-md:items-center max-md:overflow-visible max-md:border-0 max-md:bg-transparent')}`}\n >\n <OrgIconMark org={org} logoSrc={orgLogoSrc} />\n <span className={`relative flex h-[var(--sidebar-org-band-height,70px)] w-full items-center justify-center bg-[#FFFFFF] px-3 py-[7px] ${rc('max-md:hidden')}`}>\n {orgLogoSrc ? (\n <img src={orgLogoSrc} alt=\"\" className=\"max-h-full max-w-[132px] object-contain\" />\n ) : org.canUploadLogo ? (\n <a\n href={org.uploadLogoHref ?? '#'}\n onClick={(e) => e.stopPropagation()}\n className=\"text-xs font-semibold text-[color:var(--color-accent-fg,var(--color-accent))] underline\"\n >\n Upload logo\n </a>\n ) : (\n <span className=\"truncate text-sm font-semibold text-neutral-800\">\n {org.name ?? 'Organization'}\n </span>\n )}\n <span aria-hidden className=\"absolute inset-x-0 bottom-0 h-[3px]\" style={{ backgroundImage: orgGradient }} />\n </span>\n <span className={`flex w-full min-w-0 items-center justify-between gap-[9px] px-[10px] py-[10px] ${rc('max-md:hidden')}`}>\n <span className=\"flex min-w-0 flex-col\">\n <span\n title={org.name ?? undefined}\n className=\"truncate text-[12px] font-semibold leading-[1.2]\"\n >\n {orgPillLabel(org)}\n </span>\n {org.id && !org.loading ? <OrgIdCopyButton id={org.id} /> : null}\n </span>\n <ChevronDown size={14} />\n </span>\n </button>\n )}\n </div>\n ) : null}\n\n {/* Mode selector — Reference/UI-Platform: \"A row of three icon buttons\n — Relationship · Campaign · Petition — under the org card, never a\n dropdown, with the current mode's name beneath.\" Identical in every\n app, mode-scoped apps included: the app's own mode is selected and\n the other available modes navigate to that mode's landing page. */}\n {mode ? (\n <div className={rc('max-md:w-full')}>\n <div\n role=\"radiogroup\"\n aria-label=\"Mode\"\n className={`flex w-full items-center gap-1 rounded-lg border border-[color:var(--border-inverse,var(--sidebar-line,var(--line)))] bg-[color:var(--mode-track-bg,var(--panel-elevated))] p-[3px] ${rc('max-md:flex-col max-md:items-stretch')}`}\n >\n {(mode.options && mode.options.length > 0 ? mode.options : [{ id: mode.label, label: mode.label, icon: ModeIcon }]).map(\n (opt) => {\n const selected = opt.label === mode.label\n const OptIcon = opt.icon\n const available = opt.available ?? true\n const title = !available\n ? opt.unavailableTooltip ?? `${opt.label} isn't active for this organization.`\n : opt.label\n return (\n <button\n key={opt.id}\n type=\"button\"\n role=\"radio\"\n title={title}\n aria-label={title}\n aria-checked={selected}\n aria-current={selected ? 'true' : undefined}\n onClick={() => {\n if (available && !selected) mode.onSelect?.(opt.id)\n }}\n disabled={!available}\n className={[\n `flex flex-none items-center justify-center rounded-[5px] px-[9px] py-[6px] transition ${rc('max-md:flex-1')}`,\n !available\n ? 'cursor-not-allowed text-[color:var(--sidebar-text-muted,var(--muted))] opacity-35'\n : selected\n ? 'bg-[color:var(--sidebar-mode-selected-bg,var(--mode-accent,var(--color-accent)))] text-[color:var(--mode-on-accent,var(--color-accent-bg-safe,white))]'\n : 'text-[color:var(--sidebar-text-muted,var(--muted))] hover:bg-[#FFFFFF]/5 hover:text-[color:var(--sidebar-text,var(--foreground))]',\n ].join(' ')}\n >\n {OptIcon ? <OptIcon size={15} className=\"shrink-0\" /> : null}\n </button>\n )\n },\n )}\n </div>\n {/* Sentence-case caption, left-aligned under the switcher\n (\"Relationship mode\") — Specs/Contacts design rail. */}\n <p className={`mt-1.5 text-left text-[11px] leading-[1.2] text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))] ${rc('max-md:hidden')}`}>\n {modeCaption(mode.label)}\n </p>\n </div>\n ) : null}\n </div>\n\n {/* Scroll region: nav only — the header above stays put. */}\n <div className=\"flex flex-1 flex-col overflow-y-auto px-[10px] py-3\">\n {/* Nav list */}\n <nav className=\"flex flex-col gap-0.5\">\n {nav.groupLabel ? (\n <p className={`${NAV_EYEBROW_CLASS} px-2 pb-1.5 pt-1 ${rc('max-md:hidden')}`}>\n {nav.groupLabel}\n </p>\n ) : null}\n {nav.items.map((item, idx) => {\n // Section heading: groups the rows beneath it. Non-interactive and\n // not focusable, so it is skipped by tab order and never reads as a\n // dead control. Top margin except on the first row, so the groups\n // separate without a stray gap at the top of the rail.\n if (item.kind === 'section') {\n return (\n <NavSectionRow\n key={`section-${idx}-${item.label}`}\n label={item.label}\n first={idx === 0}\n />\n )\n }\n // Flattened tree: the group's children ARE the rail. See nav.flatten.\n if (nav.flatten && item.children && item.children.length > 0) {\n return item.children.map((child, i) => {\n if (child.kind === 'section') {\n return (\n <NavSectionRow\n key={`flat-section-${idx}-${i}-${child.label}`}\n label={child.label}\n first={idx === 0 && i === 0}\n />\n )\n }\n return (\n <NavRow\n key={child.href ?? `flat-${idx}-${i}-${child.label}`}\n item={child}\n active={child.href ? activeFn(pathname, child.href) : false}\n Link={Link}\n variant=\"flat\"\n />\n )\n })\n }\n // Left-Navigation §8.2: the bar is flat — no sub-menus, no\n // accordions, no chevrons. A row with children renders as one row\n // linking to its own page (or its first child's) and is active\n // whenever any page beneath it is (§11.3, by route prefix). The\n // children stay in the tree for breadcrumbs and in-page tabs.\n if (item.children && item.children.length > 0) {\n const selfActive = item.href ? activeFn(pathname, item.href) : false\n const parentActive = selfActive || hasActiveChild(item, pathname, activeFn)\n return (\n <NavRow\n key={item.href ?? groupKeyOf(item, idx)}\n item={{ ...item, href: item.href ?? firstLeafHref(item), children: undefined }}\n active={parentActive}\n Link={Link}\n />\n )\n }\n const active = item.href ? activeFn(pathname, item.href) : false\n return (\n <NavRow\n key={item.href ?? `nav-${idx}-${item.label}`}\n item={item}\n active={active}\n Link={Link}\n />\n )\n })}\n </nav>\n </div>\n\n {/* Footer — user card (account menu opens upward), then the links row,\n then the build meta (non-production only). Specs/Contacts design rail. */}\n {footer ? (\n <div className={`relative flex-shrink-0 border-t border-[color:var(--sidebar-line,var(--line))] px-[14px] py-3 ${rc('max-md:px-[10px]')}`}>\n {footer.user ? (\n <NavSidebarUserCard\n user={footer.user}\n userMenu={footer.userMenu ?? undefined}\n onSignOut={footer.onSignOut}\n />\n ) : null}\n {footer.links && footer.links.length > 0 ? (\n <div className={`flex flex-wrap items-center justify-center gap-[6px] text-[11px] leading-[1.2] ${footer.user ? 'mt-3' : ''} ${rc('max-md:hidden')}`}>\n {footer.links.map((l, i) => (\n <Fragment key={l.label}>\n {i > 0 ? <span aria-hidden className=\"text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))]\">·</span> : null}\n <a\n href={safeHref(l.href)}\n className=\"text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))] hover:text-[color:var(--sidebar-text,var(--foreground))] hover:underline\"\n >\n {l.label}\n </a>\n </Fragment>\n ))}\n </div>\n ) : null}\n {footer.envLabel || footer.commit || footer.version ? (\n <div\n data-shell-meta\n className={`mt-1.5 flex flex-col items-center gap-0.5 font-[family-name:var(--font-mono,ui-monospace,monospace)] text-[11px] text-[color:var(--sidebar-meta-text,rgba(255,255,255,0.72))] ${rc('max-md:hidden')}`}\n >\n {/* Row 1: env | commit | version — Specs/Left-Navigation §9:\n plain mono text, centered, no leading or trailing pipes. */}\n <div className=\"flex items-center gap-1.5\">\n {[\n footer.envLabel ? shortEnvLabel(footer.envLabel) : null,\n footer.commit ? footer.commit.slice(-4) : null,\n footer.version ? `v${footer.version.replace(/^v/, '')}` : null,\n ]\n .filter((v): v is string => Boolean(v))\n .map((v, i) => (\n <Fragment key={i}>\n {i > 0 ? <span>|</span> : null}\n <span>{v}</span>\n </Fragment>\n ))}\n </div>\n {/* Row 2: date | author (only when supplied) */}\n {footer.commitDate || footer.commitAuthor ? (\n <div className=\"flex items-center gap-1.5\">\n {footer.commitDate ? (\n <span>\n {new Date(footer.commitDate).toLocaleDateString(undefined, {\n month: 'short',\n day: 'numeric',\n })}\n </span>\n ) : null}\n {footer.commitDate && footer.commitAuthor ? (\n <span>|</span>\n ) : null}\n {footer.commitAuthor ? (\n <span>{footer.commitAuthor.split(/\\s+/)[0]}</span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n </aside>\n </RailCollapsibleContext.Provider>\n )\n}\n\n// Inline hamburger / close glyphs for the mobile nav drawer — no icon\n// dependency, same idiom as every other inline SVG in this file.\nfunction HamburgerIcon() {\n return (\n <svg\n width={24}\n height={24}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" />\n <line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\" />\n <line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\" />\n </svg>\n )\n}\n\n/** 14px book-open glyph for the \"Build notes\" quiet button (design). */\nfunction BookOpenIcon() {\n return (\n <svg\n width={14}\n height={14}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"shrink-0\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 7v14\" />\n <path d=\"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z\" />\n </svg>\n )\n}\n\nfunction SearchIcon({ className }: { className?: string } = {}) {\n return (\n <svg\n width={16}\n height={16}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\" />\n </svg>\n )\n}\n\nfunction CloseIcon() {\n return (\n <svg\n width={20}\n height={20}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n )\n}\n\n// Inline chevron-down (mirrors lucide `ChevronDown`) — no icon dependency.\n// Callers may override `className` to add a rotation (used by expandable groups).\nfunction ChevronDown({ className, size = 16 }: { className?: string; size?: number } = {}) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className ?? 'shrink-0 opacity-80'}\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n )\n}\n\n// A single sidebar nav row. Renders as a routed <Link> (href) or a <button>\n// (onClick), styled identically. Inactive rows animate a left→right gradient\n// sweep on hover (matching the main app); active rows keep the solid accent.\n//\n// `variant=\"sub\"` renders the smaller child rows inside an expanded group: a\n// tighter row whose ACTIVE state is a lighter elevated surface with accent\n// text (not a solid fill — that stays reserved for top-level/parent rows,\n// exactly as the main VRM app's Chakra sidebar treats active sub-items).\n//\n// The gradient was hardcoded to the race-red 400/500 stops; it now reads the\n// token so a Mode with its own accent sweeps in its own colour. chrome.css\n// defaults it to those same two stops, so nothing moves for anyone else.\nconst NAV_HOVER_GRADIENT = 'var(--nav-hover-gradient)'\n\n// A non-interactive section heading. Groups the rows beneath it; not a control,\n// so it is not focusable and carries no hover, no aria-disabled and no role.\n//\n// Rendered at BOTH levels: an app whose routes are nested under a standard nav\n// entry (Petitions nests its whole tree under the Petition Mode row) needs its\n// sections inside the expanded group, not only at the top level.\n//\n// `first` suppresses the leading margin so a rail that opens with a section\n// does not start with a gap.\n// Rail typography/geometry — Specs/Contacts design rail (Reference/UI-Platform\n// v30 → Left bar). Every token has an inline fallback so an app that is not\n// mode-scoped (white rail) keeps a sane rendering.\nconst NAV_EYEBROW_CLASS =\n 'text-[11px] font-bold uppercase leading-[1.2] tracking-[0.09em] text-[color:var(--sidebar-eyebrow,var(--sidebar-text-muted,var(--muted)))]'\nconst NAV_TOP_ICON_SIZE = 17\nconst NAV_TOP_ROW_CLASS = (active: boolean) =>\n `gap-[11px] px-[10px] py-[9px] text-[13px] leading-none ${active ? 'font-semibold' : 'font-normal'}`\nconst NAV_TOP_ACTIVE_CLASS =\n 'bg-[color:var(--sidebar-active-bg,var(--color-accent-bg-safe,var(--color-accent)))] text-[color:var(--sidebar-active-text,white)]'\nconst NAV_TOP_INACTIVE_CLASS =\n 'text-[color:var(--sidebar-row-text,var(--sidebar-text,var(--muted)))] hover:bg-[color:var(--sidebar-row-hover-bg,var(--panel-elevated))] hover:text-[color:var(--sidebar-text,var(--foreground))]'\n\n/** \"Relationship Mode\" → \"Relationship mode\" (design caption is sentence case). */\nfunction modeCaption(label: string): string {\n return label.replace(/\\s+Mode$/i, ' mode')\n}\n\n/** 2px inset rail on the active row, in the Mode accent (design: inset 2px 0 0 0). */\nfunction NavActiveRail() {\n // `--mode-accent` is only set by a declared Mode chrome group; the inline\n // `transparent` fallback is what every other app gets — present but\n // invisible, and absolutely positioned so it moves nothing.\n return (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-y-0 left-0 w-[2px]\"\n style={{ background: 'var(--mode-accent, transparent)' }}\n />\n )\n}\n\n/** Right-aligned mono count on a nav row (`Contacts · 31.9K`). */\nfunction NavRowBadge({ value }: { value?: string | number | null }) {\n const rc = useRailCollapse()\n if (value === undefined || value === null || value === '') return null\n return (\n <span className={`ml-auto shrink-0 font-[family-name:var(--font-mono,ui-monospace,monospace)] text-[11px] font-semibold leading-none text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))] ${rc('max-md:hidden')}`}>\n {value}\n </span>\n )\n}\n\nfunction NavSectionRow({\n label,\n first,\n variant = 'top',\n}: {\n label: string\n first: boolean\n variant?: 'top' | 'sub'\n}) {\n const rc = useRailCollapse()\n // Collapsed rail: the eyebrow becomes a 1px divider (Left-Navigation §11.6).\n // The divider is its OWN decorative element (aria-hidden) now, not the\n // heading's text painted transparent over it — a live capture on Forms at\n // 375px (light theme) measured that transparent heading text as a real\n // rgba(0,0,0,0)-on-rgb(63,64,68) 1.00:1 contrast failure (\"Collect\"/\n // \"Account\"), because a contrast scan sees the painted (if invisible)\n // glyphs, not the 1px overflow-hidden box clipping them. Moving the label\n // itself to `sr-only` (truly off-screen, same treatment the first section\n // already used) removes it from the visual contrast surface entirely while\n // it stays in the DOM as a heading for screen readers, same as before.\n const labelCollapsed = variant === 'sub' ? '' : rc('max-md:sr-only')\n return (\n <>\n {variant !== 'sub' && !first ? (\n <div\n aria-hidden\n className={rc('max-md:mx-2 max-md:my-2 max-md:h-px max-md:bg-[color:var(--sidebar-line,var(--line))]')}\n />\n ) : null}\n <p\n className={[\n NAV_EYEBROW_CLASS,\n variant === 'sub' ? 'px-3 pb-0.5' : 'px-2 pb-1.5 pt-1',\n first ? '' : variant === 'sub' ? 'mt-3' : 'mt-[14px]',\n labelCollapsed,\n ].join(' ')}\n >\n {label}\n </p>\n </>\n )\n}\n\nfunction NavRow({\n item,\n active,\n Link,\n variant = 'top',\n}: {\n item: NavItem\n active: boolean\n Link: NavLinkComponent\n variant?: 'top' | 'sub' | 'flat'\n}) {\n const rc = useRailCollapse()\n const Icon = item.icon\n const isSub = variant === 'sub'\n // 'flat' rows keep top-level geometry but take the wash active treatment —\n // tinted surface + accent text — the way V1's full-height rail rows did,\n // rather than the solid fill reserved for parent rows.\n const washActive = variant !== 'top'\n // The active sub-row surface follows the Mode when one is declared.\n //\n // The fallback is INLINE, and has to be. `--mode-accent-surface` is only ever\n // set inside `[data-politogy-mode]`, so an app that is not mode-scoped never\n // has it — and a bare `var(--x)` with no fallback is invalid at\n // computed-value time, which would drop `background-color` all the way to\n // `transparent` and silently delete the active highlight for Contacts, Forms,\n // Surveys and Polls. Nor can the fallback be hoisted into a `:root`\n // declaration: `.dark` is a separate top-level selector here, so a `:root`\n // alias would freeze the LIGHT `--panel-elevated` and inherit it into dark.\n // Resolving at the point of use is the only placement that is correct in both\n // themes, scoped and unscoped.\n const activeClasses = washActive\n ? 'bg-[color:var(--mode-accent-surface,var(--panel-elevated))] text-[color:var(--color-accent-fg,var(--color-accent))] shadow-sm'\n : NAV_TOP_ACTIVE_CLASS\n const wrapperClasses = [\n 'group relative block overflow-hidden transition',\n isSub ? 'rounded-md' : 'rounded-[5px]',\n active ? activeClasses : isSub ? 'text-[color:var(--sidebar-text,var(--muted))] hover:text-[#FFFFFF]' : NAV_TOP_INACTIVE_CLASS,\n ].join(' ')\n\n const rowPadding = isSub ? 'gap-3 px-3 py-1.5 text-[13px] font-semibold' : NAV_TOP_ROW_CLASS(active)\n const iconSize = isSub ? 16 : NAV_TOP_ICON_SIZE\n // Glyphs inherit the row's text color in every variant.\n const iconClass = 'text-current'\n\n const inner = (\n <>\n {!active ? (\n // Sub rows keep the left→right gradient sweep; top-level rows take a\n // flat wash on hover (design rail: rgba(255,255,255,.05)).\n isSub ? (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-y-0 left-0 w-0 transition-[width] duration-300 group-hover:w-full\"\n style={{ background: NAV_HOVER_GRADIENT }}\n />\n ) : null\n ) : (\n <NavActiveRail />\n )}\n <span className={`relative z-10 flex items-center ${rowPadding} ${rc('max-md:justify-center max-md:px-0')}`}>\n {Icon ? (\n <Icon size={iconSize} className={`shrink-0 ${iconClass}`} />\n ) : (\n // A row with no glyph still needs something on the icon rail.\n <span aria-hidden className={`hidden text-[11px] font-semibold uppercase ${rc('max-md:inline')}`}>\n {item.label.slice(0, 2)}\n </span>\n )}\n <span className={`min-w-0 flex-1 truncate ${rc('max-md:hidden')}`}>{item.label}</span>\n <NavRowBadge value={item.badge} />\n </span>\n </>\n )\n\n // A gated row renders as a non-interactive span: dimmed, not focusable, and\n // carrying its reason as a tooltip. Same treatment a disabled NavTab gets, so\n // gating reads identically in the sidebar and in a tab strip.\n if (item.disabled) {\n return (\n <span\n aria-disabled=\"true\"\n title={item.disabledTitle ?? item.label}\n className={`${wrapperClasses} cursor-not-allowed opacity-50`}\n >\n {inner}\n </span>\n )\n }\n\n if (item.onClick && !item.href) {\n return (\n <button\n type=\"button\"\n onClick={item.onClick}\n title={item.label}\n className={`w-full text-left ${wrapperClasses}`}\n >\n {inner}\n </button>\n )\n }\n\n return (\n <Link\n href={item.href ?? '#'}\n aria-current={active ? 'page' : undefined}\n // The tooltip names the row; on the collapsed rail it is also the\n // row's accessible name, since the label is not displayed.\n title={item.label}\n className={wrapperClasses}\n >\n {inner}\n </Link>\n )\n}\n\n// An expandable nav GROUP: a toggle header + a collapsible list of child rows.\n// Faithful twin of the main VRM app's Chakra accordion (Sidebar.tsx /\n// NavItem.tsx):\n// - Clicking the header toggles the children — it never navigates, even when\n// the group carries an `href`.\n// - A right-aligned chevron rotates 180° when open.\n// - The header goes solid accent (white text) when the group owns the active\n// route (its own href OR any child), matching top-level active rows; when\n// merely open it lifts onto the `--panel` surface; otherwise it's a muted row\n// with the same left→right gradient hover sweep as every other nav row.\n// - Children sit on the lighter `--panel` surface, indented and rounded, each\n// rendered through the SAME injected LinkComponent (or as a button for\n// `onClick` children) via <NavRow variant=\"sub\" />.\nfunction NavGroup({\n item,\n active,\n open,\n onToggle,\n pathname,\n activeFn,\n Link,\n}: {\n item: NavItem\n active: boolean\n open: boolean\n onToggle: () => void\n pathname: string\n activeFn: (pathname: string, href: string) => boolean\n Link: NavLinkComponent\n}) {\n const rc = useRailCollapse()\n const Icon = item.icon\n const headerClasses = [\n 'group relative block w-full overflow-hidden text-left transition',\n open ? 'rounded-t-[5px]' : 'rounded-[5px]',\n active\n ? NAV_TOP_ACTIVE_CLASS\n : open\n ? 'bg-[color:var(--sidebar-row-hover-bg,var(--panel))] text-[color:var(--sidebar-text,var(--foreground))]'\n : NAV_TOP_INACTIVE_CLASS,\n ].join(' ')\n\n return (\n <div>\n <button\n type=\"button\"\n // A group header ALWAYS toggles. When the item also carries its own\n // onClick, that runs too — so a parent can navigate to its section\n // dashboard (e.g. Email Broadcast → /relationship/email/dashboard) and\n // expand in one click. Existing apps pass no parent onClick, so their\n // behavior is unchanged (shell-nav-handoff §2).\n onClick={() => {\n onToggle()\n item.onClick?.()\n }}\n aria-expanded={open}\n title={item.label}\n className={headerClasses}\n >\n {active ? <NavActiveRail /> : null}\n <span className={`relative z-10 flex items-center ${NAV_TOP_ROW_CLASS(active)} ${rc('max-md:justify-center max-md:px-0')}`}>\n {Icon ? (\n <Icon size={NAV_TOP_ICON_SIZE} className=\"shrink-0 text-current\" />\n ) : null}\n <span className={`min-w-0 flex-1 truncate ${rc('max-md:hidden')}`}>{item.label}</span>\n <NavRowBadge value={item.badge} />\n <ChevronDown\n className={[\n 'shrink-0 opacity-80 transition-transform duration-200',\n open ? 'rotate-180' : '',\n rc('max-md:hidden'),\n ].join(' ')}\n />\n </span>\n </button>\n\n {open ? (\n <div className={`overflow-hidden rounded-b-md bg-[color:var(--nav-submenu-bg)] p-1 ${rc('max-md:hidden')}`}>\n <div className=\"flex flex-col gap-0.5\">\n {item.children!.map((child, i) => {\n if (child.kind === 'section') {\n return (\n <NavSectionRow\n key={`sub-section-${i}-${child.label}`}\n label={child.label}\n first={i === 0}\n variant=\"sub\"\n />\n )\n }\n const childActive = child.href ? activeFn(pathname, child.href) : false\n // Depth-3: a child that carries its own children renders as a\n // NESTED collapsible sub-group (e.g. Organization Settings →\n // Subscription & Billing → Wallet). Deeper levels are not\n // rendered — three is the platform maximum.\n if (child.children && child.children.length > 0) {\n return (\n <NavSubGroup\n key={child.href ?? `subgrp-${i}-${child.label}`}\n item={child}\n pathname={pathname}\n activeFn={activeFn}\n Link={Link}\n />\n )\n }\n return (\n <NavRow\n key={child.href ?? `sub-${i}-${child.label}`}\n item={child}\n active={childActive}\n Link={Link}\n variant=\"sub\"\n />\n )\n })}\n </div>\n </div>\n ) : null}\n </div>\n )\n}\n\n// A second-level group INSIDE an expanded group — the depth-3 renderer\n// (Reference/UI-Platform: sub-sub items). Auto-expands when it owns the active\n// route; otherwise toggles locally. Grandchildren render as further-indented\n// sub rows on the same panel surface.\nfunction NavSubGroup({\n item,\n pathname,\n activeFn,\n Link,\n}: {\n item: NavItem\n pathname: string\n activeFn: (pathname: string, href: string) => boolean\n Link: NavLinkComponent\n}) {\n const ownsActive =\n (item.href ? activeFn(pathname, item.href) : false) ||\n (item.children ?? []).some((c) => (c.href ? activeFn(pathname, c.href) : false))\n const [open, setOpen] = useState(ownsActive)\n useEffect(() => {\n if (ownsActive) setOpen(true)\n }, [ownsActive])\n const Icon = item.icon\n\n return (\n <div>\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className={[\n 'flex w-full items-center gap-2.5 rounded px-3 py-1.5 text-left text-[13px] font-medium transition',\n ownsActive\n ? 'text-[color:var(--color-accent-fg,var(--color-accent))]'\n : 'text-[color:var(--sidebar-text,var(--muted))] hover:bg-[color:var(--nav-row-hover)] hover:text-[color:var(--foreground)]',\n ].join(' ')}\n >\n {Icon ? <Icon size={15} className=\"shrink-0 text-current\" /> : null}\n <span className=\"flex-1\">{item.label}</span>\n <ChevronDown\n className={[\n 'shrink-0 opacity-70 transition-transform duration-200',\n open ? 'rotate-180' : '',\n ].join(' ')}\n />\n </button>\n {open ? (\n <div className=\"ml-4 flex flex-col gap-0.5 border-l border-[color:var(--line)] pl-2\">\n {item.children!.map((leaf, i) => (\n <NavRow\n key={leaf.href ?? `subsub-${i}-${leaf.label}`}\n item={leaf}\n active={leaf.href ? activeFn(pathname, leaf.href) : false}\n Link={Link}\n variant=\"sub\"\n />\n ))}\n </div>\n ) : null}\n </div>\n )\n}\n\n// Right-aligned copy affordance for the org id, shown beside the \"Organization\"\n// label. Copies the full id and briefly swaps its text to \"Copied\".\nfunction OrgIdCopyButton({ id }: { id: string }) {\n const [copied, setCopied] = useState(false)\n return (\n <button\n type=\"button\"\n onClick={() => {\n try {\n void navigator.clipboard?.writeText(id)\n } catch {\n /* clipboard unavailable — ignore */\n }\n setCopied(true)\n setTimeout(() => setCopied(false), 1500)\n }}\n title=\"Copy organization id\"\n className=\"-ml-1 rounded px-1 text-left font-[family-name:var(--font-mono,ui-monospace,monospace)] text-[12px] leading-[1.2] text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))] hover:bg-[color:var(--sidebar-row-hover-bg,var(--panel))]\"\n >\n {copied ? 'Copied' : `…${id.slice(-8)}`}\n </button>\n )\n}\n\n// ---------------------------------------------------------------------------\n\nexport type NavUser = {\n name: string | null\n email?: string | null\n /** Profile PHOTO url — highest-precedence avatar source. */\n avatarUrl?: string | null\n /** Memoji url — used when no photo is set; falls back to initials. */\n memojiUrl?: string | null\n tier?: string | null\n role?: string | null\n}\n\nexport type NavTopBarAction = {\n key: string\n /**\n * Canonical top-bar slot. When set, the glyph is sourced by NAME from the\n * Brand API via `--topbar-icon-<slot>`; `icon` becomes the fallback used\n * until the runtime Brand stylesheet lands (or when the token is unset).\n */\n slot?: TopBarIconSlot\n icon: NavIcon\n label: string\n onClick?: () => void\n href?: string\n badge?: number | null\n tone?: 'default' | 'warning' | 'danger'\n /** Tooltip body shown under the icon (label is the tooltip title). */\n description?: string\n}\n\nexport type NavLinkedAccount = {\n id: string\n name: string | null\n email?: string | null\n avatarUrl?: string | null\n active?: boolean\n}\n\nexport type NavRoleBadge = {\n role: string\n orgName?: string | null\n}\n\n/**\n * The My Account menu (avatar dropdown) — mirrors the main VRM app's user\n * menu: My Profile / Organization Settings links, a ROLES & ORGANIZATIONS\n * section, an ACCOUNTS switcher, an optional theme control, then Sign out.\n * Every section renders only when its data is supplied.\n */\nexport type NavUserMenu = {\n myProfileHref?: string\n organizationSettingsHref?: string\n roles?: NavRoleBadge[]\n accounts?: NavLinkedAccount[]\n onSwitchAccount?: (id: string) => void\n onRemoveAccount?: (id: string) => void\n addAccountHref?: string\n onAddAccount?: () => void\n /**\n * Navigation display (Sub Menu / Tabs Only / Both) — lives in the account\n * menu since 0.68.0; the top-bar `NavDisplayAction` popover is retired from\n * the standard cluster (design: 4 icon buttons + Help).\n */\n navDisplay?: {\n value: NavDisplayMode\n onChange: (next: NavDisplayMode) => void\n }\n /** Theme preference segmented control (Light / System / Dark). */\n theme?: {\n value: ThemePreference\n onChange: (next: ThemePreference) => void\n }\n}\n\nexport type NavBreadcrumb = {\n label: string\n href?: string\n}\n\nexport type NavTopBarProps = {\n /**\n * Chrome-owned page title line (`<h1>` above main). Omit when the page body\n * owns its own title (registry `pageTitle: false`, e.g. Contacts).\n */\n title?: string\n subtitle?: string\n /**\n * Breadcrumb trail rendered UNDER the page title (Reference/UI-Platform:\n * every page and sub-page/tab shows its location). Last crumb = current\n * location (non-link); earlier crumbs may carry hrefs.\n */\n breadcrumbs?: NavBreadcrumb[]\n user?: NavUser | null\n userMenu?: NavUserMenu\n onSignOut?: () => void\n /**\n * Structured icon-button action cluster (32×32 circular buttons with optional\n * count badges), rendered before the `actions` slot. Matches the main app's\n * topbar action icons.\n */\n actionsList?: NavTopBarAction[]\n /** App-specific action cluster rendered left of the theme toggle. */\n actions?: ReactNode\n /** Theme toggle slot (injected so this package needs no theme dependency). */\n themeToggle?: ReactNode\n /**\n * Mobile drawer trigger (owned by `NavAppShell`). Supplying it renders a\n * hamburger button, hidden at `lg` and up, as the first thing in the header\n * — below `lg` the sidebar is otherwise unreachable. Omit to render no\n * hamburger at all (e.g. `NavTopBar` used standalone).\n */\n onOpenNav?: () => void\n /** Whether the drawer `onOpenNav` opens is currently open (drives `aria-expanded`). */\n navOpen?: boolean\n /**\n * Universal search — Reference/UI-Platform \"Top bar → required elements\":\n * the search field, 320px wide, at the left end of the bar; nothing else\n * sits on the left. Omit `onChange`/`onSubmit` for a decorative field (an\n * app that has not wired search yet still gets the correct chrome).\n */\n search?: {\n placeholder?: string\n value?: string\n onChange?: (value: string) => void\n onSubmit?: (value: string) => void\n }\n /**\n * Build notes — a quiet text button that starts the right-hand group\n * (Reference/UI-Platform \"Top bar → required elements\").\n */\n /**\n * Where the My Account trigger lives. `'topbar'` (default for a standalone\n * `NavTopBar`) keeps the avatar + name + chevron at the right end of the bar;\n * `'sidebar'` / `'none'` hide it here — `NavAppShell` passes `'sidebar'` and\n * draws the user card in the left-bar footer instead (UI-Platform v30:\n * \"There is no My Account badge in the top bar\").\n */\n accountMenu?: 'topbar' | 'sidebar' | 'none'\n buildNotes?: {\n label?: string\n onOpen?: () => void\n }\n}\n\nexport function NavTopBar({\n title,\n subtitle,\n breadcrumbs,\n user,\n userMenu,\n onSignOut,\n actionsList,\n actions,\n themeToggle,\n onOpenNav,\n navOpen,\n search,\n buildNotes,\n accountMenu = 'topbar',\n}: NavTopBarProps) {\n // Real name = anything that isn't empty and isn't an email address. The\n // trigger shows \"First L.\" — never the email on both lines.\n const rawName = user?.name?.trim() || ''\n const hasRealName = rawName.length > 0 && !rawName.includes('@')\n const displayName = hasRealName ? formatFirstLast(rawName) : (user?.email ?? 'Signed in')\n const initials = (hasRealName ? rawName : (user?.email ?? 'P')).slice(0, 2).toUpperCase()\n const secondary = hasRealName\n ? user?.email || [user?.tier, user?.role].filter(Boolean).join(' · ') || 'member'\n : [user?.tier, user?.role].filter(Boolean).join(' · ') || 'member'\n // `title` / `subtitle` / `breadcrumbs` are no longer rendered here —\n // Reference/UI-Platform \"Page header\" moved the title into the main body\n // (22px below this bar) and retired the breadcrumb trail entirely. They\n // stay accepted on the prop type so apps mid-migration do not break the\n // build; the chrome just stops drawing them.\n void title\n void subtitle\n void breadcrumbs\n return (\n <div className=\"sticky top-0 z-20\">\n <header className=\"flex min-w-0 h-[var(--topbar-height,60px)] items-center justify-between gap-[8px] md:gap-[14px] border-b border-[color:var(--line)] bg-[color:var(--panel)] px-[var(--topbar-padding-x,20px)]\">\n {onOpenNav ? (\n <button\n type=\"button\"\n onClick={onOpenNav}\n aria-label=\"Open menu\"\n aria-expanded={navOpen ?? false}\n aria-controls=\"politogy-nav-drawer\"\n className={`${topBarIconButtonClass('default')} mr-1 shrink-0 md:hidden`}\n >\n <HamburgerIcon />\n </button>\n ) : null}\n\n {/* Universal search — the only thing on the left end of the bar. 320px\n (Reference/UI-Platform); below md it shrinks so the bar never pushes\n the page wider than a 390px phone. */}\n <label className=\"relative flex h-9 w-[320px] min-w-0 max-w-full shrink items-center md:shrink-0\">\n <SearchIcon className=\"pointer-events-none absolute left-[10px] h-[15px] w-[15px] text-[color:var(--muted)]\" />\n <input\n type=\"search\"\n placeholder={search?.placeholder ?? 'Search'}\n value={search?.value}\n onChange={search?.onChange ? (e) => search.onChange?.(e.target.value) : undefined}\n onKeyDown={\n search?.onSubmit\n ? (e) => {\n if (e.key === 'Enter') search.onSubmit?.((e.target as HTMLInputElement).value)\n }\n : undefined\n }\n readOnly={!search?.onChange}\n className=\"h-full w-full rounded-[5px] border border-[color:var(--line)] bg-[color:var(--surface-sunken,var(--panel-elevated))] pl-[33px] pr-10 text-[13px] text-[color:var(--foreground)] placeholder:text-[color:var(--muted)] focus:outline-none focus:ring-2 focus:ring-[color:var(--color-accent)]\"\n />\n <kbd\n aria-hidden\n className=\"pointer-events-none absolute right-[10px] hidden md:block rounded-[3px] border border-[color:var(--line)] px-[5px] py-px font-[family-name:var(--font-mono,ui-monospace,monospace)] text-[12px] leading-[1.2] text-[color:var(--muted)]\"\n >\n /\n </kbd>\n </label>\n\n <div className=\"relative ml-auto flex shrink-0 items-center gap-[var(--topbar-icon-gap,8px)]\">\n {/* Reference/UI-Platform \"Top bar — required elements\" (2026-10-03):\n there is no Build notes control. Rendered only if an app opts in. */}\n {buildNotes ? (\n <button\n type=\"button\"\n onClick={buildNotes?.onOpen}\n className=\"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-[5px] px-3 text-xs font-semibold text-[color:var(--muted)] transition hover:bg-[color:var(--surface-sunken,var(--panel-elevated))] hover:text-[color:var(--foreground)]\"\n >\n <BookOpenIcon />\n {buildNotes?.label ?? 'Build notes'}\n </button>\n ) : null}\n {actionsList && actionsList.length > 0\n ? actionsList.map((action) => (\n <NavTopBarActionButton key={action.key} action={action} />\n ))\n : null}\n {actions}\n {themeToggle}\n\n {/* My Account menu — avatar + name/email + chevron trigger, with the\n full account dropdown (profile/org links, roles, account switcher,\n appearance, sign out). Native <details> popover. Hidden when the\n shell draws the user card in the left-bar footer instead. */}\n {accountMenu === 'topbar' ? (\n <details data-nav-details className=\"group/acct relative\">\n <summary className=\"group/tbtip relative flex cursor-pointer list-none items-center gap-2.5 rounded-full py-1 pl-1 pr-2 transition hover:bg-[color:var(--panel-elevated)] [&::-webkit-details-marker]:hidden\">\n {/* Same circle size as every top-bar icon button (one shared var).\n Avatar precedence: photo → memoji → initials. */}\n <span className=\"flex h-[var(--topbar-icon-button-size,32px)] w-[var(--topbar-icon-button-size,32px)] items-center justify-center overflow-hidden rounded-full bg-[color:var(--color-accent-bg-safe,var(--color-accent))] text-xs font-bold text-[#FFFFFF]\">\n {user?.avatarUrl || user?.memojiUrl ? (\n <img\n src={(user.avatarUrl || user.memojiUrl) as string}\n alt=\"\"\n className=\"h-full w-full object-cover\"\n />\n ) : (\n initials\n )}\n </span>\n <span className=\"hidden flex-col leading-tight md:flex\">\n <span className=\"text-sm font-semibold text-[color:var(--foreground)]\">\n {displayName}\n </span>\n <span className=\"text-xs text-[color:var(--muted)]\">{secondary}</span>\n </span>\n <ChevronDown />\n <span className=\"group-open/acct:hidden\">\n <TopBarTooltip\n title=\"My Account\"\n description={\n <>\n {hasRealName ? rawName : user?.email ?? 'Signed in'}\n {user?.email ? (\n <>\n <br />\n {user.email}\n </>\n ) : null}\n <br />\n Profile, organizations, appearance and sign out.\n </>\n }\n />\n </span>\n </summary>\n {/*\n The menu grows with the user's data — roles, linked accounts, the\n theme control — and on a short viewport (or a user in many orgs) it\n ran past the bottom of the screen with no way to scroll, putting\n Sign out permanently out of reach. Cap the panel at the viewport,\n scroll the SECTIONS, and keep Sign out outside that scroll area so\n it is always on screen no matter how long the list gets.\n */}\n <NavAccountMenuPanel userMenu={userMenu} onSignOut={onSignOut} placement=\"below\" />\n </details>\n ) : null}\n {accountMenu === 'topbar' && !hasRealName && user ? (\n <NamePromptBubble profileHref={userMenu?.myProfileHref} />\n ) : null}\n </div>\n </header>\n {/* Brand gradient rule — Reference/UI-Platform \"Top bar → required\n elements\": \"A 3px strip of the brand gradient (blue → red) runs\n directly beneath it.\" Chrome-owned token, never the party-identity\n race-red. */}\n <div\n aria-hidden\n className=\"h-[3px] w-full shrink-0\"\n style={{\n background:\n 'var(--chrome-gradient, linear-gradient(to right, #007BFF, #A54B7A, #E63946))',\n }}\n />\n </div>\n )\n}\n\n/**\n * The account menu body — profile/org links, roles, account switcher,\n * appearance, navigation display, sign out. One definition drawn from two\n * triggers: the top-bar avatar (`placement=\"below\"`, legacy) and the left-bar\n * footer user card (`placement=\"above\"`, Reference/UI-Platform v30).\n */\nfunction NavAccountMenuPanel({\n userMenu,\n onSignOut,\n placement,\n}: {\n userMenu?: NavUserMenu\n onSignOut?: () => void\n placement: 'below' | 'above'\n}) {\n const rc = useRailCollapse()\n const wrapper =\n placement === 'above'\n ? rc('max-md:right-auto max-md:w-64') + ' absolute bottom-full left-0 right-0 z-40 mb-2 flex max-h-[calc(100vh-5rem)] flex-col overflow-hidden rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] py-1 text-[color:var(--foreground)] shadow-[var(--shadow-soft)]'\n : 'absolute right-0 z-30 mt-2 flex max-h-[calc(100vh-5rem)] w-72 flex-col overflow-hidden rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] py-1 shadow-[var(--shadow-soft)]'\n return (\n <div className={wrapper}>\n {placement === 'below' ? <TopBarPanelArrow /> : null}\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain\">\n {userMenu?.myProfileHref ? (\n <a\n href={safeHref(userMenu.myProfileHref)}\n className=\"flex w-full items-center gap-2.5 px-4 py-2.5 text-left text-sm font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)]\"\n >\n <ProfileIcon />\n My Profile\n </a>\n ) : null}\n {userMenu?.organizationSettingsHref ? (\n <a\n href={safeHref(userMenu.organizationSettingsHref)}\n className=\"flex w-full items-center gap-2.5 border-t border-[color:var(--line)] px-4 py-2.5 text-left text-sm font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)]\"\n >\n <BriefcaseIcon />\n Organization Settings\n </a>\n ) : null}\n\n {userMenu?.roles && userMenu.roles.length > 0 ? (\n <div className=\"border-t border-[color:var(--line)] px-4 py-3\">\n <p className=\"mb-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]\">\n Roles & Organizations\n </p>\n <ul className=\"flex flex-col gap-1.5\">\n {userMenu.roles.map((r, i) => (\n <li key={`${r.role}-${i}`} className=\"flex flex-wrap items-center gap-1.5 text-sm\">\n <span className=\"rounded-md bg-[color:var(--panel)] px-2 py-0.5 text-xs font-bold uppercase tracking-wide text-[color:var(--foreground)]\">\n {r.role}\n </span>\n {r.orgName ? (\n <span className=\"text-[color:var(--muted)]\">in {r.orgName}</span>\n ) : null}\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n\n {userMenu?.accounts && userMenu.accounts.length > 0 ? (\n <div className=\"border-t border-[color:var(--line)] px-4 py-3\">\n <p className=\"mb-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]\">\n Accounts\n </p>\n <ul className=\"flex flex-col gap-1\">\n {userMenu.accounts.map((a) => (\n <li key={a.id} className=\"flex items-center gap-2.5\">\n <button\n type=\"button\"\n onClick={() => {\n if (!a.active) userMenu.onSwitchAccount?.(a.id)\n }}\n className=\"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-1 py-1 text-left hover:bg-[color:var(--panel)]\"\n >\n <span className=\"flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-[color:var(--color-accent-bg-safe,var(--color-accent))] text-[11px] font-bold text-[#FFFFFF]\">\n {a.avatarUrl ? (\n <img src={a.avatarUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n (a.name ?? a.email ?? '?').slice(0, 2).toUpperCase()\n )}\n </span>\n <span className=\"flex min-w-0 flex-col leading-tight\">\n <span\n className={[\n 'truncate text-sm font-semibold',\n a.active\n ? 'text-[color:var(--color-accent-fg,var(--color-accent))]'\n : 'text-[color:var(--foreground)]',\n ].join(' ')}\n >\n {a.name ?? a.email ?? a.id.slice(0, 8)}\n </span>\n <span className=\"truncate text-xs text-[color:var(--muted)]\">\n {a.active ? 'Active' : a.email ?? ''}\n </span>\n </span>\n </button>\n {!a.active && userMenu.onRemoveAccount ? (\n <button\n type=\"button\"\n aria-label={`Remove ${a.name ?? a.email ?? 'account'}`}\n onClick={() => userMenu.onRemoveAccount?.(a.id)}\n className=\"shrink-0 rounded p-1 text-[color:var(--color-accent-fg,var(--color-accent))] hover:bg-[color:var(--panel)]\"\n >\n <TrashIcon />\n </button>\n ) : null}\n </li>\n ))}\n </ul>\n {userMenu.addAccountHref || userMenu.onAddAccount ? (\n userMenu.addAccountHref ? (\n <a\n href={safeHref(userMenu.addAccountHref)}\n className=\"mt-1.5 flex items-center gap-2.5 rounded-lg px-1 py-1.5 text-sm font-semibold text-[color:var(--color-accent-fg,var(--color-accent))] hover:bg-[color:var(--panel)]\"\n >\n <AddUserIcon />\n Add Account\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={userMenu.onAddAccount}\n className=\"mt-1.5 flex w-full items-center gap-2.5 rounded-lg px-1 py-1.5 text-left text-sm font-semibold text-[color:var(--color-accent-fg,var(--color-accent))] hover:bg-[color:var(--panel)]\"\n >\n <AddUserIcon />\n Add Account\n </button>\n )\n ) : null}\n </div>\n ) : null}\n\n {userMenu?.theme ? (\n <div className=\"border-t border-[color:var(--line)]\">\n <NavThemeControl\n value={userMenu.theme.value}\n onChange={userMenu.theme.onChange}\n />\n </div>\n ) : null}\n {userMenu?.navDisplay ? (\n <div className=\"border-t border-[color:var(--line)] px-4 py-3\">\n <p className=\"mb-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]\">\n Navigation display\n </p>\n <div role=\"radiogroup\" aria-label=\"Navigation display\" className=\"flex flex-col gap-0.5\">\n {NAV_DISPLAY_OPTIONS.map((opt) => (\n <button\n key={opt.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={userMenu.navDisplay?.value === opt.value}\n onClick={() => userMenu.navDisplay?.onChange(opt.value)}\n className={[\n 'flex w-full items-center justify-between rounded-md px-2 py-1.5 text-left text-sm font-medium',\n userMenu.navDisplay?.value === opt.value\n ? 'text-[color:var(--color-accent-fg,var(--color-accent))]'\n : 'text-[color:var(--foreground)] hover:bg-[color:var(--panel)]',\n ].join(' ')}\n >\n {opt.label}\n {userMenu.navDisplay?.value === opt.value ? <span aria-hidden>✓</span> : null}\n </button>\n ))}\n </div>\n </div>\n ) : null}\n </div>\n\n {onSignOut ? (\n <button\n type=\"button\"\n onClick={onSignOut}\n className=\"flex w-full shrink-0 items-center gap-2.5 border-t border-[color:var(--line)] px-4 py-2.5 text-left text-sm font-medium text-[color:var(--foreground)] hover:bg-[color:var(--panel)] hover:text-[color:var(--color-accent-fg,var(--color-accent))]\"\n >\n <SignOutIcon />\n Sign out\n </button>\n ) : null}\n </div>\n )\n}\n\n/**\n * Left-bar footer user card: 28px avatar · name · email · chevron-up. Opens\n * the account menu upward (Specs/Contacts design rail; UI-Platform v30 →\n * \"The user … lives in the left bar footer\").\n */\nfunction NavSidebarUserCard({\n user,\n userMenu,\n onSignOut,\n}: {\n user: NavUser\n userMenu?: NavUserMenu\n onSignOut?: () => void\n}) {\n const rawName = user.name?.trim() || ''\n const hasRealName = rawName.length > 0 && !rawName.includes('@')\n // Left-Navigation §10: \"First L.\" — first name plus last initial.\n const displayName = hasRealName ? shortUserName(rawName) : (user.email ?? 'Signed in')\n const initials = hasRealName\n ? rawName.split(/\\s+/).filter(Boolean).slice(0, 2).map((w) => w[0]).join('').toUpperCase()\n : (user.email ?? 'P').slice(0, 2).toUpperCase()\n const secondary = hasRealName\n ? user.email || [user.tier, user.role].filter(Boolean).join(' · ') || 'member'\n : [user.tier, user.role].filter(Boolean).join(' · ') || 'member'\n const rc = useRailCollapse()\n return (\n <details data-nav-details className=\"group/acct relative\">\n <summary\n aria-label=\"My Account\"\n className={`flex w-full cursor-pointer list-none items-center gap-[9px] rounded-[5px] px-1 py-1 text-left transition hover:bg-[color:var(--sidebar-row-hover-bg,var(--panel-elevated))] [&::-webkit-details-marker]:hidden ${rc('max-md:justify-center max-md:px-0')}`}\n >\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full bg-[color:var(--sidebar-avatar-bg,var(--color-accent-bg-safe,var(--color-accent)))] text-[11px] font-bold text-[#FFFFFF]\">\n {user.avatarUrl || user.memojiUrl ? (\n <img src={(user.avatarUrl || user.memojiUrl) as string} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n initials\n )}\n </span>\n <span className={`flex min-w-0 flex-1 flex-col ${rc('max-md:hidden')}`}>\n <span className=\"truncate text-[12px] font-semibold leading-[1.2] text-[color:var(--sidebar-text,var(--foreground))]\">\n {displayName}\n </span>\n <span className=\"truncate text-[11px] leading-[1.3] text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))]\">\n {secondary}\n </span>\n </span>\n <ChevronDown size={14} className={`shrink-0 rotate-180 text-[color:var(--sidebar-caption,var(--sidebar-text-muted,var(--muted)))] transition group-open/acct:rotate-0 ${rc('max-md:hidden')}`} />\n </summary>\n <NavAccountMenuPanel userMenu={userMenu} onSignOut={onSignOut} placement=\"above\" />\n {!hasRealName ? <NamePromptBubble profileHref={userMenu?.myProfileHref} placement=\"above\" /> : null}\n </details>\n )\n}\n\n/** `#RRGGBB` (+ optional alpha) → `rgba(r,g,b,a)`; undefined for anything else. */\nfunction hexToRgba(hex: string | null | undefined, alpha: number): string | undefined {\n if (!hex) return undefined\n const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim())\n if (!m) return undefined\n const n = parseInt(m[1], 16)\n return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`\n}\n\n/**\n * Floating, per-session-dismissable bubble under the account trigger that\n * prompts a user with no display name to set their first + last name. The\n * arrow points up at the avatar; dismissal is remembered in sessionStorage\n * until they actually set a name.\n */\nfunction NamePromptBubble({ profileHref, placement = 'below' }: { profileHref?: string; placement?: 'below' | 'above' }) {\n const KEY = 'politogy_name_prompt_dismissed'\n const [dismissed, setDismissed] = useState(true)\n useEffect(() => {\n try {\n setDismissed(sessionStorage.getItem(KEY) === '1')\n } catch {\n setDismissed(false)\n }\n }, [])\n if (dismissed) return null\n return (\n <div\n className={\n placement === 'above'\n ? 'absolute bottom-full left-0 z-30 mb-2 w-64 rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] p-3 text-left shadow-[var(--shadow-soft)]'\n : 'absolute right-4 top-full z-30 mt-2 w-64 rounded-xl border border-[color:var(--line)] bg-[color:var(--panel-elevated)] p-3 shadow-[var(--shadow-soft)]'\n }\n >\n <span\n aria-hidden\n className={\n placement === 'above'\n ? 'absolute -bottom-[5px] left-[14px] h-2.5 w-2.5 rotate-45 border-b border-r border-[color:var(--line)] bg-[color:var(--panel-elevated)]'\n : 'absolute -top-[5px] right-[11px] h-2.5 w-2.5 rotate-45 border-l border-t border-[color:var(--line)] bg-[color:var(--panel-elevated)]'\n }\n />\n <p className=\"text-sm font-semibold text-[color:var(--foreground)]\">\n Add your name\n </p>\n <p className=\"mt-0.5 text-xs leading-snug text-[color:var(--muted)]\">\n Set your first and last name so teammates see you — not your email.\n </p>\n <div className=\"mt-2 flex items-center gap-2\">\n {profileHref ? (\n <a\n href={safeHref(profileHref)}\n className=\"rounded-full bg-[color:var(--color-accent-bg-safe,var(--color-accent))] px-3 py-1 text-xs font-semibold text-[#FFFFFF] hover:opacity-90\"\n >\n Set name\n </a>\n ) : null}\n <button\n type=\"button\"\n onClick={() => {\n setDismissed(true)\n try {\n sessionStorage.setItem(KEY, '1')\n } catch {\n /* session-only dismiss */\n }\n }}\n className=\"rounded-full border border-[color:var(--line)] px-3 py-1 text-xs font-semibold text-[color:var(--foreground)] hover:bg-[color:var(--panel)]\"\n >\n Dismiss\n </button>\n </div>\n </div>\n )\n}\n\n/** \"Spencer Hill\" → \"Spencer H.\" — first name + last initial. */\nfunction formatFirstLast(name: string): string {\n const parts = name.split(/\\s+/).filter(Boolean)\n if (parts.length === 1) return parts[0]\n return `${parts[0]} ${parts[parts.length - 1][0].toUpperCase()}.`\n}\n\nfunction ProfileIcon() {\n return (\n <svg width={16} height={16} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\" />\n <circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n )\n}\n\nfunction BriefcaseIcon() {\n return (\n <svg width={16} height={16} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\" ry=\"2\" />\n <path d=\"M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16\" />\n </svg>\n )\n}\n\nfunction TrashIcon() {\n return (\n <svg width={14} height={14} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <polyline points=\"3 6 5 6 21 6\" />\n <path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />\n </svg>\n )\n}\n\nfunction AddUserIcon() {\n return (\n <svg width={16} height={16} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\" />\n <circle cx=\"8.5\" cy=\"7\" r=\"4\" />\n <line x1=\"20\" y1=\"8\" x2=\"20\" y2=\"14\" />\n <line x1=\"23\" y1=\"11\" x2=\"17\" y2=\"11\" />\n </svg>\n )\n}\n\n// Inline log-out glyph (mirrors lucide `LogOut`) to avoid an icon dependency.\nfunction SignOutIcon() {\n return (\n <svg\n width={15}\n height={15}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n )\n}\n\n// A single 32×32 circular icon button for the top bar's structured action list.\n// Renders an <a> when `href` is present (external links open in a new tab),\n// otherwise a <button>. Shows a red count badge when `badge > 0`.\nfunction NavTopBarActionButton({ action }: { action: NavTopBarAction }) {\n const Icon = action.icon\n // Universal treatment (Global Rules v9): size, color and hover are a single\n // shared value across every top-bar slot — only the glyph varies per slot.\n // Tone is a semantic state, not a bespoke per-slot style. The class comes\n // from the ONE shared builder in chromeActions so the data-backed widgets\n // and this structured list can never drift apart.\n const className = topBarIconButtonClass(action.tone ?? 'default')\n\n // Per-slot glyph from Brand; `icon` is the fallback until the token resolves.\n // Brand emits Feather/Lucide glyph NAMES, not asset paths.\n const glyphName = useTopBarIconSlotGlyph(action.slot ?? 'apps')\n const BrandGlyph = action.slot ? resolveBrandGlyph(glyphName) : null\n const Glyph = BrandGlyph ?? Icon\n\n const content = (\n <>\n <Glyph size={TOPBAR_GLYPH_SIZE} className=\"text-current\" />\n {typeof action.badge === 'number' && action.badge > 0 ? (\n <span className=\"absolute -top-[5px] -right-[5px] flex h-4 min-w-4 items-center justify-center rounded-full bg-[color:var(--chrome-danger,var(--color-accent))] px-1 text-[10px] font-bold leading-4 text-[#FFFFFF]\">\n {action.badge}\n </span>\n ) : null}\n <TopBarTooltip title={action.label} description={action.description} />\n </>\n )\n\n const isExternal = action.href ? /^https?:\\/\\//.test(action.href) : false\n\n if (action.href) {\n return (\n <a\n href={safeHref(action.href)}\n aria-label={action.label}\n className={className}\n {...(isExternal ? { target: '_blank', rel: 'noreferrer' } : {})}\n >\n {content}\n </a>\n )\n }\n\n return (\n <button\n type=\"button\"\n onClick={action.onClick}\n aria-label={action.label}\n className={className}\n >\n {content}\n </button>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Page tab strip — THE canonical page tab strip (shell 0.69.0).\n//\n// Brand guideline \"Tabs are an underlined strip\" (components-tabs-geometry):\n// a row of text tabs, each with an optional mono count pill, above a 1px G3\n// rule, with no folder or card chrome. Tabs are 13px semibold with 12px\n// vertical padding (12px / 8px when small). The selected tab is Graphite with\n// a 2px underline in the MODE COLOR (`modes.<mode>.primary`), read as\n// `--mode-accent` — never `modes.<mode>.accent`, which is white and only for\n// highlights on the dark rail. Unselected tabs are G4 and turn Graphite on\n// hover.\n//\n// It sits in the page body, below the page header, aligned to the content\n// gutter (Brand guideline \"UX Navigation\"). Apps render it inside the frame's\n// `children`; they never hand-roll or restyle a tab strip.\n//\n// Why this one and not the main entry's `HeaderTabBar` (now @deprecated): it\n// has no Chakra or react-router dependency, so every app can import it\n// whatever its framework; it renders `href` tabs through the app's own link\n// primitive, so sub-views are URL-addressable; and it already carries the\n// tablist / tab / disabled semantics. `HeaderTabBar` is icon-only by\n// construction (its label is only a tooltip) and state-only (no links).\n//\n// Colors come from the Brand `--tab-*` / `--color-*` vars emitted by\n// `/api/tokens?format=css`, with literal fallbacks so the strip still renders\n// before the runtime token sheet loads.\n// ---------------------------------------------------------------------------\n\nexport type NavTab = {\n /** Stable identity (used as the React key). */\n key: string\n /** The tab's visible text. */\n label: string\n /**\n * A Lucide icon rendered 6px left of the label (Reference/UI-Platform →\n * Tabs, decided 2026-10-06: \"Icon + label. Each tab is a Lucide icon.\"),\n * 15px / 1.75 stroke (13px on a small strip), following the label's\n * selected / unselected / hover color via `currentColor`. Icon-ONLY tabs\n * (no label) are retired — this always pairs with `label`.\n */\n icon?: NavIcon\n /** Optional count, drawn as a mono pill after the label. */\n count?: string | number | null\n /** Route to link to (rendered through `linkComponent`). */\n href?: string\n /** Click handler — rendered as a `<button>` when there's no `href`. */\n onSelect?: () => void\n /** Whether this tab is the active one (drives the mode-color underline). */\n selected?: boolean\n /**\n * Non-interactive, dimmed tab (e.g. Surveys' Canvas/Results before a survey\n * is chosen). Renders a non-navigating span; `disabledTitle` is the tooltip\n * explaining why.\n */\n disabled?: boolean\n disabledTitle?: string\n}\n\nexport type NavTabStripProps = {\n tabs: NavTab[]\n /** Accessible name for the tablist. */\n 'aria-label'?: string\n /** Routing primitive for `href` tabs (Next `<Link>`, etc). Defaults to <a>. */\n linkComponent?: NavLinkComponent\n /** `'sm'`: 12px text with 8px vertical padding. Default `'md'` (13px / 12px). */\n size?: 'md' | 'sm'\n /** Extra classes on the tablist container. */\n className?: string\n /**\n * Optional tab panel rendered directly below the strip, on the page\n * surface with no card chrome. Omit to render only the strip and compose\n * the page body yourself.\n */\n children?: ReactNode\n}\n\n/** The mode color on light surfaces (Reference/UI-Platform → Per-mode branding). */\nconst TAB_UNDERLINE_COLOR = 'var(--mode-accent, var(--color-accent))'\n\nfunction NavTabButton({\n tab,\n Link,\n size,\n}: {\n tab: NavTab\n Link: NavLinkComponent\n size: 'md' | 'sm'\n}) {\n const { label, icon: Icon, count, href, onSelect, selected, disabled, disabledTitle } = tab\n\n // The 2px underline sits on the strip's 1px rule (`-mb-px`), so the selected\n // tab's underline replaces the rule beneath it rather than stacking on it.\n // Color/border/text-align are set inline, not via arbitrary-bracket Tailwind\n // classes (`text-[color:var(...)]`) — a style-diff against design (Specs,\n // 2026-10-09, phonebank-dashboard-desktop) found a live color/border/align\n // mismatch, and a consuming app's Tailwind content scan not catching a\n // bracketed `var()`-with-fallback utility is a known failure mode for this\n // pattern (see UI-Platform `@source` contract). Inline styles can't be\n // dropped by a content scanner.\n const base = '-mb-px inline-flex shrink-0 items-center gap-2 font-semibold leading-none transition-colors'\n const sizeClass = size === 'sm' ? 'py-2 text-[12px]' : 'py-3 text-[13px]'\n const stateClass = disabled ? 'cursor-not-allowed opacity-50' : 'hover:text-[color:var(--tab-hover-color,#2F3136)]'\n const className = `${base} ${sizeClass} ${stateClass}`\n // Unselected/disabled tab text used --color-g4 (#929599), the Brand\n // content-neutral gray — correct for body copy but only 2.58-2.76:1 against\n // the tab strip's light surfaces, failing WCAG AA (4.5:1 minimum, axe scan\n // 2026-10-09, 26 violations). --tab-text-muted is a dedicated nav-tab token\n // (not a --color-g4 edit, which stays as-is for the rest of the Brand ramp)\n // defaulting to --muted (#5C6B80), already measured at 5.42:1 on the light\n // rail and ~4.8:1+ on the tab-row surfaces — same muted blue-gray family,\n // just dark enough to clear AA.\n const color = disabled\n ? 'var(--tab-text-muted,#5C6B80)'\n : selected\n ? 'var(--tab-selected-color,#2F3136)'\n : 'var(--tab-text-muted,#5C6B80)'\n // Design has NO border on an unselected tab (border-width/style 0/none),\n // not a 2px transparent one — a transparent-color border still reports a\n // non-zero width/solid style to a computed-style diff (Specs style_diff,\n // 2026-10-09, email-builder-desktop). Only the selected tab gets the 2px\n // underline.\n const style: CSSProperties =\n selected && !disabled\n ? {\n textAlign: 'center',\n borderBottomWidth: 2,\n borderBottomStyle: 'solid',\n borderBottomColor: TAB_UNDERLINE_COLOR,\n color,\n }\n : {\n textAlign: 'center',\n borderBottomWidth: 0,\n borderBottomStyle: 'none',\n borderBottomColor: 'transparent',\n color,\n }\n\n const iconSize = size === 'sm' ? 13 : 15\n const content = (\n <>\n {Icon ? (\n <Icon size={iconSize} className=\"shrink-0 text-current\" strokeWidth={1.75} />\n ) : null}\n <span>{label}</span>\n {count !== undefined && count !== null && count !== '' ? (\n <span className=\"rounded-full bg-[color:var(--color-g2,#ECEEEF)] px-1.5 py-0.5 font-[family-name:var(--font-mono,ui-monospace,monospace)] text-[11px] font-semibold leading-none\">\n {count}\n </span>\n ) : null}\n </>\n )\n\n // Disabled: non-navigating span, still exposed as a tab for AT.\n if (disabled) {\n return (\n <span\n role=\"tab\"\n aria-selected={false}\n aria-disabled=\"true\"\n aria-label={label}\n title={disabledTitle}\n className={className}\n style={style}\n >\n {content}\n </span>\n )\n }\n\n if (href) {\n return (\n <Link\n href={href}\n role=\"tab\"\n aria-selected={selected ? true : false}\n aria-label={label}\n className={className}\n style={style}\n >\n {content}\n </Link>\n )\n }\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={selected ? true : false}\n aria-label={label}\n onClick={onSelect}\n className={className}\n style={style}\n >\n {content}\n </button>\n )\n}\n\n/**\n * The canonical page tab strip: underlined text tabs on a 1px rule. Render it\n * in the page body below the page header; pass the app's `Link` as\n * `linkComponent` for `href` tabs.\n */\nexport function NavTabStrip({\n tabs,\n 'aria-label': ariaLabel,\n linkComponent,\n size = 'md',\n className,\n children,\n}: NavTabStripProps) {\n const Link = linkComponent ?? DefaultLink\n return (\n <>\n <div\n role=\"tablist\"\n aria-label={ariaLabel}\n className={[\n // 26px, not 24px: a style_diff against design (email-builder-desktop,\n // 2026-10-09) measured the rendered row gap 4px short of spec (48 vs\n // 52) at the 24px default.\n 'flex items-end gap-[var(--tab-gap,26px)] border-b border-[color:var(--tab-border-color,#D7DADF)]',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {tabs.map((tab) => (\n <NavTabButton key={tab.key} tab={tab} Link={Link} size={size} />\n ))}\n </div>\n {children !== undefined ? <div className=\"pt-5\">{children}</div> : null}\n </>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Beta banner — a full-width amber NOTICE strip rendered directly below the top\n// bar (a semantic notice, not a chrome surface, so it keeps its amber hue in\n// both themes via the --beta-banner-* tokens in chrome.css). One line, centered,\n// with a bold + underlined link to the Beta Terms & Conditions.\n// ---------------------------------------------------------------------------\n\nconst BETA_BANNER_DEFAULTS = {\n text: 'Our product is in Beta. Thank you for participating in the Pilot Program. ',\n linkLabel: 'You can click here to see the Terms & Conditions for Beta users.',\n href: 'https://app.politogyvrm.com/beta-terms-and-conditions',\n} as const\n\n/**\n * sessionStorage key holding the Beta-banner dismissal. sessionStorage — not\n * localStorage — so the dismissal lasts only for the browser session; and it is\n * additionally cleared on sign-out (see `clearBetaBannerDismissal`, called from\n * the chrome frame) so a fresh LOGIN always re-shows the notice.\n */\nexport const BETA_BANNER_DISMISS_KEY = 'politogy_beta_banner_dismissed'\n\n/**\n * Re-arm the Beta banner. The chrome frame calls this on sign-out so the notice\n * reappears at the next login rather than staying hidden across the boundary\n * (sessionStorage survives an in-tab logout→login round trip on its own).\n */\nexport function clearBetaBannerDismissal(): void {\n if (typeof window === 'undefined') return\n try {\n window.sessionStorage.removeItem(BETA_BANNER_DISMISS_KEY)\n } catch {\n /* storage unavailable (private mode / disabled) — nothing to clear */\n }\n}\n\nexport type NavBetaBannerProps = {\n /** Leading sentence(s) before the link. Defaults to the standard Beta copy. */\n text?: string\n /** Bold + underlined link label. Defaults to the standard Terms copy. */\n linkLabel?: string\n /** Terms & Conditions URL (opens in a new tab). Defaults to the app T&C page. */\n href?: string\n /**\n * Show a dismiss (×) button that hides the banner for the rest of the browser\n * session. Cleared on sign-out, so it returns at the next login. Default true.\n */\n dismissible?: boolean\n}\n\nexport function NavBetaBanner({ text, linkLabel, href, dismissible = true }: NavBetaBannerProps) {\n const body = text ?? BETA_BANNER_DEFAULTS.text\n const label = linkLabel ?? BETA_BANNER_DEFAULTS.linkLabel\n const target = href ?? BETA_BANNER_DEFAULTS.href\n\n // Start visible on both server and first client render (sessionStorage is not\n // readable during SSR), then hide in an effect if this session already\n // dismissed it — this keeps hydration markup identical and avoids a mismatch.\n const [dismissed, setDismissed] = useState(false)\n useEffect(() => {\n if (!dismissible) return\n try {\n if (window.sessionStorage.getItem(BETA_BANNER_DISMISS_KEY) === '1') setDismissed(true)\n } catch {\n /* storage unavailable — leave the banner visible */\n }\n }, [dismissible])\n\n if (dismissible && dismissed) return null\n\n const onDismiss = () => {\n setDismissed(true)\n try {\n window.sessionStorage.setItem(BETA_BANNER_DISMISS_KEY, '1')\n } catch {\n /* storage unavailable — banner still hides for this render */\n }\n }\n\n return (\n <div\n role=\"note\"\n className=\"relative w-full px-10 py-2 text-center text-sm\"\n style={{\n // Amber warning fill, matching the \"10DLC Registration Required\" notice\n // (HITL 2026-07-29). This used to fall through to `--color-accent`, the\n // brand RED, so a participation notice read as an error. The\n // --beta-banner-* tokens carry the amber defaults (chrome.css) and a\n // Brand edit still wins over them.\n background: 'var(--beta-banner-bg, #FEEBC8)',\n color: 'var(--beta-banner-text, #1A202C)',\n }}\n >\n <span>{body}</span>\n <a\n href={safeHref(target)}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-bold underline\"\n style={{ color: 'var(--beta-banner-text, #1A202C)' }}\n >\n {label}\n </a>\n {dismissible ? (\n <button\n type=\"button\"\n onClick={onDismiss}\n aria-label=\"Dismiss this notice\"\n title=\"Dismiss\"\n className=\"absolute right-2 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded text-base leading-none opacity-70 hover:opacity-100\"\n style={{ color: 'var(--beta-banner-text, #1A202C)' }}\n >\n ×\n </button>\n ) : null}\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n\nexport type NavAppShellProps = {\n sidebar: NavSidebarProps\n topBar: NavTopBarProps\n /**\n * When supplied, a full-width Beta notice strip renders directly below the top\n * bar. Presence of the prop enables it; all fields fall back to the standard\n * Beta copy + Terms & Conditions link.\n */\n betaBanner?: NavBetaBannerProps\n /**\n * @deprecated The frame's content area is one fluid `<main>` (Brand\n * guideline \"Content width is fluid\"): the 24px gutter (16px below `md`),\n * no max-width and no centered container. Apps never emit their own page\n * container, so there is nothing left to choose here.\n *\n * `'bare'` is still honored — it renders `children` with no `<main>` and no\n * gutter — only so VRM core, which renders `NavAppShell` directly around\n * pages that still carry their own `PageContainer`, does not get a nested\n * `<main>` before it migrates. It warns in development and will be removed.\n * `'padded'` is now the same as omitting the prop.\n */\n contentWrapper?: 'padded' | 'bare'\n /**\n * The operating Mode this frame is scoped to, stamped on the root as\n * `data-politogy-mode` so the Brand API's per-Mode chrome tokens can target\n * it (Reference/UI-Platform → \"Per-mode branding — one accent per Mode\").\n *\n * This is app IDENTITY, not app configuration: `PolitogyAppFrame` passes it\n * from the `POLITOGY_APPS` registry, never from a prop an app supplies, so an\n * app still cannot choose its own chrome colour.\n *\n * Omitted (or a Mode that declares no chrome group in the Brand API) => every\n * accent falls back to the global one, exactly as before 0.47.\n */\n modeId?: string\n /**\n * Where the user card / account menu renders. `'sidebar'` (default since\n * 0.68.0) draws it in the left-bar footer and hides the top-bar trigger\n * (Reference/UI-Platform v30); `'topbar'` restores the 0.67 top-right badge.\n */\n accountMenuPlacement?: 'sidebar' | 'topbar'\n children: ReactNode\n}\n\n/**\n * Full chrome: branded left sidebar + sticky top navbar + scrollable content\n * region. Presentational only — wrap it in app-level auth/gating as needed.\n */\n/**\n * Closes any open chrome <details data-nav-details> (org switcher, mode\n * selector, My Account) when the pointer lands outside it or Escape is\n * pressed — dropdowns must deselect on outside click (HITL 2026-07-23).\n */\nfunction useCloseNavDetailsOnOutsideClick() {\n useEffect(() => {\n const close = (target: Node | null) => {\n document.querySelectorAll('details[data-nav-details][open]').forEach((d) => {\n if (!target || !d.contains(target)) d.removeAttribute('open')\n })\n }\n const onPointerDown = (e: MouseEvent) => close(e.target as Node)\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') close(null)\n }\n document.addEventListener('mousedown', onPointerDown)\n document.addEventListener('keydown', onKey)\n return () => {\n document.removeEventListener('mousedown', onPointerDown)\n document.removeEventListener('keydown', onKey)\n }\n }, [])\n}\n\nexport function NavAppShell({\n sidebar,\n topBar,\n betaBanner,\n contentWrapper = 'padded',\n accountMenuPlacement = 'sidebar',\n modeId,\n children,\n}: NavAppShellProps) {\n useCloseNavDetailsOnOutsideClick()\n if (contentWrapper === 'bare') {\n warnDeprecated(\n 'contentWrapper',\n \"`contentWrapper: 'bare'` is deprecated: the frame's <main> is fluid and apps must not emit their own page container. Remove the app's PageContainer and drop the prop.\",\n )\n }\n // Below `md` the rail is the 64px icon rail (see NavSidebar). The shell owns\n // the expanded-drawer state so the hamburger (NavTopBar) and the drawer\n // (NavSidebar) can stay presentational.\n const [navOpen, setNavOpen] = useState(false)\n const expandRail = () => {\n writeRailPreference('expanded')\n setNavOpen(true)\n }\n const collapseRail = () => {\n writeRailPreference('collapsed')\n setNavOpen(false)\n }\n // Route navigation closes the drawer — a stale open drawer over a new page\n // reads as broken, not as \"still browsing\".\n useEffect(() => {\n setNavOpen(false)\n }, [sidebar.pathname])\n // Left-Navigation §11.6: the expand choice is remembered per user. Read it\n // back after mount (no hydration mismatch); it only applies below `md`,\n // where the rail is collapsed. Explicit Expand / Collapse writes it.\n useEffect(() => {\n if (readRailPreference() !== 'expanded') return\n const narrow =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia('(max-width: 767.98px)').matches\n : false\n if (narrow) setNavOpen(true)\n }, [])\n // The page behind a mobile drawer must not scroll while it's open.\n useEffect(() => {\n if (!navOpen) return\n const previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n return () => {\n document.body.style.overflow = previous\n }\n }, [navOpen])\n // The user card lives in the left-bar footer (UI-Platform v30). Lift the\n // top bar's user / menu / sign-out into the sidebar footer unless the app\n // already supplied them there or opted back into the top-bar badge.\n const sidebarFooter: NavFooter | null | undefined =\n accountMenuPlacement === 'sidebar' && topBar.user\n ? {\n ...(sidebar.footer ?? {}),\n user: sidebar.footer?.user ?? topBar.user,\n userMenu: sidebar.footer?.userMenu ?? topBar.userMenu,\n onSignOut: sidebar.footer?.onSignOut ?? topBar.onSignOut,\n }\n : sidebar.footer\n return (\n <div\n data-politogy-mode={modeId ?? modeIdFromLabel(sidebar.mode?.label)}\n className=\"min-h-screen bg-[color:var(--background)] text-[color:var(--foreground)]\"\n >\n {/* Cross-app sidebar nav speculation: every consumer rendering\n NavAppShell gets this for free (no per-app opt-in) — see\n src/speculation/SpeculationRulesScript.tsx. */}\n <SpeculationRulesScript items={sidebar.nav.items} />\n <NavSidebar\n {...sidebar}\n footer={sidebarFooter}\n open={navOpen}\n onClose={collapseRail}\n onOpen={expandRail}\n onNavigate={() => setNavOpen(false)}\n />\n {/* The rail is never hidden, so content is always offset by it: 64px\n below `md`, the full rail from `md` up. */}\n <div className=\"pl-[var(--sidebar-collapsed-width,64px)] md:pl-[var(--sidebar-width,236px)]\">\n <NavTopBar\n {...topBar}\n accountMenu={topBar.accountMenu ?? (accountMenuPlacement === 'sidebar' ? 'sidebar' : 'topbar')}\n />\n {betaBanner ? <NavBetaBanner {...betaBanner} /> : null}\n {/* Reference/UI-Platform \"Page header\": the title lives in the page\n body now, 22px below the top bar, not in the bar itself and never\n as a breadcrumb trail. Rendered here — above both wrapper modes —\n so a 'bare' app (which owns its own content furniture) still gets\n the required chrome-owned title line. */}\n {topBar.title ? (\n <h1 className=\"px-4 pt-7 text-xl font-semibold text-[color:var(--foreground)] md:px-6\">\n {topBar.title}\n </h1>\n ) : null}\n {contentWrapper === 'bare' ? (\n <div data-shell-content=\"\" className={topBar.title ? 'mt-[22px]' : undefined}>\n {children}\n </div>\n ) : (\n // Brand guidelines \"Content width is fluid\" + \"Content body\n // padding\": `<main>` fills the space beside the rail with ONE\n // gutter — 24px, or 16px below `md`, horizontally and vertically —\n // and has no max-width and no centered container. Form and settings\n // pages constrain themselves with <FormColumn> (960px, left-aligned).\n // The shell owns the page background and the gutter; an app's own\n // cards are its own furniture and stay app-owned.\n <main\n data-shell-content=\"\"\n className={`min-h-[calc(100vh-63px)] bg-[color:var(--chrome-page-bg,#F4F5F7)] px-4 pb-4 md:px-6 md:pb-6 ${topBar.title ? 'pt-[22px]' : 'pt-4 md:pt-6'}`}\n >\n {children}\n </main>\n )}\n </div>\n </div>\n )\n}\n\n// The one constrained layout inside the fluid <main>: a 960px left-aligned\n// column for form and settings pages. Re-exported here (as well as from the\n// main entry) so an app needs no Chakra / react-router peer to use it.\nexport { default as FormColumn } from '../components/FormColumn'\n\n// Canonical Politogy VRM menu — the standard nav structure every politogy app\n// renders, per operating Mode, with hooks for the app-owned \"Contacts\" item and\n// Support handler, plus the Campaign feature-availability config.\nexport {\n standardPolitogyNav,\n CAMPAIGN_FEATURE_AVAILABILITY,\n type StandardNavIconKey,\n type StandardNavOptions,\n type StandardNavMode,\n type CampaignFeatureAvailability,\n} from './standardNav'\n"]}
|