---
title: "Grouped Table · UI SDK — StyleX Blocks"
description: "Release backlog and change-request table bundling rows into collapsible status, priority, or team groups with per-group counts, expand/collapse-all, query search and release/priority filters, inline stage and priority pickers, a resizable Splitter inspector with readiness checklist and activity timeline, and narrow-screen drawer handoff."
url: "https://stylexblocks.com/block/ui-sdk/grouped-table/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Grouped Table block

Release backlog and change-request table bundling rows into collapsible status, priority, or team groups with per-group counts, expand/collapse-all, query search and release/priority filters, inline stage and priority pickers, a resizable Splitter inspector with readiness checklist and activity timeline, and narrow-screen drawer handoff.

- Behavior engine: UI SDK
- Category: [Data tables](https://stylexblocks.com/blocks/tables.md)
- Built with: [Alert Dialog](https://stylexblocks.com/components/ui-sdk/alert-dialog.md), [Avatar](https://stylexblocks.com/components/ui-sdk/avatar.md), [Badge](https://stylexblocks.com/components/ui-sdk/badge.md), [Button](https://stylexblocks.com/components/ui-sdk/button.md), [Center](https://stylexblocks.com/components/ui-sdk/center.md), [Checkbox](https://stylexblocks.com/components/ui-sdk/checkbox.md), [Data List](https://stylexblocks.com/components/ui-sdk/data-list.md), [Dialog](https://stylexblocks.com/components/ui-sdk/dialog.md), [Drawer](https://stylexblocks.com/components/ui-sdk/drawer.md), [Empty State](https://stylexblocks.com/components/ui-sdk/empty-state.md), [Grid](https://stylexblocks.com/components/ui-sdk/grid.md), [Heading](https://stylexblocks.com/components/ui-sdk/heading.md), [Icon](https://stylexblocks.com/components/ui-sdk/icon.md), [Icon Button](https://stylexblocks.com/components/ui-sdk/icon-button.md), [Input](https://stylexblocks.com/components/ui-sdk/input.md), [Menu](https://stylexblocks.com/components/ui-sdk/menu.md), [Segment Group](https://stylexblocks.com/components/ui-sdk/segment-group.md), [Select](https://stylexblocks.com/components/ui-sdk/select.md), [Separator](https://stylexblocks.com/components/ui-sdk/separator.md), [Splitter](https://stylexblocks.com/components/ui-sdk/splitter.md), [Stack](https://stylexblocks.com/components/ui-sdk/stack.md), [Status](https://stylexblocks.com/components/ui-sdk/status.md), [Table](https://stylexblocks.com/components/ui-sdk/table.md), [Tabs](https://stylexblocks.com/components/ui-sdk/tabs.md), [Text](https://stylexblocks.com/components/ui-sdk/text.md), [Textarea](https://stylexblocks.com/components/ui-sdk/textarea.md), [Timeline](https://stylexblocks.com/components/ui-sdk/timeline.md), [Toast](https://stylexblocks.com/components/ui-sdk/toast.md), [Visually Hidden](https://stylexblocks.com/components/ui-sdk/visually-hidden.md)
- HTML page: https://stylexblocks.com/block/ui-sdk/grouped-table/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init --style ui-sdk
```

Then add the item as source you own:

```sh
npx stylexblocks add grouped-table
```

Equivalent: `npx shadcn add @stylexblocks/grouped-table`. Registry item JSON: https://stylexblocks.com/r/ui-sdk/grouped-table.json

## Usage

```tsx
import { GroupedTable } from "#components/blocks/ui-sdk/grouped-table.tsx";

export function Example() {
  return (
    <div style={{ height: "100dvh" }}>
      <GroupedTable />
    </div>
  );
}
```

## Source

`components/blocks/ui-sdk/grouped-table.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { AlertDialog } from "#components/ui/ui-sdk/alert-dialog.tsx";
import { Avatar } from "#components/ui/ui-sdk/avatar.tsx";
import { Badge } from "#components/ui/ui-sdk/badge.tsx";
import { Button } from "#components/ui/ui-sdk/button.tsx";
import { Center } from "#components/ui/ui-sdk/center.tsx";
import { Checkbox } from "#components/ui/ui-sdk/checkbox.tsx";
import { DataList } from "#components/ui/ui-sdk/data-list.tsx";
import { Dialog } from "#components/ui/ui-sdk/dialog.tsx";
import { Drawer } from "#components/ui/ui-sdk/drawer.tsx";
import { EmptyState } from "#components/ui/ui-sdk/empty-state.tsx";
import { Grid } from "#components/ui/ui-sdk/grid.tsx";
import { Heading } from "#components/ui/ui-sdk/heading.tsx";
import { Icon } from "#components/ui/ui-sdk/icon.tsx";
import { IconButton } from "#components/ui/ui-sdk/icon-button.tsx";
import { Input } from "#components/ui/ui-sdk/input.tsx";
import { Menu } from "#components/ui/ui-sdk/menu.tsx";
import { SegmentGroup } from "#components/ui/ui-sdk/segment-group.tsx";
import { Select } from "#components/ui/ui-sdk/select.tsx";
import { Separator } from "#components/ui/ui-sdk/separator.tsx";
import { Splitter } from "#components/ui/ui-sdk/splitter.tsx";
import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";
import { Status } from "#components/ui/ui-sdk/status.tsx";
import { Table } from "#components/ui/ui-sdk/table.tsx";
import { Tabs } from "#components/ui/ui-sdk/tabs.tsx";
import { Text } from "#components/ui/ui-sdk/text.tsx";
import { Textarea } from "#components/ui/ui-sdk/textarea.tsx";
import { Timeline } from "#components/ui/ui-sdk/timeline.tsx";
import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";
import { VisuallyHidden } from "#components/ui/ui-sdk/visually-hidden.tsx";
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";
import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";
import {
  accentPalette,
  amberPalette,
  bluePalette,
  cyanPalette,
  grayPalette,
  greenPalette,
  indigoPalette,
  orangePalette,
  purplePalette,
  redPalette,
  tealPalette,
} from "@stylexblocks/ui/themes/palettes.ts";
import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";
import { fontSizes } from "@stylexblocks/ui/tokens/font-sizes.stylex.ts";
import { fontWeights } from "@stylexblocks/ui/tokens/font-weights.stylex.ts";
import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";
import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";
import { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

const NARROW = "@container grouped-table (max-width: 960px)";
const COMPACT = "@container grouped-table (max-width: 680px)";
const TIGHT = "@container grouped-table (max-width: 520px)";

export type ReleaseStage = "in_review" | "in_progress" | "queued" | "shipped";
export type ChangePriority = "critical" | "high" | "normal" | "low";
export type RiskLevel = "high" | "medium" | "low";
export type TeamName =
  | "Core Runtime"
  | "Edge Proxy"
  | "Storage Engine"
  | "Observability"
  | "SDK & CLI";
export type GroupByMode = "status" | "priority" | "team" | "none";

type AvatarTone = "indigo" | "teal" | "purple" | "blue" | "cyan" | "amber";

interface AssigneeProfile {
  name: string;
  initials: string;
  role: string;
  tone: AvatarTone;
}

interface ReadinessStep {
  id: string;
  label: string;
  done: boolean;
}

interface ActivityEvent {
  id: string;
  at: string;
  author: string;
  label: string;
  detail: string;
}

export interface ChangeRequest {
  id: string;
  code: string;
  title: string;
  subtitle: string;
  status: ReleaseStage;
  priority: ChangePriority;
  team: TeamName;
  release: string;
  risk: RiskLevel;
  componentTags: string[];
  assignee: AssigneeProfile;
  created: string;
  updated: string;
  summary: string;
  checklist: ReadinessStep[];
  activity: ActivityEvent[];
}

const ASSIGNEES: Record<string, AssigneeProfile> = {
  maren: {
    name: "Maren Solberg",
    initials: "MS",
    role: "Staff Runtime Engineer",
    tone: "indigo",
  },
  koji: {
    name: "Koji Watanabe",
    initials: "KW",
    role: "Edge Systems Lead",
    tone: "teal",
  },
  priya: {
    name: "Priya Deshmukh",
    initials: "PD",
    role: "Storage Architect",
    tone: "purple",
  },
  tomasz: {
    name: "Tomasz Kowalski",
    initials: "TK",
    role: "Observability Lead",
    tone: "cyan",
  },
  nadia: {
    name: "Nadia Okafor",
    initials: "NO",
    role: "SDK Maintainer",
    tone: "blue",
  },
  henrik: {
    name: "Henrik Lind",
    initials: "HL",
    role: "Release Engineer",
    tone: "amber",
  },
  camila: {
    name: "Camila Navarro",
    initials: "CN",
    role: "Principal SRE",
    tone: "teal",
  },
  darius: {
    name: "Darius Brooks",
    initials: "DB",
    role: "Compiler Engineer",
    tone: "indigo",
  },
};

const STAGE_ORDER: ReleaseStage[] = [
  "in_review",
  "in_progress",
  "queued",
  "shipped",
];

const STAGE_LABELS: Record<ReleaseStage, string> = {
  in_review: "In Review",
  in_progress: "In Progress",
  queued: "Queued",
  shipped: "Shipped",
};

const STAGE_PALETTES = {
  in_review: amberPalette,
  in_progress: bluePalette,
  queued: grayPalette,
  shipped: greenPalette,
} as const;

const NEXT_STAGE: Record<ReleaseStage, ReleaseStage> = {
  queued: "in_progress",
  in_progress: "in_review",
  in_review: "shipped",
  shipped: "in_progress",
};

const NEXT_STAGE_CTA: Record<ReleaseStage, string> = {
  queued: "Start implementation",
  in_progress: "Submit for review",
  in_review: "Approve & ship",
  shipped: "Reopen request",
};

const PRIORITY_ORDER: ChangePriority[] = ["critical", "high", "normal", "low"];

const PRIORITY_LABELS: Record<ChangePriority, string> = {
  critical: "Critical",
  high: "High",
  normal: "Normal",
  low: "Low",
};

const PRIORITY_PALETTES = {
  critical: redPalette,
  high: orangePalette,
  normal: bluePalette,
  low: grayPalette,
} as const;

const PRIORITY_LEVEL: Record<ChangePriority, number> = {
  critical: 4,
  high: 3,
  normal: 2,
  low: 1,
};

const RISK_LABELS: Record<RiskLevel, string> = {
  high: "High risk",
  medium: "Medium risk",
  low: "Low risk",
};

const RISK_PALETTES = {
  high: redPalette,
  medium: amberPalette,
  low: greenPalette,
} as const;

const TEAM_ORDER: TeamName[] = [
  "Core Runtime",
  "Edge Proxy",
  "Storage Engine",
  "Observability",
  "SDK & CLI",
];

const TEAM_PALETTES = {
  "Core Runtime": indigoPalette,
  "Edge Proxy": tealPalette,
  "Storage Engine": purplePalette,
  Observability: cyanPalette,
  "SDK & CLI": bluePalette,
} as const;

const AVATAR_PALETTES = {
  indigo: indigoPalette,
  teal: tealPalette,
  purple: purplePalette,
  blue: bluePalette,
  cyan: cyanPalette,
  amber: amberPalette,
} as const;

const RELEASES = ["v4.8", "v4.9", "v4.7"] as const;

const INITIAL_ITEMS: ChangeRequest[] = [
  {
    id: "vk-417",
    code: "VK-417",
    title: "Enforce zero-downtime shard handoff during quorum drain",
    subtitle: "Graceful leader lease transfer",
    status: "in_review",
    priority: "critical",
    team: "Core Runtime",
    release: "v4.8",
    risk: "high",
    componentTags: ["scheduler", "quorum", "zero-downtime"],
    assignee: ASSIGNEES.maren!,
    created: "Nov 26",
    updated: "2h ago",
    summary:
      "Transfers active shard leases to a pre-warmed follower before closing ingress sockets, preventing tail-latency spikes during rolling control-plane upgrades.",
    checklist: [
      { id: "c-417-1", label: "Chaos soak across 3-AZ staging cluster (24h)", done: true },
      { id: "c-417-2", label: "Verify write-fence token monotonicity on failover", done: true },
      { id: "c-417-3", label: "Confirm rollback path preserves uncommitted WAL frames", done: true },
      { id: "c-417-4", label: "Final sign-off from release engineering", done: false },
    ],
    activity: [
      {
        id: "a-417-1",
        at: "Today · 09:40",
        author: "Maren Solberg",
        label: "Submitted for release review",
        detail: "Attached 24h chaos-test trace showing p99 below 14ms during 60 node drains.",
      },
      {
        id: "a-417-2",
        at: "Yesterday · 17:15",
        author: "Camila Navarro",
        label: "Reviewed rollback guardrails",
        detail: "Requested explicit metric assertion for lease handoff timeouts > 250ms.",
      },
    ],
  },
  {
    id: "vk-416",
    code: "VK-416",
    title: "Enable HTTP/3 QUIC connection migration on regional PoPs",
    subtitle: "Dual-stack UDP listener rollout",
    status: "in_review",
    priority: "high",
    team: "Edge Proxy",
    release: "v4.8",
    risk: "medium",
    componentTags: ["quic", "edge-tls"],
    assignee: ASSIGNEES.koji!,
    created: "Nov 25",
    updated: "4h ago",
    summary:
      "Preserves active client streams when mobile devices switch between cellular and Wi-Fi by validating stateless path challenge frames across edge PoPs.",
    checklist: [
      { id: "c-416-1", label: "Canary 5% traffic in fra-01 and sjc-02", done: true },
      { id: "c-416-2", label: "Audit UDP amplification guard limits", done: true },
      { id: "c-416-3", label: "Update synthetic probes for Alt-Svc header", done: false },
    ],
    activity: [
      {
        id: "a-416-1",
        at: "Today · 07:55",
        author: "Koji Watanabe",
        label: "Canary metrics green",
        detail: "Handshake retry rate dropped 19% on roaming mobile cohorts in fra-01.",
      },
      {
        id: "a-416-2",
        at: "Nov 28 · 14:20",
        author: "Henrik Lind",
        label: "Assigned to v4.8 train",
        detail: "Scheduled for Stage 2 progressive rollout behind feature flag edge.quic_migrate.",
      },
    ],
  },
  {
    id: "vk-415",
    code: "VK-415",
    title: "Add incremental CRC64-NVMe verification to cold tier compaction",
    subtitle: "Block-level integrity audit",
    status: "in_review",
    priority: "high",
    team: "Storage Engine",
    release: "v4.8",
    risk: "high",
    componentTags: ["compaction", "checksums"],
    assignee: ASSIGNEES.priya!,
    created: "Nov 24",
    updated: "6h ago",
    summary:
      "Validates immutable SSTable segments using SIMD-accelerated CRC64-NVMe during background tiering to catch silent bit-rot before primary replicas expire.",
    checklist: [
      { id: "c-415-1", label: "Benchmark SIMD overhead (< 1.5% CPU budget)", done: true },
      { id: "c-415-2", label: "Verify backward compatibility with v4.7 manifests", done: true },
      { id: "c-415-3", label: "Dry-run quarantine workflow on corrupted fixture", done: false },
    ],
    activity: [
      {
        id: "a-415-1",
        at: "Today · 06:10",
        author: "Priya Deshmukh",
        label: "Benchmark summary uploaded",
        detail: "Measured 0.9% CPU overhead at 2.4 GB/s compaction throughput on ARM64 nodes.",
      },
    ],
  },
  {
    id: "vk-414",
    code: "VK-414",
    title: "Redesign OTLP trace tail-sampling budget allocator",
    subtitle: "Per-tenant fairness caps",
    status: "in_review",
    priority: "normal",
    team: "Observability",
    release: "v4.8",
    risk: "low",
    componentTags: ["otlp", "sampling"],
    assignee: ASSIGNEES.tomasz!,
    created: "Nov 23",
    updated: "1d ago",
    summary:
      "Replaces static per-collector span limits with weighted deficit round-robin quotas so bursty staging namespaces cannot starve production error traces.",
    checklist: [
      { id: "c-414-1", label: "Replay 48h production ingest fixture", done: true },
      { id: "c-414-2", label: "Document quota telemetry counters in runbook", done: true },
    ],
    activity: [
      {
        id: "a-414-1",
        at: "Yesterday · 16:02",
        author: "Tomasz Kowalski",
        label: "Ready for final approval",
        detail: "Zero high-severity error spans dropped under 4x simulated tenant burst.",
      },
    ],
  },
  {
    id: "vk-413",
    code: "VK-413",
    title: "Isolate tenant sandbox worker pools with cgroups v2 memory.high",
    subtitle: "Noisy-neighbor throttling",
    status: "in_progress",
    priority: "critical",
    team: "Core Runtime",
    release: "v4.8",
    risk: "high",
    componentTags: ["isolation", "cgroups"],
    assignee: ASSIGNEES.darius!,
    created: "Nov 22",
    updated: "3h ago",
    summary:
      "Applies soft memory ceilings ahead of hard OOM kills so bursty user-defined functions receive deterministic backpressure instead of abrupt process eviction.",
    checklist: [
      { id: "c-413-1", label: "Wire cgroups v2 controller probe on boot", done: true },
      { id: "c-413-2", label: "Emit memory pressure telemetry into worker status", done: true },
      { id: "c-413-3", label: "Tune reclaim grace window on 64-core compute hosts", done: false },
      { id: "c-413-4", label: "Run multi-tenant load certification", done: false },
    ],
    activity: [
      {
        id: "a-413-1",
        at: "Today · 08:30",
        author: "Darius Brooks",
        label: "Updated reclaim curve",
        detail: "Adjusted soft-throttle threshold from 80% to 85% to eliminate false stalls.",
      },
    ],
  },
  {
    id: "vk-412",
    code: "VK-412",
    title: "Streamline CLI auth refresh with PKCE local loopback callback",
    subtitle: "v4.8 developer ergonomics",
    status: "in_progress",
    priority: "high",
    team: "SDK & CLI",
    release: "v4.8",
    risk: "low",
    componentTags: ["cli", "oauth2", "pkce"],
    assignee: ASSIGNEES.nadia!,
    created: "Nov 21",
    updated: "5h ago",
    summary:
      "Replaces manual copy-paste device codes with an ephemeral 127.0.0.1 PKCE callback listener and encrypted OS keychain persistence across macOS, Linux, and Windows.",
    checklist: [
      { id: "c-412-1", label: "Implement ephemeral port listener with 90s timeout", done: true },
      { id: "c-412-2", label: "Keep headless device-code fallback for SSH sessions", done: true },
      { id: "c-412-3", label: "Verify macOS Keychain & SecretService integration tests", done: false },
    ],
    activity: [
      {
        id: "a-412-1",
        at: "Today · 06:45",
        author: "Nadia Okafor",
        label: "Added SSH fallback detection",
        detail: "Automatically falls back to device code flow when SSH_CONNECTION is present.",
      },
    ],
  },
  {
    id: "vk-411",
    code: "VK-411",
    title: "Compress Raft snapshot delta payloads using Zstandard dictionaries",
    subtitle: "Cross-region replication bandwidth",
    status: "in_progress",
    priority: "normal",
    team: "Storage Engine",
    release: "v4.9",
    risk: "medium",
    componentTags: ["raft", "compression"],
    assignee: ASSIGNEES.priya!,
    created: "Nov 20",
    updated: "1d ago",
    summary:
      "Trains per-schema Zstd dictionaries for metadata snapshots to cut inter-region egress volume by ~48% during cold replica catch-up.",
    checklist: [
      { id: "c-411-1", label: "Negotiate dictionary version in AppendEntries RPC", done: true },
      { id: "c-411-2", label: "Add fallback to plain Zstd when dictionary ID is absent", done: false },
      { id: "c-411-3", label: "Measure cross-AZ catch-up time on 50GB snapshot", done: false },
    ],
    activity: [
      {
        id: "a-411-1",
        at: "Yesterday · 13:12",
        author: "Priya Deshmukh",
        label: "RPC framing merged",
        detail: "Dictionary negotiation header landed behind storage.zstd_dict_v1.",
      },
    ],
  },
  {
    id: "vk-410",
    code: "VK-410",
    title: "Support mutual TLS client certificate pinning per custom domain",
    subtitle: "Enterprise ingress policy",
    status: "in_progress",
    priority: "high",
    team: "Edge Proxy",
    release: "v4.8",
    risk: "medium",
    componentTags: ["mtls", "certificates"],
    assignee: ASSIGNEES.camila!,
    created: "Nov 19",
    updated: "1d ago",
    summary:
      "Allows enterprise workspaces to upload up to four CA trust anchors per custom hostname with zero-downtime certificate rotation and revocation list caching.",
    checklist: [
      { id: "c-410-1", label: "Validate X.509 chain depth and expiry on upload", done: true },
      { id: "c-410-2", label: "Hot-reload trust store without dropping idle keepalives", done: false },
      { id: "c-410-3", label: "Security audit of CRL cache invalidation window", done: false },
    ],
    activity: [
      {
        id: "a-410-1",
        at: "Yesterday · 11:05",
        author: "Camila Navarro",
        label: "Trust anchor validator complete",
        detail: "Added strict rejection of SHA-1 intermediates and expired root bundles.",
      },
    ],
  },
  {
    id: "vk-409",
    code: "VK-409",
    title: "Emit structured JSON audit trails for RBAC policy mutations",
    subtitle: "SOC2 Type II evidence feed",
    status: "in_progress",
    priority: "normal",
    team: "Observability",
    release: "v4.8",
    risk: "low",
    componentTags: ["audit-log", "rbac"],
    assignee: ASSIGNEES.henrik!,
    created: "Nov 18",
    updated: "2d ago",
    summary:
      "Records before/after policy diffs, actor session fingerprints, and request correlation IDs into an append-only tamper-evident audit stream.",
    checklist: [
      { id: "c-409-1", label: "Define versioned audit schema v2", done: true },
      { id: "c-409-2", label: "Add S3 / SIEM webhook sink validation", done: false },
    ],
    activity: [
      {
        id: "a-409-1",
        at: "Nov 28 · 18:40",
        author: "Henrik Lind",
        label: "Schema frozen",
        detail: "Compliance team approved redaction rules for secret key digests.",
      },
    ],
  },
  {
    id: "vk-408",
    code: "VK-408",
    title: "Add typed streaming pagination helpers to TypeScript SDK",
    subtitle: "AsyncIterator cursor ergonomics",
    status: "queued",
    priority: "normal",
    team: "SDK & CLI",
    release: "v4.9",
    risk: "low",
    componentTags: ["typescript", "pagination"],
    assignee: ASSIGNEES.nadia!,
    created: "Nov 18",
    updated: "3d ago",
    summary:
      "Exposes `for await (const item of client.events.iterate())` with automatic retry backoff, AbortSignal cancellation, and strict cursor typing.",
    checklist: [
      { id: "c-408-1", label: "Draft RFC for iterator & page-level hooks", done: true },
      { id: "c-408-2", label: "Generate cursor helpers from OpenAPI spec", done: false },
      { id: "c-408-3", label: "Add AbortSignal leak tests under Node 22 & Bun", done: false },
    ],
    activity: [
      {
        id: "a-408-1",
        at: "Nov 27 · 10:05",
        author: "Nadia Okafor",
        label: "RFC approved",
        detail: "Queued for v4.9 sprint once PKCE CLI work lands.",
      },
    ],
  },
  {
    id: "vk-407",
    code: "VK-407",
    title: "Implement adaptive circuit breaker for upstream webhook targets",
    subtitle: "Per-endpoint health scoring",
    status: "queued",
    priority: "high",
    team: "Edge Proxy",
    release: "v4.9",
    risk: "medium",
    componentTags: ["webhooks", "resilience"],
    assignee: ASSIGNEES.koji!,
    created: "Nov 17",
    updated: "3d ago",
    summary:
      "Tracks rolling 5xx ratios and connection timeouts per subscriber host to short-circuit degraded destinations into a dead-letter retry queue.",
    checklist: [
      { id: "c-407-1", label: "Finalize half-open probe interval defaults", done: false },
      { id: "c-407-2", label: "Expose breaker state in workspace webhook diagnostics", done: false },
    ],
    activity: [
      {
        id: "a-407-1",
        at: "Nov 27 · 09:20",
        author: "Koji Watanabe",
        label: "Queued for v4.9",
        detail: "Scoped after reviewing last month's subscriber retry storm postmortem.",
      },
    ],
  },
  {
    id: "vk-406",
    code: "VK-406",
    title: "Introduce cold-start pre-warming for scheduled cron workers",
    subtitle: "Sub-20ms trigger dispatch",
    status: "queued",
    priority: "low",
    team: "Core Runtime",
    release: "v4.9",
    risk: "low",
    componentTags: ["cron", "cold-start"],
    assignee: ASSIGNEES.maren!,
    created: "Nov 16",
    updated: "4d ago",
    summary:
      "Pre-hydrates worker isolates 15 seconds ahead of high-frequency cron boundaries to eliminate JIT warm-up jitter on top-of-the-hour schedules.",
    checklist: [
      { id: "c-406-1", label: "Profile memory footprint of 500 warm isolates", done: false },
      { id: "c-406-2", label: "Add opt-in flag for latency-sensitive jobs", done: false },
    ],
    activity: [
      {
        id: "a-406-1",
        at: "Nov 26 · 15:10",
        author: "Maren Solberg",
        label: "Estimated effort",
        detail: "Sized as medium effort; waiting for v4.8 branch cut.",
      },
    ],
  },
  {
    id: "vk-405",
    code: "VK-405",
    title: "Support Prometheus native histogram ingestion in metrics collector",
    subtitle: "High-precision latency buckets",
    status: "queued",
    priority: "low",
    team: "Observability",
    release: "v4.9",
    risk: "low",
    componentTags: ["prometheus", "histograms"],
    assignee: ASSIGNEES.tomasz!,
    created: "Nov 15",
    updated: "5d ago",
    summary:
      "Accepts exponential native histograms over remote-write v2 so dashboards compute accurate p99.9 quantiles without maintaining fixed bucket boundaries.",
    checklist: [
      { id: "c-405-1", label: "Upgrade remote-write protobuf definitions", done: false },
      { id: "c-405-2", label: "Validate query engine merge semantics", done: false },
    ],
    activity: [
      {
        id: "a-405-1",
        at: "Nov 25 · 12:30",
        author: "Tomasz Kowalski",
        label: "Added to backlog",
        detail: "Tracked as part of Q1 telemetry modernization initiative.",
      },
    ],
  },
  {
    id: "vk-404",
    code: "VK-404",
    title: "Migrate metadata index locks to optimistic MVCC snapshots",
    subtitle: "Eliminate catalog write stalls",
    status: "shipped",
    priority: "critical",
    team: "Storage Engine",
    release: "v4.7",
    risk: "high",
    componentTags: ["mvcc", "indexing"],
    assignee: ASSIGNEES.priya!,
    created: "Nov 10",
    updated: "Nov 24",
    summary:
      "Replaced coarse-grained table locks with snapshot-isolated MVCC reads, cutting catalog query p99 latency from 185ms down to 11ms at peak deploy volume.",
    checklist: [
      { id: "c-404-1", label: "Verify serializable conflict detection suite", done: true },
      { id: "c-404-2", label: "Roll out across all 6 production regions", done: true },
      { id: "c-404-3", label: "Retire legacy lock-wait fallback path", done: true },
    ],
    activity: [
      {
        id: "a-404-1",
        at: "Nov 24 · 19:00",
        author: "Henrik Lind",
        label: "Shipped in v4.7.2",
        detail: "Promoted to 100% of production clusters with zero lock contention alerts.",
      },
    ],
  },
  {
    id: "vk-403",
    code: "VK-403",
    title: "Publish signed SBOM attestations for all CLI release binaries",
    subtitle: "SLSA Level 3 provenance",
    status: "shipped",
    priority: "high",
    team: "SDK & CLI",
    release: "v4.7",
    risk: "low",
    componentTags: ["supply-chain", "sbom"],
    assignee: ASSIGNEES.henrik!,
    created: "Nov 08",
    updated: "Nov 22",
    summary:
      "Generates CycloneDX SBOMs and Cosign keyless provenance bundles for every macOS, Linux, and Windows CLI artifact published to the release CDN.",
    checklist: [
      { id: "c-403-1", label: "Enable Sigstore verification in install script", done: true },
      { id: "c-403-2", label: "Publish verification instructions in release notes", done: true },
    ],
    activity: [
      {
        id: "a-403-1",
        at: "Nov 22 · 14:45",
        author: "Henrik Lind",
        label: "Shipped in v4.7.1",
        detail: "Verified attestations across 8 target triples on GitHub Releases.",
      },
    ],
  },
  {
    id: "vk-402",
    code: "VK-402",
    title: "Reduce edge WAF rule evaluation memory footprint by 40%",
    subtitle: "Compiled DFA matcher",
    status: "shipped",
    priority: "normal",
    team: "Edge Proxy",
    release: "v4.7",
    risk: "medium",
    componentTags: ["waf", "performance"],
    assignee: ASSIGNEES.koji!,
    created: "Nov 06",
    updated: "Nov 20",
    summary:
      "Compiled managed WAF regex groups into a compact shared DFA table, lowering per-worker RSS by 190 MB across high-density edge PoPs.",
    checklist: [
      { id: "c-402-1", label: "Differential fuzz 2M HTTP fixtures against legacy matcher", done: true },
      { id: "c-402-2", label: "Confirm zero false-positive regressions in shadow mode", done: true },
    ],
    activity: [
      {
        id: "a-402-1",
        at: "Nov 20 · 16:30",
        author: "Koji Watanabe",
        label: "Shipped in v4.7.0",
        detail: "Memory headroom reclaimed across all 34 global PoPs.",
      },
    ],
  },
  {
    id: "vk-401",
    code: "VK-401",
    title: "Expose per-route latency heatmaps in service topology API",
    subtitle: "Logarithmic bucket aggregation",
    status: "shipped",
    priority: "low",
    team: "Observability",
    release: "v4.7",
    risk: "low",
    componentTags: ["topology", "api"],
    assignee: ASSIGNEES.tomasz!,
    created: "Nov 04",
    updated: "Nov 18",
    summary:
      "Adds a compact DDSketch endpoint powering sub-second latency heatmaps for every RPC route in the Vektor service map.",
    checklist: [
      { id: "c-401-1", label: "Add OpenAPI schema & rate-limit tiers", done: true },
      { id: "c-401-2", label: "Verify 30-day rollup query stays under 80ms", done: true },
    ],
    activity: [
      {
        id: "a-401-1",
        at: "Nov 18 · 11:20",
        author: "Tomasz Kowalski",
        label: "Shipped in v4.7.0",
        detail: "Endpoint live for all workspaces on Growth and Enterprise plans.",
      },
    ],
  },
];

interface GroupBucket {
  key: string;
  label: string;
  items: ChangeRequest[];
}

const styles = stylex.create({
  root: {
    backgroundColor: semanticColors.bg,
    color: semanticColors.fg,
    containerName: "grouped-table",
    containerType: "inline-size",
    fontFamily: fonts.body,
    height: "100%",
    minHeight: "38rem",
    overflow: "hidden",
    width: "100%",
  },
  header: {
    backgroundColor: semanticColors.bgSurface,
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    flexShrink: 0,
    paddingBlock: spacing._3,
    paddingInline: spacing._4,
  },
  brandMark: {
    backgroundColor: semanticColors.bgInverted,
    borderRadius: radii.md,
    color: semanticColors.fgInverted,
    flexShrink: 0,
    height: "1.75rem",
    width: "1.75rem",
  },
  headerTitle: {
    marginBlock: 0,
  },
  nowrap: {
    whiteSpace: "nowrap",
  },
  noShrink: {
    flexShrink: 0,
  },
  toolbar: {
    backgroundColor: semanticColors.bgSurface,
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    flexShrink: 0,
    paddingBlock: spacing._2_5,
    paddingInline: spacing._4,
  },
  toolbarStart: {
    flexGrow: 1,
  },
  searchWrap: {
    flexBasis: "14rem",
    flexGrow: 1,
    maxWidth: {
      default: "22rem",
      [COMPACT]: "100%",
    },
    minWidth: "11rem",
    position: "relative",
  },
  searchIcon: {
    color: semanticColors.fgSubtle,
    display: "inline-flex",
    insetInlineStart: spacing._2_5,
    pointerEvents: "none",
    position: "absolute",
    top: "50%",
    transform: "translateY(-50%)",
    zIndex: 1,
  },
  searchInput: {
    paddingInlineEnd: spacing._8,
    paddingInlineStart: spacing._8,
  },
  searchClearBtn: {
    color: semanticColors.fgMuted,
    insetInlineEnd: spacing._1,
    position: "absolute",
    top: "50%",
    transform: "translateY(-50%)",
  },
  filterSelect: {
    flexShrink: 0,
    width: "8.75rem",
  },
  groupByLabel: {
    display: { default: "inline", [TIGHT]: "none" },
    whiteSpace: "nowrap",
  },
  workspace: {
    display: "flex",
    flexGrow: 1,
    minHeight: 0,
    width: "100%",
  },
  tablePane: {
    display: "flex",
    flexDirection: "column",
    flexGrow: 1,
    height: "100%",
    minHeight: 0,
    minWidth: 0,
  },
  tableScroll: {
    flexGrow: 1,
    minHeight: 0,
    overflowX: "auto",
    overflowY: "auto",
    width: "100%",
  },
  tableRoot: {
    minWidth: "100%",
    tableLayout: "fixed",
  },
  tableHeaderRow: {
    backgroundColor: semanticColors.bgSurface,
    position: "sticky",
    top: 0,
    zIndex: 2,
  },
  tableHeaderCell: {
    backgroundColor: semanticColors.bgSurface,
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    color: semanticColors.fgSubtle,
    fontSize: fontSizes.xs,
    fontWeight: fontWeights.semibold,
    letterSpacing: "0.02em",
    paddingBlock: spacing._2,
    paddingInline: spacing._2_5,
    whiteSpace: "nowrap",
  },
  colStatus: {
    paddingInlineEnd: spacing._1,
    paddingInlineStart: spacing._3_5,
    width: "2.75rem",
  },
  colPriority: {
    paddingInline: spacing._1,
    width: "2.5rem",
  },
  colTitle: {
    width: "auto",
  },
  colTeam: {
    display: { default: "table-cell", [COMPACT]: "none" },
    width: "8.5rem",
  },
  colRelease: {
    display: { default: "table-cell", [TIGHT]: "none" },
    width: "4.75rem",
  },
  colRisk: {
    display: { default: "table-cell", [NARROW]: "none" },
    width: "6.5rem",
  },
  colAssignee: {
    paddingInline: spacing._2,
    textAlign: "center",
    width: "3.5rem",
  },
  colActions: {
    paddingInlineEnd: spacing._3,
    paddingInlineStart: spacing._1,
    textAlign: "end",
    width: "2.75rem",
  },
  groupRow: {
    backgroundColor: semanticColors.bgMuted,
  },
  groupCell: {
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    paddingBlock: 0,
    paddingInline: 0,
  },
  groupToggleBtn: {
    alignItems: "center",
    appearance: "none",
    backgroundColor: {
      default: "transparent",
      ":hover": semanticColors.interactionHover,
    },
    borderStyle: "none",
    borderWidth: 0,
    color: semanticColors.fg,
    cursor: "pointer",
    display: "flex",
    fontFamily: fonts.body,
    gap: spacing._2,
    justifyContent: "space-between",
    paddingBlock: spacing._2,
    paddingInlineEnd: spacing._3_5,
    paddingInlineStart: spacing._3_5,
    textAlign: "start",
    transitionDuration: durations.fast,
    transitionProperty: "background-color",
    width: "100%",
  },
  chevron: {
    color: semanticColors.fgSubtle,
    display: "inline-flex",
    flexShrink: 0,
    transform: "rotate(0deg)",
    transitionDuration: durations.fast,
    transitionProperty: "transform",
  },
  chevronCollapsed: {
    transform: "rotate(-90deg)",
  },
  groupLabelText: {
    letterSpacing: "0.01em",
  },
  dataRow: {
    backgroundColor: {
      default: "transparent",
      ":hover": semanticColors.interactionHover,
    },
    cursor: "pointer",
    transitionDuration: durations.fast,
    transitionProperty: "background-color",
  },
  dataRowSelected: {
    backgroundColor: {
      default: semanticColors.interactionSelected,
      ":hover": semanticColors.interactionSelected,
    },
    boxShadow: `inset 2px 0 0 0 ${semanticColors.accentSolid}`,
  },
  dataCell: {
    borderBottomColor: semanticColors.borderMuted,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    paddingBlock: spacing._2_5,
    paddingInline: spacing._2_5,
    verticalAlign: "middle",
  },
  titleCellWrap: {
    overflow: "hidden",
  },
  rowTitleButton: {
    appearance: "none",
    backgroundColor: "transparent",
    borderStyle: "none",
    borderWidth: 0,
    color: semanticColors.fg,
    cursor: "pointer",
    fontFamily: fonts.body,
    fontSize: fontSizes.sm,
    fontWeight: fontWeights.medium,
    lineHeight: lineHeights.sm,
    minWidth: 0,
    overflow: "hidden",
    paddingBlock: 0,
    paddingInline: 0,
    textAlign: "start",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap",
  },
  rowSubtitle: {
    display: { default: "inline", [COMPACT]: "none" },
    flexShrink: 1,
  },
  menuWidth: {
    minWidth: "10.5rem",
  },
  tableFooter: {
    backgroundColor: semanticColors.bgSurface,
    borderTopColor: semanticColors.border,
    borderTopStyle: "solid",
    borderTopWidth: "1px",
    color: semanticColors.fgMuted,
    flexShrink: 0,
    fontSize: fontSizes.xs,
    paddingBlock: spacing._2,
    paddingInline: spacing._4,
  },
  footerMetrics: {
    fontVariantNumeric: "tabular-nums",
  },
  inspectorHandle: {
    display: { default: "grid", [NARROW]: "none" },
  },
  inspectorPanel: {
    backgroundColor: semanticColors.bgSurface,
    display: { default: "flex", [NARROW]: "none" },
    flexDirection: "column",
    height: "100%",
    minHeight: 0,
    minWidth: 0,
    overflowY: "auto",
  },
  inspectorInner: {
    paddingBlock: spacing._4,
    paddingInline: spacing._4,
  },
  inspectorHeading: {
    marginBlock: 0,
  },
  dataListLabel: {
    flexShrink: 0,
    width: "5.5rem",
  },
  tabsList: {
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    width: "100%",
  },
  tabPanel: {
    display: "flex",
    flexDirection: "column",
    gap: spacing._4,
    paddingBlockEnd: 0,
    paddingBlockStart: spacing._3_5,
    paddingInline: 0,
  },
  checklistItem: {
    alignItems: "flex-start",
    backgroundColor: semanticColors.bgMuted,
    borderColor: semanticColors.borderSubtle,
    borderRadius: semanticRadii.control,
    borderStyle: "solid",
    borderWidth: "1px",
    display: "flex",
    paddingBlock: spacing._2,
    paddingInline: spacing._2_5,
  },
  checklistLabelDone: {
    color: semanticColors.fgMuted,
    textDecoration: "line-through",
  },
  timelineHeader: {
    width: "100%",
  },
  timelineTime: {
    marginInlineStart: "auto",
  },
  timelineLastContent: {
    paddingBottom: 0,
  },
  drawerContent: {
    maxHeight: "82dvh",
  },
  drawerHeader: {
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    paddingBlock: spacing._3,
    paddingInline: spacing._4,
  },
  drawerBody: {
    paddingBlock: 0,
    paddingInline: 0,
  },
  priorityBars: {
    alignItems: "flex-end",
    display: "inline-flex",
    gap: "2px",
    height: "12px",
  },
  priorityBar: {
    backgroundColor: semanticColors.borderEmphasized,
    borderRadius: "1px",
    width: "2.5px",
  },
  priorityBarActiveCritical: {
    backgroundColor: semanticColors.redSolid,
  },
  priorityBarActiveHigh: {
    backgroundColor: semanticColors.orangeSolid,
  },
  priorityBarActiveNormal: {
    backgroundColor: semanticColors.blueSolid,
  },
  priorityBarActiveLow: {
    backgroundColor: semanticColors.fgSubtle,
  },
  barH1: { height: "4px" },
  barH2: { height: "7px" },
  barH3: { height: "10px" },
  barH4: { height: "12px" },
});

function LayersLogoIcon() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.7"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M10 3.2 17 6.8 10 10.4 3 6.8 10 3.2Z" />
      <path d="M3 10.2 10 13.8 17 10.2" />
      <path d="M3 13.6 10 17.2 17 13.6" />
    </Icon>
  );
}

function SearchIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.6"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <circle cx="7.2" cy="7.2" r="4.6" />
      <path d="m10.8 10.8 2.9 2.9" />
    </Icon>
  );
}

function PlusIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      aria-hidden="true"
    >
      <path d="M8 3.2v9.6M3.2 8h9.6" />
    </Icon>
  );
}

function CloseIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.7"
      strokeLinecap="round"
      aria-hidden="true"
    >
      <path d="m4 4 8 8m0-8-8 8" />
    </Icon>
  );
}

function ChevronDownIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.7"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="m4.2 6.2 3.8 3.8 3.8-3.8" />
    </Icon>
  );
}

function MoreHorizontalIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="currentColor"
      aria-hidden="true"
    >
      <circle cx="3.5" cy="8" r="1.2" />
      <circle cx="8" cy="8" r="1.2" />
      <circle cx="12.5" cy="8" r="1.2" />
    </Icon>
  );
}

function CollapseAllIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.5"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="m5 4.2 3 2.8 3-2.8" />
      <path d="m5 11.8 3-2.8 3 2.8" />
    </Icon>
  );
}

function ExpandAllIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.5"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="m5 6.5 3-2.8 3 2.8" />
      <path d="m5 9.5 3 2.8 3-2.8" />
    </Icon>
  );
}

function SendIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.6"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M14 2 7.2 8.8" />
      <path d="M14 2 9.6 14 7.2 8.8 2 6.4 14 2Z" />
    </Icon>
  );
}

function TrashIcon() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.6"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M3.5 5.5h13" />
      <path d="M8 3.2h4" />
      <path d="M5.5 5.5l.8 10.2a1.5 1.5 0 0 0 1.5 1.3h4.4a1.5 1.5 0 0 0 1.5-1.3l.8-10.2" />
      <path d="M8.5 9v4.5M11.5 9v4.5" />
    </Icon>
  );
}

function PriorityBars({ priority }: { priority: ChangePriority }) {
  const level = PRIORITY_LEVEL[priority];
  const activeStyle =
    priority === "critical"
      ? styles.priorityBarActiveCritical
      : priority === "high"
        ? styles.priorityBarActiveHigh
        : priority === "normal"
          ? styles.priorityBarActiveNormal
          : styles.priorityBarActiveLow;

  return (
    <span {...stylex.props(styles.priorityBars)} aria-hidden="true">
      <span {...stylex.props(styles.priorityBar, styles.barH1, level >= 1 && activeStyle)} />
      <span {...stylex.props(styles.priorityBar, styles.barH2, level >= 2 && activeStyle)} />
      <span {...stylex.props(styles.priorityBar, styles.barH3, level >= 3 && activeStyle)} />
      <span {...stylex.props(styles.priorityBar, styles.barH4, level >= 4 && activeStyle)} />
    </span>
  );
}

interface ChangeRequestInspectorProps {
  item: ChangeRequest;
  noteDraft: string;
  showCloseButton: boolean;
  onClose: () => void;
  onNoteDraftChange: (value: string) => void;
  onChangeStatus: (id: string, nextStatus: ReleaseStage) => void;
  onChangePriority: (id: string, nextPriority: ChangePriority) => void;
  onDuplicate: (item: ChangeRequest) => void;
  onRequestDelete: (item: ChangeRequest) => void;
  onToggleStep: (itemId: string, stepId: string) => void;
  onAddNote: (itemId: string) => void;
}

function ChangeRequestInspector({
  item,
  noteDraft,
  showCloseButton,
  onClose,
  onNoteDraftChange,
  onChangeStatus,
  onChangePriority,
  onDuplicate,
  onRequestDelete,
  onToggleStep,
  onAddNote,
}: ChangeRequestInspectorProps) {
  const completedSteps = item.checklist.filter((step) => step.done).length;
  const totalSteps = item.checklist.length;

  return (
    <VStack gap="4" style={styles.inspectorInner}>
      <HStack justify="between" gap="2">
        <HStack wrap="wrap" gap="2">
          <Text
            render={<span />}
            variant="mono"
            size="xs"
            tone="muted"
            weight="medium"
            tabular="true"
            style={styles.noShrink}
          >
            {item.code}
          </Text>
          <Badge variant="subtle" size="sm" palette={STAGE_PALETTES[item.status]}>
            {STAGE_LABELS[item.status]}
          </Badge>
          <Badge variant="subtle" size="sm" palette={RISK_PALETTES[item.risk]}>
            {RISK_LABELS[item.risk]}
          </Badge>
        </HStack>
        {showCloseButton ? (
          <IconButton
            variant="ghost"
            size="xs"
            aria-label="Close inspector"
            onClick={onClose}
          >
            <CloseIcon />
          </IconButton>
        ) : null}
      </HStack>

      <VStack gap="1">
        <Heading render={<h2 />} size="lg" style={styles.inspectorHeading}>
          {item.title}
        </Heading>
        {item.subtitle ? (
          <Text size="sm" variant="muted">
            {item.subtitle}
          </Text>
        ) : null}
      </VStack>

      <HStack wrap="wrap" gap="2">
        <Button
          variant="solid"
          size="sm"
          palette={
            item.status === "in_review"
              ? greenPalette
              : item.status === "shipped"
                ? grayPalette
                : accentPalette
          }
          onClick={() => onChangeStatus(item.id, NEXT_STAGE[item.status])}
        >
          {NEXT_STAGE_CTA[item.status]}
        </Button>
        <Button variant="surface" size="sm" onClick={() => onDuplicate(item)}>
          Duplicate
        </Button>
        <Button
          variant="ghost"
          size="sm"
          palette={redPalette}
          onClick={() => onRequestDelete(item)}
        >
          Delete
        </Button>
      </HStack>

      <Grid columns="2" gap="3">
        <VStack gap="1">
          <Text render={<span />} size="xs" variant="muted" weight="medium">
            Stage
          </Text>
          <Select.Root
            size="sm"
            variant="outline"
            value={item.status}
            onValueChange={(next) => {
              if (
                next === "in_review" ||
                next === "in_progress" ||
                next === "queued" ||
                next === "shipped"
              ) {
                onChangeStatus(item.id, next);
              }
            }}
          >
            <Select.Control>
              <Select.Trigger aria-label="Change stage">
                <Select.Value>{STAGE_LABELS[item.status]}</Select.Value>
              </Select.Trigger>
              <Select.IndicatorGroup>
                <Select.Icon />
              </Select.IndicatorGroup>
            </Select.Control>
            <Select.Content>
              {STAGE_ORDER.map((stage) => (
                <Select.Item key={stage} value={stage}>
                  <Select.ItemText>{STAGE_LABELS[stage]}</Select.ItemText>
                  <Select.ItemIndicator />
                </Select.Item>
              ))}
            </Select.Content>
          </Select.Root>
        </VStack>

        <VStack gap="1">
          <Text render={<span />} size="xs" variant="muted" weight="medium">
            Priority
          </Text>
          <Select.Root
            size="sm"
            variant="outline"
            value={item.priority}
            onValueChange={(next) => {
              if (
                next === "critical" ||
                next === "high" ||
                next === "normal" ||
                next === "low"
              ) {
                onChangePriority(item.id, next);
              }
            }}
          >
            <Select.Control>
              <Select.Trigger aria-label="Change priority">
                <Select.Value>{PRIORITY_LABELS[item.priority]}</Select.Value>
              </Select.Trigger>
              <Select.IndicatorGroup>
                <Select.Icon />
              </Select.IndicatorGroup>
            </Select.Control>
            <Select.Content>
              {PRIORITY_ORDER.map((prio) => (
                <Select.Item key={prio} value={prio}>
                  <Select.ItemText>{PRIORITY_LABELS[prio]}</Select.ItemText>
                  <Select.ItemIndicator />
                </Select.Item>
              ))}
            </Select.Content>
          </Select.Root>
        </VStack>
      </Grid>

      <Separator />

      <DataList.Root size="sm" variant="subtle" orientation="horizontal">
        <DataList.Item>
          <DataList.ItemLabel style={styles.dataListLabel}>Assignee</DataList.ItemLabel>
          <DataList.ItemValue>
            <HStack gap="2">
              <Avatar.Root
                size="2xs"
                variant="subtle"
                palette={AVATAR_PALETTES[item.assignee.tone]}
              >
                <Avatar.Fallback>{item.assignee.initials}</Avatar.Fallback>
              </Avatar.Root>
              <span>{item.assignee.name}</span>
            </HStack>
          </DataList.ItemValue>
        </DataList.Item>
        <DataList.Item>
          <DataList.ItemLabel style={styles.dataListLabel}>Team</DataList.ItemLabel>
          <DataList.ItemValue>
            <Badge variant="surface" size="xs" palette={TEAM_PALETTES[item.team]}>
              {item.team}
            </Badge>
          </DataList.ItemValue>
        </DataList.Item>
        <DataList.Item>
          <DataList.ItemLabel style={styles.dataListLabel}>Release</DataList.ItemLabel>
          <DataList.ItemValue>
            <Text render={<span />} variant="mono" size="xs" tone="muted" tabular="true">
              {item.release}
            </Text>
          </DataList.ItemValue>
        </DataList.Item>
        <DataList.Item>
          <DataList.ItemLabel style={styles.dataListLabel}>Updated</DataList.ItemLabel>
          <DataList.ItemValue>
            {item.updated} · created {item.created}
          </DataList.ItemValue>
        </DataList.Item>
        {item.componentTags.length > 0 ? (
          <DataList.Item>
            <DataList.ItemLabel style={styles.dataListLabel}>Components</DataList.ItemLabel>
            <DataList.ItemValue>
              <HStack wrap="wrap" gap="1.5">
                {item.componentTags.map((tag) => (
                  <Badge key={tag} variant="outline" size="xs" palette={grayPalette}>
                    {tag}
                  </Badge>
                ))}
              </HStack>
            </DataList.ItemValue>
          </DataList.Item>
        ) : null}
      </DataList.Root>

      <Separator />

      <Tabs.Root defaultValue="readiness" variant="line" size="sm" palette={accentPalette}>
        <Tabs.List aria-label="Change request inspector sections" style={styles.tabsList}>
          <Tabs.Tab value="readiness">
            Readiness
            <Badge
              variant="subtle"
              size="xs"
              palette={
                totalSteps > 0 && completedSteps === totalSteps
                  ? greenPalette
                  : grayPalette
              }
            >
              {completedSteps}/{totalSteps}
            </Badge>
          </Tabs.Tab>
          <Tabs.Tab value="activity">
            Activity
            <Badge variant="subtle" size="xs" palette={grayPalette}>
              {item.activity.length}
            </Badge>
          </Tabs.Tab>
        </Tabs.List>

        <Tabs.Panel value="readiness" style={styles.tabPanel}>
          <Text size="sm" variant="muted">
            {item.summary}
          </Text>

          <HStack justify="between" gap="2">
            <Text render={<span />} variant="overline">
              Release checklist
            </Text>
            <Text render={<span />} size="xs" tone="subtle" tabular="true">
              {completedSteps} of {totalSteps} complete
            </Text>
          </HStack>

          <VStack gap="2">
            {item.checklist.map((step) => (
              <div key={step.id} {...stylex.props(styles.checklistItem)}>
                <Checkbox.Root size="sm" variant="solid" palette={accentPalette}>
                  <Checkbox.Control
                    checked={step.done}
                    onCheckedChange={() => onToggleStep(item.id, step.id)}
                  />
                  <Checkbox.Label style={step.done ? styles.checklistLabelDone : undefined}>
                    {step.label}
                  </Checkbox.Label>
                </Checkbox.Root>
              </div>
            ))}
          </VStack>
        </Tabs.Panel>

        <Tabs.Panel value="activity" style={styles.tabPanel}>
          <VStack
            render={
              <form
                onSubmit={(event) => {
                  event.preventDefault();
                  onAddNote(item.id);
                }}
              />
            }
            gap="2"
          >
            <Textarea
              size="sm"
              rows={2}
              placeholder="Add a release review note or verification link…"
              aria-label="Release activity note"
              value={noteDraft}
              onChange={(event) => onNoteDraftChange(event.target.value)}
            />
            <HStack justify="between" gap="2">
              <Text render={<span />} size="xs" tone="subtle">
                Logged to {item.code}
              </Text>
              <Button
                type="submit"
                variant="solid"
                size="xs"
                palette={accentPalette}
                disabled={noteDraft.trim().length === 0}
              >
                <SendIcon />
                Post note
              </Button>
            </HStack>
          </VStack>

          <Timeline.Root variant="subtle" size="sm">
            {item.activity.map((event, index) => {
              const isLast = index === item.activity.length - 1;
              return (
                <Timeline.Item key={event.id}>
                  <Timeline.Connector>
                    {!isLast ? <Timeline.Separator /> : null}
                    <Timeline.Indicator />
                  </Timeline.Connector>
                  <Timeline.Content style={isLast ? styles.timelineLastContent : undefined}>
                    <Timeline.Title>
                      <HStack align="baseline" justify="between" gap="2" style={styles.timelineHeader}>
                        <span>{event.label}</span>
                        <Text
                          render={<span />}
                          variant="mono"
                          size="xs"
                          tone="subtle"
                          tabular="true"
                          style={styles.timelineTime}
                        >
                          {event.at}
                        </Text>
                      </HStack>
                    </Timeline.Title>
                    <Timeline.Description>{event.detail}</Timeline.Description>
                    <Text render={<span />} size="xs" tone="subtle">
                      by {event.author}
                    </Text>
                  </Timeline.Content>
                </Timeline.Item>
              );
            })}
          </Timeline.Root>
        </Tabs.Panel>
      </Tabs.Root>
    </VStack>
  );
}

export interface GroupedTableProps extends StyleOverrideProps {
  /** Workspace heading rendered in the top bar. */
  workspaceName?: string;
  /** Optional work item ID to open in the inspector initially. */
  defaultSelectedId?: string | null;
  /** Initial grouping field. */
  defaultGroupBy?: GroupByMode;
}

/**
 * GroupedTable — release backlog and change-request tracker bundling rows into
 * collapsible stage, priority, or team groups with per-group counts, inline
 * stage/priority updates, search and filter controls, expand/collapse-all,
 * a resizable Splitter inspector pane, and narrow-viewport drawer handoff.
 */
export function GroupedTable({
  workspaceName = "Vektor Platform",
  defaultSelectedId = INITIAL_ITEMS[0]!.id,
  defaultGroupBy = "status",
  palette,
  style,
}: GroupedTableProps) {
  const rootRef = useRef<HTMLDivElement | null>(null);
  const queue = useMemo(() => Toast.createToaster(), []);

  const [items, setItems] = useState<ChangeRequest[]>(INITIAL_ITEMS);
  const [selectedId, setSelectedId] = useState<string | null>(defaultSelectedId);
  const [groupBy, setGroupBy] = useState<GroupByMode>(defaultGroupBy);
  const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(() => new Set());
  const [searchQuery, setSearchQuery] = useState<string>("");
  const [priorityFilter, setPriorityFilter] = useState<string>("all");
  const [releaseFilter, setReleaseFilter] = useState<string>("all");
  const [noteDraft, setNoteDraft] = useState<string>("");
  const [isNarrow, setIsNarrow] = useState<boolean>(false);
  const [isDrawerOpen, setIsDrawerOpen] = useState<boolean>(false);

  // Create-request dialog state
  const [isCreateOpen, setIsCreateOpen] = useState<boolean>(false);
  const [draftTitle, setDraftTitle] = useState<string>("");
  const [draftSubtitle, setDraftSubtitle] = useState<string>("");
  const [draftStage, setDraftStage] = useState<ReleaseStage>("queued");
  const [draftPriority, setDraftPriority] = useState<ChangePriority>("normal");
  const [draftTeam, setDraftTeam] = useState<TeamName>("Core Runtime");
  const [draftRelease, setDraftRelease] = useState<string>("v4.8");
  const [draftRisk, setDraftRisk] = useState<RiskLevel>("medium");
  const [draftSummary, setDraftSummary] = useState<string>("");

  // Delete confirmation state
  const [pendingDelete, setPendingDelete] = useState<ChangeRequest | null>(null);

  useEffect(() => {
    const node = rootRef.current;
    if (!node || typeof ResizeObserver === "undefined") return;
    const check = (width: number) => {
      const narrow = width <= 960;
      setIsNarrow(narrow);
      if (!narrow) setIsDrawerOpen(false);
    };
    check(node.getBoundingClientRect().width);
    const observer = new ResizeObserver((entries) => {
      const entry = entries[0];
      if (entry) check(entry.contentRect.width);
    });
    observer.observe(node);
    return () => observer.disconnect();
  }, []);

  const filteredItems = useMemo(() => {
    const q = searchQuery.trim().toLowerCase();
    return items.filter((item) => {
      if (priorityFilter !== "all" && item.priority !== priorityFilter) return false;
      if (releaseFilter !== "all" && item.release !== releaseFilter) return false;
      if (!q) return true;
      return (
        item.code.toLowerCase().includes(q) ||
        item.title.toLowerCase().includes(q) ||
        item.subtitle.toLowerCase().includes(q) ||
        item.team.toLowerCase().includes(q) ||
        item.release.toLowerCase().includes(q) ||
        item.assignee.name.toLowerCase().includes(q) ||
        item.componentTags.some((tag) => tag.toLowerCase().includes(q))
      );
    });
  }, [items, priorityFilter, releaseFilter, searchQuery]);

  const groups = useMemo<GroupBucket[]>(() => {
    if (groupBy === "none") {
      return filteredItems.length > 0
        ? [{ key: "__all", label: "All requests", items: filteredItems }]
        : [];
    }
    if (groupBy === "status") {
      return STAGE_ORDER.map((stage) => ({
        key: stage,
        label: STAGE_LABELS[stage],
        items: filteredItems.filter((item) => item.status === stage),
      })).filter((g) => g.items.length > 0);
    }
    if (groupBy === "priority") {
      return PRIORITY_ORDER.map((prio) => ({
        key: prio,
        label: PRIORITY_LABELS[prio],
        items: filteredItems.filter((item) => item.priority === prio),
      })).filter((g) => g.items.length > 0);
    }
    return TEAM_ORDER.map((team) => ({
      key: team,
      label: team,
      items: filteredItems.filter((item) => item.team === team),
    })).filter((g) => g.items.length > 0);
  }, [filteredItems, groupBy]);

  const selectedItem = useMemo(
    () => items.find((item) => item.id === selectedId) ?? null,
    [items, selectedId],
  );

  const hasActiveFilters =
    searchQuery.trim().length > 0 ||
    priorityFilter !== "all" ||
    releaseFilter !== "all";

  const allGroupsCollapsed =
    groupBy !== "none" &&
    groups.length > 0 &&
    groups.every((group) => collapsedGroups.has(group.key));

  const highRiskCount = useMemo(
    () => filteredItems.filter((item) => item.risk === "high" && item.status !== "shipped").length,
    [filteredItems],
  );

  const resetFilters = useCallback(() => {
    setSearchQuery("");
    setPriorityFilter("all");
    setReleaseFilter("all");
  }, []);

  const handleGroupByChange = useCallback((next: string) => {
    if (next === "status" || next === "priority" || next === "team" || next === "none") {
      setGroupBy(next);
      setCollapsedGroups(new Set());
    }
  }, []);

  const toggleGroup = useCallback((key: string) => {
    setCollapsedGroups((prev) => {
      const next = new Set(prev);
      if (next.has(key)) {
        next.delete(key);
      } else {
        next.add(key);
      }
      return next;
    });
  }, []);

  const toggleAllGroups = useCallback(() => {
    if (allGroupsCollapsed) {
      setCollapsedGroups(new Set());
    } else {
      setCollapsedGroups(new Set(groups.map((g) => g.key)));
    }
  }, [allGroupsCollapsed, groups]);

  const handleSelectRow = useCallback(
    (id: string) => {
      setSelectedId(id);
      setNoteDraft("");
      if (isNarrow) setIsDrawerOpen(true);
    },
    [isNarrow],
  );

  const handleChangeStatus = useCallback(
    (id: string, nextStatus: ReleaseStage) => {
      let updatedCode = "";
      let previousStatus: ReleaseStage | null = null;
      setItems((prev) =>
        prev.map((item) => {
          if (item.id !== id || item.status === nextStatus) return item;
          updatedCode = item.code;
          previousStatus = item.status;
          return {
            ...item,
            status: nextStatus,
            updated: "Just now",
            activity: [
              {
                id: `act-status-${id}-${Date.now()}`,
                at: "Just now",
                author: item.assignee.name,
                label: `Moved to ${STAGE_LABELS[nextStatus]}`,
                detail: `Stage updated from ${STAGE_LABELS[item.status]} to ${STAGE_LABELS[nextStatus]}.`,
              },
              ...item.activity,
            ],
          };
        }),
      );
      if (updatedCode && previousStatus) {
        queue.success(`${updatedCode} moved to ${STAGE_LABELS[nextStatus]}`, {
          description: `Transitioned from ${STAGE_LABELS[previousStatus]}.`,
        });
      }
    },
    [queue],
  );

  const handleChangePriority = useCallback(
    (id: string, nextPriority: ChangePriority) => {
      let updatedCode = "";
      let previousPriority: ChangePriority | null = null;
      setItems((prev) =>
        prev.map((item) => {
          if (item.id !== id || item.priority === nextPriority) return item;
          updatedCode = item.code;
          previousPriority = item.priority;
          return {
            ...item,
            priority: nextPriority,
            updated: "Just now",
            activity: [
              {
                id: `act-prio-${id}-${Date.now()}`,
                at: "Just now",
                author: item.assignee.name,
                label: `Priority set to ${PRIORITY_LABELS[nextPriority]}`,
                detail: `Changed priority from ${PRIORITY_LABELS[item.priority]} to ${PRIORITY_LABELS[nextPriority]}.`,
              },
              ...item.activity,
            ],
          };
        }),
      );
      if (updatedCode && previousPriority) {
        queue.info(`${updatedCode} priority set to ${PRIORITY_LABELS[nextPriority]}`, {
          description: `Updated from ${PRIORITY_LABELS[previousPriority]}.`,
        });
      }
    },
    [queue],
  );

  const handleToggleStep = useCallback(
    (itemId: string, stepId: string) => {
      let stepLabel = "";
      let nextDone = false;
      setItems((prev) =>
        prev.map((item) => {
          if (item.id !== itemId) return item;
          return {
            ...item,
            updated: "Just now",
            checklist: item.checklist.map((step) => {
              if (step.id !== stepId) return step;
              stepLabel = step.label;
              nextDone = !step.done;
              return { ...step, done: nextDone };
            }),
          };
        }),
      );
      if (stepLabel) {
        queue.info(nextDone ? "Checklist item verified" : "Checklist item reopened", {
          description: stepLabel,
        });
      }
    },
    [queue],
  );

  const handleAddNote = useCallback(
    (itemId: string) => {
      const body = noteDraft.trim();
      if (!body) return;
      let targetCode = "";
      setItems((prev) =>
        prev.map((item) => {
          if (item.id !== itemId) return item;
          targetCode = item.code;
          return {
            ...item,
            updated: "Just now",
            activity: [
              {
                id: `act-note-${itemId}-${Date.now()}`,
                at: "Just now",
                author: "Henrik Lind",
                label: "Review note added",
                detail: body,
              },
              ...item.activity,
            ],
          };
        }),
      );
      setNoteDraft("");
      if (targetCode) {
        queue.success(`Note posted to ${targetCode}`, {
          description: "Release activity timeline updated.",
        });
      }
    },
    [noteDraft, queue],
  );

  const nextCodeNumber = useCallback((list: ChangeRequest[]) => {
    let highest = 417;
    for (const item of list) {
      const parsed = Number.parseInt(item.code.replace("VK-", ""), 10);
      if (Number.isFinite(parsed) && parsed > highest) highest = parsed;
    }
    return highest + 1;
  }, []);

  const handleDuplicate = useCallback(
    (source: ChangeRequest) => {
      const nextNum = nextCodeNumber(items);
      const code = `VK-${nextNum}`;
      const id = `vk-${nextNum}`;
      const cloned: ChangeRequest = {
        ...source,
        id,
        code,
        title: `${source.title} (copy)`,
        created: "Today",
        updated: "Just now",
        checklist: source.checklist.map((step, idx) => ({
          ...step,
          id: `c-${nextNum}-${idx + 1}`,
          done: false,
        })),
        activity: [
          {
            id: `act-dup-${nextNum}`,
            at: "Just now",
            author: "Henrik Lind",
            label: `Cloned from ${source.code}`,
            detail: "Duplicated scope and release checklist for follow-up rollout.",
          },
        ],
      };
      setItems((prev) => [cloned, ...prev]);
      setSelectedId(id);
      if (isNarrow) setIsDrawerOpen(true);
      queue.success(`Duplicated as ${code}`, {
        description: cloned.title,
      });
    },
    [isNarrow, items, nextCodeNumber, queue],
  );

  const handleConfirmDelete = useCallback(() => {
    if (!pendingDelete) return;
    const removed = pendingDelete;
    setItems((prev) => {
      const nextList = prev.filter((item) => item.id !== removed.id);
      if (selectedId === removed.id) {
        setSelectedId(nextList[0]?.id ?? null);
        if (nextList.length === 0) setIsDrawerOpen(false);
      }
      return nextList;
    });
    setPendingDelete(null);
    queue.warning(`Deleted ${removed.code}`, {
      description: removed.title,
    });
  }, [pendingDelete, queue, selectedId]);

  const handleCreateRequest = useCallback(
    (event: React.FormEvent<HTMLFormElement>) => {
      event.preventDefault();
      const title = draftTitle.trim();
      if (!title) return;
      const nextNum = nextCodeNumber(items);
      const code = `VK-${nextNum}`;
      const id = `vk-${nextNum}`;
      const teamAssignee: Record<TeamName, AssigneeProfile> = {
        "Core Runtime": ASSIGNEES.maren!,
        "Edge Proxy": ASSIGNEES.koji!,
        "Storage Engine": ASSIGNEES.priya!,
        Observability: ASSIGNEES.tomasz!,
        "SDK & CLI": ASSIGNEES.nadia!,
      };
      const assignee = teamAssignee[draftTeam];
      const created: ChangeRequest = {
        id,
        code,
        title,
        subtitle: draftSubtitle.trim(),
        status: draftStage,
        priority: draftPriority,
        team: draftTeam,
        release: draftRelease,
        risk: draftRisk,
        componentTags: [draftTeam.toLowerCase().replace(/[^a-z0-9]+/g, "-"), draftRelease],
        assignee,
        created: "Today",
        updated: "Just now",
        summary:
          draftSummary.trim() ||
          `Scoped change request assigned to ${draftTeam} for the ${draftRelease} release train.`,
        checklist: [
          { id: `c-${nextNum}-1`, label: "Peer design and rollout review", done: false },
          { id: `c-${nextNum}-2`, label: "Staging soak & regression verification", done: false },
          { id: `c-${nextNum}-3`, label: "Release engineering sign-off", done: false },
        ],
        activity: [
          {
            id: `act-new-${nextNum}`,
            at: "Just now",
            author: assignee.name,
            label: "Change request created",
            detail: `Added to ${STAGE_LABELS[draftStage]} (${PRIORITY_LABELS[draftPriority]} priority · ${draftRelease}).`,
          },
        ],
      };

      setItems((prev) => [created, ...prev]);
      setSelectedId(id);
      setPriorityFilter("all");
      setReleaseFilter("all");
      setSearchQuery("");
      setDraftTitle("");
      setDraftSubtitle("");
      setDraftSummary("");
      setIsCreateOpen(false);
      if (isNarrow) setIsDrawerOpen(true);

      queue.success(`Created ${code}`, {
        description: `${title} · ${draftTeam}`,
      });
    },
    [
      draftPriority,
      draftRelease,
      draftRisk,
      draftStage,
      draftSubtitle,
      draftSummary,
      draftTeam,
      draftTitle,
      isNarrow,
      items,
      nextCodeNumber,
      queue,
    ],
  );

  const renderGroupLeadingIcon = (groupKey: string) => {
    if (groupBy === "status") {
      const stage = groupKey as ReleaseStage;
      return (
        <Status.Root size="sm" palette={STAGE_PALETTES[stage]}>
          <Status.Indicator />
        </Status.Root>
      );
    }
    if (groupBy === "priority") {
      return <PriorityBars priority={groupKey as ChangePriority} />;
    }
    if (groupBy === "team") {
      const team = groupKey as TeamName;
      return (
        <Status.Root size="sm" palette={TEAM_PALETTES[team]}>
          <Status.Indicator />
        </Status.Root>
      );
    }
    return null;
  };

  const renderGroupSummary = (groupItems: ChangeRequest[]) => {
    const highRisk = groupItems.filter((item) => item.risk === "high").length;
    const critical = groupItems.filter((item) => item.priority === "critical").length;
    if (critical > 0) return `${critical} critical`;
    if (highRisk > 0) return `${highRisk} high risk`;
    const releases = new Set(groupItems.map((item) => item.release));
    return releases.size === 1 ? [...releases][0]! : `${releases.size} trains`;
  };

  const tablePaneContent = (
    <VStack gap="0" style={styles.tablePane}>
      <HStack justify="between" wrap="wrap" gap="2.5" style={styles.toolbar}>
        <HStack wrap="wrap" gap="2" style={styles.toolbarStart}>
          <div {...stylex.props(styles.searchWrap)}>
            <span {...stylex.props(styles.searchIcon)}>
              <SearchIcon />
            </span>
            <Input
              size="sm"
              placeholder="Filter ID, title, team, tag, owner…"
              aria-label="Filter change requests"
              value={searchQuery}
              onChange={(event) => setSearchQuery(event.target.value)}
              style={styles.searchInput}
            />
            {searchQuery.length > 0 ? (
              <IconButton
                type="button"
                variant="ghost"
                size="2xs"
                aria-label="Clear search query"
                onClick={() => setSearchQuery("")}
                style={styles.searchClearBtn}
              >
                <CloseIcon />
              </IconButton>
            ) : null}
          </div>

          <Select.Root
            size="sm"
            variant="outline"
            value={priorityFilter}
            onValueChange={(next) => {
              if (typeof next === "string") setPriorityFilter(next);
            }}
            style={styles.filterSelect}
          >
            <Select.Control>
              <Select.Trigger aria-label="Filter by priority">
                <Select.Value>
                  {priorityFilter === "all"
                    ? "All priorities"
                    : PRIORITY_LABELS[priorityFilter as ChangePriority]}
                </Select.Value>
              </Select.Trigger>
              <Select.IndicatorGroup>
                <Select.Icon />
              </Select.IndicatorGroup>
            </Select.Control>
            <Select.Content>
              <Select.Item value="all">
                <Select.ItemText>All priorities</Select.ItemText>
                <Select.ItemIndicator />
              </Select.Item>
              {PRIORITY_ORDER.map((prio) => (
                <Select.Item key={prio} value={prio}>
                  <Select.ItemText>{PRIORITY_LABELS[prio]}</Select.ItemText>
                  <Select.ItemIndicator />
                </Select.Item>
              ))}
            </Select.Content>
          </Select.Root>

          <Select.Root
            size="sm"
            variant="outline"
            value={releaseFilter}
            onValueChange={(next) => {
              if (typeof next === "string") setReleaseFilter(next);
            }}
            style={styles.filterSelect}
          >
            <Select.Control>
              <Select.Trigger aria-label="Filter by release">
                <Select.Value>
                  {releaseFilter === "all" ? "All releases" : releaseFilter}
                </Select.Value>
              </Select.Trigger>
              <Select.IndicatorGroup>
                <Select.Icon />
              </Select.IndicatorGroup>
            </Select.Control>
            <Select.Content>
              <Select.Item value="all">
                <Select.ItemText>All releases</Select.ItemText>
                <Select.ItemIndicator />
              </Select.Item>
              {RELEASES.map((rel) => (
                <Select.Item key={rel} value={rel}>
                  <Select.ItemText>{rel}</Select.ItemText>
                  <Select.ItemIndicator />
                </Select.Item>
              ))}
            </Select.Content>
          </Select.Root>

          {hasActiveFilters ? (
            <Button variant="ghost" size="xs" onClick={resetFilters}>
              Reset
            </Button>
          ) : null}
        </HStack>

        <HStack wrap="wrap" gap="2">
          <Text
            render={<span />}
            size="xs"
            tone="subtle"
            weight="medium"
            style={styles.groupByLabel}
          >
            Group
          </Text>
          <SegmentGroup.Root
            size="xs"
            value={groupBy}
            onValueChange={handleGroupByChange}
            aria-label="Group table rows by"
          >
            <SegmentGroup.Item value="status">Status</SegmentGroup.Item>
            <SegmentGroup.Item value="priority">Priority</SegmentGroup.Item>
            <SegmentGroup.Item value="team">Team</SegmentGroup.Item>
            <SegmentGroup.Item value="none">Flat</SegmentGroup.Item>
          </SegmentGroup.Root>

          {groupBy !== "none" && groups.length > 0 ? (
            <Button
              variant="surface"
              size="xs"
              onClick={toggleAllGroups}
              aria-label={allGroupsCollapsed ? "Expand all groups" : "Collapse all groups"}
            >
              {allGroupsCollapsed ? <ExpandAllIcon /> : <CollapseAllIcon />}
              {allGroupsCollapsed ? "Expand all" : "Collapse all"}
            </Button>
          ) : null}
        </HStack>
      </HStack>

      <main aria-label="Grouped change requests table" {...stylex.props(styles.tableScroll)}>
        {filteredItems.length === 0 ? (
          <EmptyState.Root size="md">
            <EmptyState.Content>
              <EmptyState.Indicator>
                <SearchIcon />
              </EmptyState.Indicator>
              <EmptyState.Title>No matching change requests</EmptyState.Title>
              <EmptyState.Description>
                Try clearing your search query or switching the priority and release filters.
              </EmptyState.Description>
              <EmptyState.Actions>
                <Button variant="surface" size="sm" onClick={resetFilters}>
                  Reset filters
                </Button>
              </EmptyState.Actions>
            </EmptyState.Content>
          </EmptyState.Root>
        ) : (
          <Table.Root size="sm" variant="line" style={styles.tableRoot}>
            <Table.Header>
              <Table.Row style={styles.tableHeaderRow}>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colStatus]}>
                  <VisuallyHidden>Stage</VisuallyHidden>
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colPriority]}>
                  <VisuallyHidden>Priority</VisuallyHidden>
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colTitle]}>
                  Change request
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colTeam]}>
                  Team
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colRelease]}>
                  Release
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colRisk]}>
                  Risk
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colAssignee]}>
                  Owner
                </Table.ColumnHeader>
                <Table.ColumnHeader style={[styles.tableHeaderCell, styles.colActions]}>
                  <VisuallyHidden>Actions</VisuallyHidden>
                </Table.ColumnHeader>
              </Table.Row>
            </Table.Header>

            {groups.map((group) => {
              const isCollapsed = groupBy !== "none" && collapsedGroups.has(group.key);
              return (
                <Table.Body key={group.key}>
                  {groupBy !== "none" ? (
                    <Table.Row style={styles.groupRow}>
                      <Table.Cell colSpan={8} style={styles.groupCell}>
                        <button
                          type="button"
                          aria-expanded={!isCollapsed}
                          onClick={() => toggleGroup(group.key)}
                          {...stylex.props(styles.groupToggleBtn)}
                        >
                          <HStack render={<span />} gap="2">
                            <span
                              {...stylex.props(
                                styles.chevron,
                                isCollapsed && styles.chevronCollapsed,
                              )}
                            >
                              <ChevronDownIcon />
                            </span>
                            {renderGroupLeadingIcon(group.key)}
                            <Text
                              render={<span />}
                              size="xs"
                              weight="semibold"
                              style={styles.groupLabelText}
                            >
                              {group.label}
                            </Text>
                            <Badge variant="surface" size="xs" palette={grayPalette}>
                              {group.items.length}
                            </Badge>
                          </HStack>
                          <Text
                            render={<span />}
                            size="xs"
                            tone="subtle"
                            tabular="true"
                            style={styles.nowrap}
                          >
                            {renderGroupSummary(group.items)}
                          </Text>
                        </button>
                      </Table.Cell>
                    </Table.Row>
                  ) : null}

                  {!isCollapsed
                    ? group.items.map((item) => {
                        const isSelected =
                          (!isNarrow || isDrawerOpen) && item.id === selectedId;
                        return (
                          <Table.Row
                            key={item.id}
                            data-selected={isSelected ? "" : undefined}
                            onClick={() => handleSelectRow(item.id)}
                            style={[
                              styles.dataRow,
                              isSelected && styles.dataRowSelected,
                            ]}
                          >
                            {/* Inline Stage Selector */}
                            <Table.Cell style={[styles.dataCell, styles.colStatus]}>
                              <Menu.Root size="sm">
                                <Menu.Trigger
                                  render={
                                    <IconButton
                                      type="button"
                                      variant="ghost"
                                      size="2xs"
                                      aria-label={`Stage for ${item.code}: ${STAGE_LABELS[item.status]}`}
                                      onClick={(event) => event.stopPropagation()}
                                    />
                                  }
                                >
                                  <Status.Root
                                    size="sm"
                                    palette={STAGE_PALETTES[item.status]}
                                  >
                                    <Status.Indicator />
                                  </Status.Root>
                                </Menu.Trigger>
                                <Menu.Content align="start" style={styles.menuWidth}>
                                  <Menu.GroupLabel>Set stage</Menu.GroupLabel>
                                  {STAGE_ORDER.map((stage) => (
                                    <Menu.Item
                                      key={stage}
                                      onSelect={() => handleChangeStatus(item.id, stage)}
                                    >
                                      <HStack render={<span />} gap="2">
                                        <Status.Root
                                          size="sm"
                                          palette={STAGE_PALETTES[stage]}
                                        >
                                          <Status.Indicator />
                                        </Status.Root>
                                        <Menu.ItemText>{STAGE_LABELS[stage]}</Menu.ItemText>
                                      </HStack>
                                    </Menu.Item>
                                  ))}
                                </Menu.Content>
                              </Menu.Root>
                            </Table.Cell>

                            {/* Inline Priority Selector */}
                            <Table.Cell style={[styles.dataCell, styles.colPriority]}>
                              <Menu.Root size="sm">
                                <Menu.Trigger
                                  render={
                                    <IconButton
                                      type="button"
                                      variant="ghost"
                                      size="2xs"
                                      aria-label={`Priority for ${item.code}: ${PRIORITY_LABELS[item.priority]}`}
                                      onClick={(event) => event.stopPropagation()}
                                    />
                                  }
                                >
                                  <PriorityBars priority={item.priority} />
                                </Menu.Trigger>
                                <Menu.Content align="start" style={styles.menuWidth}>
                                  <Menu.GroupLabel>Set priority</Menu.GroupLabel>
                                  {PRIORITY_ORDER.map((prio) => (
                                    <Menu.Item
                                      key={prio}
                                      onSelect={() => handleChangePriority(item.id, prio)}
                                    >
                                      <HStack render={<span />} gap="2">
                                        <PriorityBars priority={prio} />
                                        <Menu.ItemText>{PRIORITY_LABELS[prio]}</Menu.ItemText>
                                      </HStack>
                                    </Menu.Item>
                                  ))}
                                </Menu.Content>
                              </Menu.Root>
                            </Table.Cell>

                            {/* Code + Title + Subtitle */}
                            <Table.Cell style={[styles.dataCell, styles.colTitle]}>
                              <HStack gap="2" style={styles.titleCellWrap}>
                                <Text
                                  render={<span />}
                                  variant="mono"
                                  size="xs"
                                  tone="muted"
                                  weight="medium"
                                  tabular="true"
                                  style={styles.noShrink}
                                >
                                  {item.code}
                                </Text>
                                <button
                                  type="button"
                                  aria-current={isSelected ? "true" : undefined}
                                  onClick={(event) => {
                                    event.stopPropagation();
                                    handleSelectRow(item.id);
                                  }}
                                  {...stylex.props(styles.rowTitleButton)}
                                >
                                  {item.title}
                                </button>
                                {item.subtitle ? (
                                  <Text
                                    render={<span />}
                                    size="xs"
                                    tone="subtle"
                                    truncate="true"
                                    style={styles.rowSubtitle}
                                  >
                                    · {item.subtitle}
                                  </Text>
                                ) : null}
                              </HStack>
                            </Table.Cell>

                            {/* Team */}
                            <Table.Cell style={[styles.dataCell, styles.colTeam]}>
                              <Text size="xs" variant="muted" truncate="true">
                                {item.team}
                              </Text>
                            </Table.Cell>

                            {/* Release */}
                            <Table.Cell style={[styles.dataCell, styles.colRelease]}>
                              <Text
                                render={<span />}
                                variant="mono"
                                size="xs"
                                tone="muted"
                                tabular="true"
                              >
                                {item.release}
                              </Text>
                            </Table.Cell>

                            {/* Risk */}
                            <Table.Cell style={[styles.dataCell, styles.colRisk]}>
                              <Badge
                                variant="subtle"
                                size="xs"
                                palette={RISK_PALETTES[item.risk]}
                              >
                                {RISK_LABELS[item.risk]}
                              </Badge>
                            </Table.Cell>

                            {/* Owner Avatar */}
                            <Table.Cell style={[styles.dataCell, styles.colAssignee]}>
                              <Center
                                render={<span />}
                                display="inline"
                                title={`${item.assignee.name} · ${item.assignee.role}`}
                              >
                                <Avatar.Root
                                  size="xs"
                                  variant="subtle"
                                  palette={AVATAR_PALETTES[item.assignee.tone]}
                                >
                                  <Avatar.Fallback>{item.assignee.initials}</Avatar.Fallback>
                                </Avatar.Root>
                              </Center>
                            </Table.Cell>

                            {/* Row Actions Menu */}
                            <Table.Cell style={[styles.dataCell, styles.colActions]}>
                              <Menu.Root size="sm">
                                <Menu.Trigger
                                  render={
                                    <IconButton
                                      variant="ghost"
                                      size="xs"
                                      aria-label={`Actions for ${item.code}`}
                                      onClick={(event) => event.stopPropagation()}
                                    />
                                  }
                                >
                                  <MoreHorizontalIcon />
                                </Menu.Trigger>
                                <Menu.Content align="end" style={styles.menuWidth}>
                                  <Menu.Item onSelect={() => handleSelectRow(item.id)}>
                                    <Menu.ItemText>Inspect details</Menu.ItemText>
                                  </Menu.Item>
                                  <Menu.Item
                                    onSelect={() =>
                                      handleChangeStatus(item.id, NEXT_STAGE[item.status])
                                    }
                                  >
                                    <Menu.ItemText>{NEXT_STAGE_CTA[item.status]}</Menu.ItemText>
                                  </Menu.Item>
                                  <Menu.Item onSelect={() => handleDuplicate(item)}>
                                    <Menu.ItemText>Duplicate</Menu.ItemText>
                                  </Menu.Item>
                                  <Menu.Separator />
                                  <Menu.Item
                                    destructive
                                    onSelect={() => setPendingDelete(item)}
                                  >
                                    <Menu.ItemText>Delete request</Menu.ItemText>
                                  </Menu.Item>
                                </Menu.Content>
                              </Menu.Root>
                            </Table.Cell>
                          </Table.Row>
                        );
                      })
                    : null}
                </Table.Body>
              );
            })}
          </Table.Root>
        )}
      </main>

      <HStack
        render={<footer />}
        justify="between"
        wrap="wrap"
        gap="3"
        style={styles.tableFooter}
      >
        <HStack wrap="wrap" gap="3" style={styles.footerMetrics}>
          <span>
            {filteredItems.length} of {items.length} change requests
          </span>
          {groupBy !== "none" ? (
            <span>
              {groups.length} {groups.length === 1 ? "group" : "groups"}
            </span>
          ) : null}
          {highRiskCount > 0 ? <span>{highRiskCount} active high-risk</span> : null}
        </HStack>
        <span>Click stage dot or priority bars to update inline</span>
      </HStack>
    </VStack>
  );

  const inspectorView = selectedItem ? (
    <ChangeRequestInspector
      item={selectedItem}
      noteDraft={noteDraft}
      showCloseButton={!isNarrow}
      onClose={() => setSelectedId(null)}
      onNoteDraftChange={setNoteDraft}
      onChangeStatus={handleChangeStatus}
      onChangePriority={handleChangePriority}
      onDuplicate={handleDuplicate}
      onRequestDelete={(item) => setPendingDelete(item)}
      onToggleStep={handleToggleStep}
      onAddNote={handleAddNote}
    />
  ) : null;

  return (
    <VStack ref={rootRef} gap="0" palette={palette} style={[styles.root, style]}>
      <HStack
        render={<header />}
        justify="between"
        wrap="wrap"
        gap="3"
        style={styles.header}
      >
        <HStack gap="2.5">
          <Center display="inline" style={styles.brandMark} aria-hidden="true">
            <LayersLogoIcon />
          </Center>
          <HStack align="baseline" wrap="wrap" gap="2">
            <Heading render={<h1 />} size="md" style={styles.headerTitle}>
              {workspaceName} · Release Backlog
            </Heading>
            <Text
              render={<span />}
              size="xs"
              variant="muted"
              tabular="true"
              style={styles.nowrap}
            >
              {items.filter((i) => i.status === "in_review").length} in review ·{" "}
              {items.length} total
            </Text>
          </HStack>
        </HStack>

        <HStack wrap="wrap" gap="2">
          <Dialog.Root
            size="sm"
            placement="center"
            open={isCreateOpen}
            onOpenChange={setIsCreateOpen}
          >
            <Dialog.Trigger
              render={<Button variant="solid" size="xs" palette={accentPalette} />}
            >
              <PlusIcon />
              New change request
            </Dialog.Trigger>
            <Dialog.Backdrop />
            <Dialog.Content>
              <Dialog.Header>
                <Dialog.Title>New change request</Dialog.Title>
                <Dialog.Close
                  render={
                    <IconButton
                      variant="ghost"
                      size="xs"
                      aria-label="Close dialog"
                    />
                  }
                >
                  <CloseIcon />
                </Dialog.Close>
              </Dialog.Header>
              <form onSubmit={handleCreateRequest}>
                <Dialog.Body>
                  <VStack gap="3">
                    <Dialog.Description>
                      Queue a scoped release change with stage, priority, team ownership, and
                      initial readiness gates.
                    </Dialog.Description>
                    <VStack render={<label />} gap="1">
                      <Text render={<span />} size="xs" variant="muted" weight="medium">
                        Title
                      </Text>
                      <Input
                        size="sm"
                        required
                        placeholder="e.g. Enable connection draining on ingress nodes"
                        value={draftTitle}
                        onChange={(event) => setDraftTitle(event.target.value)}
                      />
                    </VStack>
                    <VStack render={<label />} gap="1">
                      <Text render={<span />} size="xs" variant="muted" weight="medium">
                        Subtitle (optional)
                      </Text>
                      <Input
                        size="sm"
                        placeholder="Short milestone or component context"
                        value={draftSubtitle}
                        onChange={(event) => setDraftSubtitle(event.target.value)}
                      />
                    </VStack>
                    <Grid columns="2" gap="3">
                      <VStack gap="1">
                        <Text render={<span />} size="xs" variant="muted" weight="medium">
                          Stage
                        </Text>
                        <Select.Root
                          size="sm"
                          value={draftStage}
                          onValueChange={(next) => {
                            if (
                              next === "in_review" ||
                              next === "in_progress" ||
                              next === "queued" ||
                              next === "shipped"
                            ) {
                              setDraftStage(next);
                            }
                          }}
                        >
                          <Select.Control>
                            <Select.Trigger aria-label="Initial stage">
                              <Select.Value>{STAGE_LABELS[draftStage]}</Select.Value>
                            </Select.Trigger>
                            <Select.IndicatorGroup>
                              <Select.Icon />
                            </Select.IndicatorGroup>
                          </Select.Control>
                          <Select.Content>
                            {STAGE_ORDER.map((stage) => (
                              <Select.Item key={stage} value={stage}>
                                <Select.ItemText>{STAGE_LABELS[stage]}</Select.ItemText>
                                <Select.ItemIndicator />
                              </Select.Item>
                            ))}
                          </Select.Content>
                        </Select.Root>
                      </VStack>

                      <VStack gap="1">
                        <Text render={<span />} size="xs" variant="muted" weight="medium">
                          Priority
                        </Text>
                        <Select.Root
                          size="sm"
                          value={draftPriority}
                          onValueChange={(next) => {
                            if (
                              next === "critical" ||
                              next === "high" ||
                              next === "normal" ||
                              next === "low"
                            ) {
                              setDraftPriority(next);
                            }
                          }}
                        >
                          <Select.Control>
                            <Select.Trigger aria-label="Initial priority">
                              <Select.Value>{PRIORITY_LABELS[draftPriority]}</Select.Value>
                            </Select.Trigger>
                            <Select.IndicatorGroup>
                              <Select.Icon />
                            </Select.IndicatorGroup>
                          </Select.Control>
                          <Select.Content>
                            {PRIORITY_ORDER.map((prio) => (
                              <Select.Item key={prio} value={prio}>
                                <Select.ItemText>{PRIORITY_LABELS[prio]}</Select.ItemText>
                                <Select.ItemIndicator />
                              </Select.Item>
                            ))}
                          </Select.Content>
                        </Select.Root>
                      </VStack>
                    </Grid>

                    <Grid columns="2" gap="3">
                      <VStack gap="1">
                        <Text render={<span />} size="xs" variant="muted" weight="medium">
                          Team
                        </Text>
                        <Select.Root
                          size="sm"
                          value={draftTeam}
                          onValueChange={(next) => {
                            if (
                              next === "Core Runtime" ||
                              next === "Edge Proxy" ||
                              next === "Storage Engine" ||
                              next === "Observability" ||
                              next === "SDK & CLI"
                            ) {
                              setDraftTeam(next);
                            }
                          }}
                        >
                          <Select.Control>
                            <Select.Trigger aria-label="Owning team">
                              <Select.Value>{draftTeam}</Select.Value>
                            </Select.Trigger>
                            <Select.IndicatorGroup>
                              <Select.Icon />
                            </Select.IndicatorGroup>
                          </Select.Control>
                          <Select.Content>
                            {TEAM_ORDER.map((team) => (
                              <Select.Item key={team} value={team}>
                                <Select.ItemText>{team}</Select.ItemText>
                                <Select.ItemIndicator />
                              </Select.Item>
                            ))}
                          </Select.Content>
                        </Select.Root>
                      </VStack>

                      <VStack gap="1">
                        <Text render={<span />} size="xs" variant="muted" weight="medium">
                          Target release
                        </Text>
                        <Select.Root
                          size="sm"
                          value={draftRelease}
                          onValueChange={(next) => {
                            if (typeof next === "string") setDraftRelease(next);
                          }}
                        >
                          <Select.Control>
                            <Select.Trigger aria-label="Target release">
                              <Select.Value>{draftRelease}</Select.Value>
                            </Select.Trigger>
                            <Select.IndicatorGroup>
                              <Select.Icon />
                            </Select.IndicatorGroup>
                          </Select.Control>
                          <Select.Content>
                            {RELEASES.map((rel) => (
                              <Select.Item key={rel} value={rel}>
                                <Select.ItemText>{rel}</Select.ItemText>
                                <Select.ItemIndicator />
                              </Select.Item>
                            ))}
                          </Select.Content>
                        </Select.Root>
                      </VStack>
                    </Grid>

                    <VStack gap="1">
                      <Text render={<span />} size="xs" variant="muted" weight="medium">
                        Risk profile
                      </Text>
                      <SegmentGroup.Root
                        size="xs"
                        value={draftRisk}
                        onValueChange={(next) => {
                          if (next === "high" || next === "medium" || next === "low") {
                            setDraftRisk(next);
                          }
                        }}
                        aria-label="Risk profile"
                      >
                        <SegmentGroup.Item value="low">Low</SegmentGroup.Item>
                        <SegmentGroup.Item value="medium">Medium</SegmentGroup.Item>
                        <SegmentGroup.Item value="high">High</SegmentGroup.Item>
                      </SegmentGroup.Root>
                    </VStack>

                    <VStack render={<label />} gap="1">
                      <Text render={<span />} size="xs" variant="muted" weight="medium">
                        Rollout notes
                      </Text>
                      <Textarea
                        size="sm"
                        rows={2}
                        placeholder="Summarize scope, blast radius, or verification criteria"
                        value={draftSummary}
                        onChange={(event) => setDraftSummary(event.target.value)}
                      />
                    </VStack>
                  </VStack>
                </Dialog.Body>
                <Dialog.Footer>
                  <Button
                    type="button"
                    variant="ghost"
                    size="sm"
                    onClick={() => setIsCreateOpen(false)}
                  >
                    Cancel
                  </Button>
                  <Button
                    type="submit"
                    variant="solid"
                    size="sm"
                    palette={accentPalette}
                    disabled={draftTitle.trim().length === 0}
                  >
                    Create request
                  </Button>
                </Dialog.Footer>
              </form>
            </Dialog.Content>
          </Dialog.Root>
        </HStack>
      </HStack>

      <div {...stylex.props(styles.workspace)}>
        {selectedItem ? (
          <Splitter.Root orientation="horizontal" defaultSize={[63, 37]} minSize={26}>
            <Splitter.Panel index={0} style={styles.tablePane}>
              {tablePaneContent}
            </Splitter.Panel>

            <Splitter.ResizeTrigger
              index={0}
              aria-label="Resize change request inspector"
              style={styles.inspectorHandle}
            />

            <Splitter.Panel
              index={1}
              role="complementary"
              aria-label="Change request inspector"
              style={styles.inspectorPanel}
            >
              {inspectorView}
            </Splitter.Panel>
          </Splitter.Root>
        ) : (
          tablePaneContent
        )}
      </div>

      {isNarrow && selectedItem ? (
        <Drawer.Root
          placement="bottom"
          size="lg"
          open={isDrawerOpen}
          onOpenChange={setIsDrawerOpen}
        >
          <Drawer.Backdrop />
          <Drawer.Content style={styles.drawerContent}>
            <Drawer.Header style={styles.drawerHeader}>
              <Drawer.Title>{selectedItem.code} · Change request</Drawer.Title>
              <Drawer.Close
                render={
                  <IconButton
                    variant="ghost"
                    size="xs"
                    aria-label="Close change request details"
                  />
                }
              >
                <CloseIcon />
              </Drawer.Close>
            </Drawer.Header>
            <Drawer.Body style={styles.drawerBody}>{inspectorView}</Drawer.Body>
          </Drawer.Content>
        </Drawer.Root>
      ) : null}

      <AlertDialog.Root
        size="sm"
        open={pendingDelete !== null}
        onOpenChange={(open) => {
          if (!open) setPendingDelete(null);
        }}
      >
        <AlertDialog.Backdrop />
        <AlertDialog.Content>
          <AlertDialog.Header>
            <AlertDialog.Icon palette={redPalette}>
              <TrashIcon />
            </AlertDialog.Icon>
            <AlertDialog.Title>
              Delete {pendingDelete?.code ?? "change request"}?
            </AlertDialog.Title>
          </AlertDialog.Header>
          <AlertDialog.Body>
            <AlertDialog.Description>
              {pendingDelete
                ? `“${pendingDelete.title}” will be removed from the release backlog along with its checklist and activity log.`
                : "This change request will be removed from the release backlog."}
            </AlertDialog.Description>
          </AlertDialog.Body>
          <AlertDialog.Footer>
            <AlertDialog.Cancel render={<Button variant="ghost" size="sm" />}>
              Cancel
            </AlertDialog.Cancel>
            <Button
              variant="solid"
              size="sm"
              palette={redPalette}
              onClick={handleConfirmDelete}
            >
              Delete request
            </Button>
          </AlertDialog.Footer>
        </AlertDialog.Content>
      </AlertDialog.Root>

      <Toaster toaster={queue} />
    </VStack>
  );
}
```

Credit: Inspired by [Grouped Table](https://astryx.atmeta.com/playground?template=table-grouped) from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.)
