---
title: "Top Nav Shell · UI SDK — StyleX Blocks"
description: "Top-navigation application shell with a centered horizontal Navbar (brand mark, route links, ⌘K command search dialog, notifications popover, account menu), mobile slide-over drawer fallback, and interactive public & internal operations views."
url: "https://stylexblocks.com/block/ui-sdk/shell-top-nav/"
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/"
---

# Top Nav Shell block

Top-navigation application shell with a centered horizontal Navbar (brand mark, route links, ⌘K command search dialog, notifications popover, account menu), mobile slide-over drawer fallback, and interactive public & internal operations views.

- Behavior engine: UI SDK
- Category: [App shells](https://stylexblocks.com/blocks/app-shells.md)
- Built with: [Alert](https://stylexblocks.com/components/ui-sdk/alert.md), [App Shell](https://stylexblocks.com/components/ui-sdk/app-shell.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), [Card](https://stylexblocks.com/components/ui-sdk/card.md), [Code](https://stylexblocks.com/components/ui-sdk/code.md), [Dialog](https://stylexblocks.com/components/ui-sdk/dialog.md), [Drawer](https://stylexblocks.com/components/ui-sdk/drawer.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), [Kbd](https://stylexblocks.com/components/ui-sdk/kbd.md), [Menu](https://stylexblocks.com/components/ui-sdk/menu.md), [Navbar](https://stylexblocks.com/components/ui-sdk/navbar.md), [Popover](https://stylexblocks.com/components/ui-sdk/popover.md), [Progress](https://stylexblocks.com/components/ui-sdk/progress.md), [Separator](https://stylexblocks.com/components/ui-sdk/separator.md), [Sidebar Nav Item](https://stylexblocks.com/components/ui-sdk/sidebar-nav-item.md), [Stack](https://stylexblocks.com/components/ui-sdk/stack.md), [Stat](https://stylexblocks.com/components/ui-sdk/stat.md), [Status](https://stylexblocks.com/components/ui-sdk/status.md), [Switch](https://stylexblocks.com/components/ui-sdk/switch.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), [Toast](https://stylexblocks.com/components/ui-sdk/toast.md)
- HTML page: https://stylexblocks.com/block/ui-sdk/shell-top-nav/

## 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 shell-top-nav
```

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

## Usage

```tsx
import { ShellTopNav } from "#components/blocks/ui-sdk/shell-top-nav.tsx";

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

## Source

`components/blocks/ui-sdk/shell-top-nav.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useCallback, useEffect, useMemo, useState } from "react";
import { Alert } from "#components/ui/ui-sdk/alert.tsx";
import { AppShell } from "#components/ui/ui-sdk/app-shell.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 { Card } from "#components/ui/ui-sdk/card.tsx";
import { Code } from "#components/ui/ui-sdk/code.tsx";
import { Dialog } from "#components/ui/ui-sdk/dialog.tsx";
import { Drawer } from "#components/ui/ui-sdk/drawer.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 { Kbd } from "#components/ui/ui-sdk/kbd.tsx";
import { Menu } from "#components/ui/ui-sdk/menu.tsx";
import { Navbar } from "#components/ui/ui-sdk/navbar.tsx";
import { Popover } from "#components/ui/ui-sdk/popover.tsx";
import { Progress } from "#components/ui/ui-sdk/progress.tsx";
import { Separator } from "#components/ui/ui-sdk/separator.tsx";
import {
  SidebarNavItem,
  sidebarNavItemActive,
} from "#components/ui/ui-sdk/sidebar-nav-item.tsx";
import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";
import { Stat } from "#components/ui/ui-sdk/stat.tsx";
import { Status } from "#components/ui/ui-sdk/status.tsx";
import { Switch } from "#components/ui/ui-sdk/switch.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 { Toast, Toaster } from "#components/ui/ui-sdk/toast.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,
  greenPalette,
  redPalette,
} from "@stylexblocks/ui/themes/palettes.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 { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";
import { sizes } from "@stylexblocks/ui/tokens/sizes.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

export type ShellTopNavRoute =
  | "overview"
  | "pipelines"
  | "releases"
  | "metrics"
  | "settings";

type AudienceFilter = "all" | "public" | "internal";
type PipelineStatus = "passing" | "running" | "degraded";
type ReleaseChannel = "Production" | "Canary" | "Scheduled";
type MetricsRange = "1h" | "24h" | "7d" | "30d";

interface ServiceHealthItem {
  id: string;
  name: string;
  audience: "public" | "internal";
  region: string;
  uptime: string;
  latencyMs: number;
  state: "operational" | "degraded" | "maintenance";
  ticks: ReadonlyArray<"ok" | "warn">;
}

interface PipelineItem {
  id: string;
  name: string;
  branch: string;
  stage: string;
  progress: number;
  status: PipelineStatus;
  triggeredBy: string;
  duration: string;
  updatedAt: string;
}

interface ReleaseItem {
  id: string;
  version: string;
  channel: ReleaseChannel;
  summary: string;
  author: string;
  rollout: number;
  checksPassed: string;
  publishedAt: string;
}

interface NotificationItem {
  id: string;
  title: string;
  detail: string;
  time: string;
  route: ShellTopNavRoute;
  unread: boolean;
}

interface EscalationChannel {
  id: string;
  name: string;
  target: string;
  severity: string;
  enabled: boolean;
}

interface MetricsSnapshot {
  errorBudget: string;
  errorBudgetNote: string;
  requestsPerMin: string;
  requestsDelta: string;
  medianAck: string;
  ackDelta: string;
  webhookDelivery: string;
  webhookNote: string;
  regions: ReadonlyArray<{
    id: string;
    label: string;
    p50: string;
    p95: string;
    p99: string;
    successRate: number;
    load: number;
  }>;
}

const NARROW = "@container shell-top-nav (max-width: 820px)";
const MEDIUM = "@container shell-top-nav (max-width: 1024px)";
const COMPACT = "@container shell-top-nav (max-width: 560px)";

const ROUTES: ReadonlyArray<ShellTopNavRoute> = [
  "overview",
  "pipelines",
  "releases",
  "metrics",
  "settings",
];

const ROUTE_META: Record<
  ShellTopNavRoute,
  { label: string; eyebrow: string; description: string }
> = {
  overview: {
    label: "Overview",
    eyebrow: "Public & Internal Operations Hub",
    description:
      "Live availability across customer-facing status surfaces, internal telemetry pipelines, and regional edge probes.",
  },
  pipelines: {
    label: "Pipelines",
    eyebrow: "Continuous Verification",
    description:
      "Synthetic probe suites, status-page publishers, and automated failover checks across active branches.",
  },
  releases: {
    label: "Releases",
    eyebrow: "Rollout & Change Control",
    description:
      "Track progressive rollouts, promote verified canaries, and audit production changes tied to public advisories.",
  },
  metrics: {
    label: "Metrics",
    eyebrow: "SLO & Regional Telemetry",
    description:
      "Error-budget burn, percentile latency distributions, and webhook delivery performance by probe region.",
  },
  settings: {
    label: "Settings",
    eyebrow: "Hub & Escalation Policy",
    description:
      "Configure public status page visibility, maintenance banners, custom domains, and on-call routing targets.",
  },
};

const SERVICES: ReadonlyArray<ServiceHealthItem> = [
  {
    id: "svc-status-api",
    name: "Public Status API",
    audience: "public",
    region: "Global Anycast",
    uptime: "99.996%",
    latencyMs: 28,
    state: "operational",
    ticks: ["ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok"],
  },
  {
    id: "svc-webhooks",
    name: "Subscriber Webhook Fanout",
    audience: "public",
    region: "us-east · eu-central",
    uptime: "99.984%",
    latencyMs: 64,
    state: "operational",
    ticks: ["ok", "ok", "ok", "ok", "ok", "ok", "warn", "ok", "ok", "ok", "ok", "ok"],
  },
  {
    id: "svc-edge-ingest",
    name: "Edge Telemetry Ingest",
    audience: "internal",
    region: "9 Probe Regions",
    uptime: "99.991%",
    latencyMs: 34,
    state: "operational",
    ticks: ["ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok"],
  },
  {
    id: "svc-pager-bridge",
    name: "Incident Pager Bridge",
    audience: "internal",
    region: "eu-central-fra",
    uptime: "99.940%",
    latencyMs: 112,
    state: "degraded",
    ticks: ["ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "warn", "warn", "ok", "ok"],
  },
  {
    id: "svc-sso-gateway",
    name: "Public Portal & SSO",
    audience: "public",
    region: "Global Edge",
    uptime: "99.998%",
    latencyMs: 22,
    state: "operational",
    ticks: ["ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok"],
  },
  {
    id: "svc-compactor",
    name: "Metric Rollup Compactor",
    audience: "internal",
    region: "us-west-or",
    uptime: "99.972%",
    latencyMs: 49,
    state: "operational",
    ticks: ["ok", "ok", "ok", "warn", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok"],
  },
];

const INITIAL_PIPELINES: PipelineItem[] = [
  {
    id: "pipe-904",
    name: "beacon-edge-verify",
    branch: "main",
    stage: "9/9 regional probes verified",
    progress: 100,
    status: "passing",
    triggeredBy: "Soren Lindqvist",
    duration: "1m 18s",
    updatedAt: "6m ago",
  },
  {
    id: "pipe-903",
    name: "status-page-publish",
    branch: "main",
    stage: "CDN edge invalidation",
    progress: 74,
    status: "running",
    triggeredBy: "Amara Osei",
    duration: "42s",
    updatedAt: "Just now",
  },
  {
    id: "pipe-902",
    name: "alert-router-canary",
    branch: "feat/pager-retry-backoff",
    stage: "Retry queue latency check",
    progress: 62,
    status: "degraded",
    triggeredBy: "Hana Takahashi",
    duration: "2m 04s",
    updatedAt: "19m ago",
  },
  {
    id: "pipe-901",
    name: "tls-cert-auditor",
    branch: "scheduled/hourly",
    stage: "42 custom status domains valid",
    progress: 100,
    status: "passing",
    triggeredBy: "Cron Scheduler",
    duration: "27s",
    updatedAt: "38m ago",
  },
  {
    id: "pipe-900",
    name: "multi-region-failover",
    branch: "ops/dr-drill",
    stage: "DNS failover rehearsal passed",
    progress: 100,
    status: "passing",
    triggeredBy: "Devon Morales",
    duration: "3m 11s",
    updatedAt: "2h ago",
  },
];

const INITIAL_RELEASES: ReleaseItem[] = [
  {
    id: "rel-419c",
    version: "v4.19.0-canary.3",
    channel: "Canary",
    summary: "Adaptive jitter backoff for high-fanout subscriber webhooks",
    author: "Amara Osei",
    rollout: 25,
    checksPassed: "14/14 probes",
    publishedAt: "28m ago",
  },
  {
    id: "rel-4182",
    version: "v4.18.2",
    channel: "Production",
    summary: "Sub-second SSE status stream reconnect with delta replay",
    author: "Soren Lindqvist",
    rollout: 100,
    checksPassed: "14/14 probes",
    publishedAt: "Yesterday",
  },
  {
    id: "rel-4181",
    version: "v4.18.1",
    channel: "Production",
    summary: "Signed webhook payload rotation with dual-header verification",
    author: "Hana Takahashi",
    rollout: 100,
    checksPassed: "14/14 probes",
    publishedAt: "4d ago",
  },
  {
    id: "rel-4200",
    version: "v4.20.0-window",
    channel: "Scheduled",
    summary: "EU-Central TimescaleDB storage expansion (zero-downtime switch)",
    author: "Devon Morales",
    rollout: 0,
    checksPassed: "Preflight ready",
    publishedAt: "Thu 02:00 UTC",
  },
];

const INITIAL_NOTIFICATIONS: NotificationItem[] = [
  {
    id: "notif-1",
    title: "Canary v4.19.0-canary.3 at 25%",
    detail: "All 14 synthetic probes passing with 0 webhook retries.",
    time: "14m ago",
    route: "releases",
    unread: true,
  },
  {
    id: "notif-2",
    title: "Pager Bridge latency elevated",
    detail: "eu-central-fra ack latency peaked at 112ms during retry test.",
    time: "19m ago",
    route: "pipelines",
    unread: true,
  },
  {
    id: "notif-3",
    title: "Monthly SLA report compiled",
    detail: "Public availability stood at 99.992% across 30 days.",
    time: "3h ago",
    route: "metrics",
    unread: false,
  },
];

const METRICS_BY_RANGE: Record<MetricsRange, MetricsSnapshot> = {
  "1h": {
    errorBudget: "99.4%",
    errorBudgetNote: "0.02% burned in last hour",
    requestsPerMin: "84.2k",
    requestsDelta: "+6.4% vs baseline",
    medianAck: "410 ms",
    ackDelta: "-18 ms vs target",
    webhookDelivery: "99.98%",
    webhookNote: "142,810 deliveries · 0 dead-lettered",
    regions: [
      { id: "us-east-va", label: "US East · Ashburn", p50: "19 ms", p95: "34 ms", p99: "58 ms", successRate: 99.99, load: 64 },
      { id: "eu-central-fra", label: "EU Central · Frankfurt", p50: "24 ms", p95: "46 ms", p99: "94 ms", successRate: 99.95, load: 71 },
      { id: "ap-south-sin", label: "AP South · Singapore", p50: "29 ms", p95: "51 ms", p99: "79 ms", successRate: 99.99, load: 45 },
      { id: "us-west-or", label: "US West · Oregon", p50: "21 ms", p95: "37 ms", p99: "61 ms", successRate: 100, load: 52 },
      { id: "eu-north-arn", label: "EU North · Stockholm", p50: "18 ms", p95: "31 ms", p99: "52 ms", successRate: 100, load: 38 },
    ],
  },
  "24h": {
    errorBudget: "98.1%",
    errorBudgetNote: "41.8 min remaining in 30d window",
    requestsPerMin: "79.6k",
    requestsDelta: "+3.1% vs prior 24h",
    medianAck: "435 ms",
    ackDelta: "Within 500 ms SLO",
    webhookDelivery: "99.97%",
    webhookNote: "3.14M deliveries · 98% < 1s",
    regions: [
      { id: "us-east-va", label: "US East · Ashburn", p50: "20 ms", p95: "36 ms", p99: "62 ms", successRate: 99.99, load: 68 },
      { id: "eu-central-fra", label: "EU Central · Frankfurt", p50: "25 ms", p95: "49 ms", p99: "104 ms", successRate: 99.94, load: 74 },
      { id: "ap-south-sin", label: "AP South · Singapore", p50: "31 ms", p95: "54 ms", p99: "84 ms", successRate: 99.98, load: 49 },
      { id: "us-west-or", label: "US West · Oregon", p50: "22 ms", p95: "39 ms", p99: "66 ms", successRate: 99.99, load: 55 },
      { id: "eu-north-arn", label: "EU North · Stockholm", p50: "19 ms", p95: "33 ms", p99: "54 ms", successRate: 100, load: 41 },
    ],
  },
  "7d": {
    errorBudget: "96.4%",
    errorBudgetNote: "0 Sev-1 · 1 Sev-3 advisory",
    requestsPerMin: "76.1k",
    requestsDelta: "+8.9% week-over-week",
    medianAck: "420 ms",
    ackDelta: "-24 ms vs prior week",
    webhookDelivery: "99.96%",
    webhookNote: "21.9M deliveries · avg 380 ms",
    regions: [
      { id: "us-east-va", label: "US East · Ashburn", p50: "21 ms", p95: "38 ms", p99: "64 ms", successRate: 99.99, load: 66 },
      { id: "eu-central-fra", label: "EU Central · Frankfurt", p50: "24 ms", p95: "44 ms", p99: "89 ms", successRate: 99.97, load: 69 },
      { id: "ap-south-sin", label: "AP South · Singapore", p50: "30 ms", p95: "52 ms", p99: "81 ms", successRate: 99.98, load: 51 },
      { id: "us-west-or", label: "US West · Oregon", p50: "22 ms", p95: "40 ms", p99: "68 ms", successRate: 99.99, load: 57 },
      { id: "eu-north-arn", label: "EU North · Stockholm", p50: "19 ms", p95: "34 ms", p99: "57 ms", successRate: 100, load: 43 },
    ],
  },
  "30d": {
    errorBudget: "94.8%",
    errorBudgetNote: "Monthly SLA 99.992% achieved",
    requestsPerMin: "72.4k",
    requestsDelta: "+14.2% month-over-month",
    medianAck: "442 ms",
    ackDelta: "All regions under SLO",
    webhookDelivery: "99.98%",
    webhookNote: "94.6M deliveries · 100% signed",
    regions: [
      { id: "us-east-va", label: "US East · Ashburn", p50: "21 ms", p95: "37 ms", p99: "63 ms", successRate: 99.99, load: 65 },
      { id: "eu-central-fra", label: "EU Central · Frankfurt", p50: "23 ms", p95: "43 ms", p99: "86 ms", successRate: 99.98, load: 67 },
      { id: "ap-south-sin", label: "AP South · Singapore", p50: "29 ms", p95: "50 ms", p99: "78 ms", successRate: 99.99, load: 48 },
      { id: "us-west-or", label: "US West · Oregon", p50: "21 ms", p95: "38 ms", p99: "65 ms", successRate: 99.99, load: 54 },
      { id: "eu-north-arn", label: "EU North · Stockholm", p50: "18 ms", p95: "32 ms", p99: "53 ms", successRate: 100, load: 40 },
    ],
  },
};

const INITIAL_CHANNELS: EscalationChannel[] = [
  {
    id: "ch-pager",
    name: "PagerDuty · Primary On-Call",
    target: "beacon-sre-primary",
    severity: "Sev-1 & Sev-2",
    enabled: true,
  },
  {
    id: "ch-slack",
    name: "Slack · #ops-beacon-live",
    target: "webhook/T04BEACON/ops",
    severity: "All advisories",
    enabled: true,
  },
  {
    id: "ch-rss",
    name: "Public Atom / Webhook Digest",
    target: "status.beaconstatus.io/feed.atom",
    severity: "Public incidents",
    enabled: true,
  },
];

const UPCOMING_WINDOWS = [
  {
    id: "win-1",
    title: "EU-Central TimescaleDB storage expansion",
    schedule: "Thu · 02:00 – 02:30 UTC",
    impact: "Zero customer downtime · brief ingest buffer",
  },
  {
    id: "win-2",
    title: "Root CA bundle refresh across AP probes",
    schedule: "Mon · 04:00 – 04:15 UTC",
    impact: "Rolling restart · synthetic checks uninterrupted",
  },
] as const;

function BeaconMark() {
  return (
    <svg
      width="22"
      height="22"
      viewBox="0 0 22 22"
      fill="none"
      aria-hidden="true"
    >
      <rect width="22" height="22" rx="6" fill="currentColor" />
      <circle
        cx="11"
        cy="11"
        r="2.4"
        fill="var(--sui-colors-bg, #ffffff)"
      />
      <path
        d="M7.1 7.6a5.2 5.2 0 0 0 0 6.8M14.9 7.6a5.2 5.2 0 0 1 0 6.8"
        stroke="var(--sui-colors-bg, #ffffff)"
        strokeWidth="1.6"
        strokeLinecap="round"
      />
    </svg>
  );
}

function RouteGlyph({ route }: { route: ShellTopNavRoute }) {
  switch (route) {
    case "overview":
      return (
        <>
          <circle cx="10" cy="10" r="6.5" />
          <path d="M5.5 10h2.25l1.5-2.75 1.75 5.5 1.25-2.75h2.25" />
        </>
      );
    case "pipelines":
      return (
        <>
          <circle cx="5" cy="6" r="1.75" />
          <circle cx="15" cy="6" r="1.75" />
          <circle cx="10" cy="14.5" r="1.75" />
          <path d="M6.75 6h6.5M5.75 7.6l3.2 5.4M14.25 7.6l-3.2 5.4" />
        </>
      );
    case "releases":
      return (
        <>
          <path d="M10 3.25v9.5" />
          <path d="M6.5 6.75 10 3.25l3.5 3.5" />
          <rect x="3.5" y="14.5" width="13" height="2.25" rx="1" />
        </>
      );
    case "metrics":
      return (
        <>
          <path d="M3.75 15.75h12.5" />
          <rect x="5" y="10.25" width="2.25" height="5.5" rx="0.6" />
          <rect x="8.875" y="6.75" width="2.25" height="9" rx="0.6" />
          <rect x="12.75" y="4.25" width="2.25" height="11.5" rx="0.6" />
        </>
      );
    case "settings":
      return (
        <>
          <path d="M4 6.25h12" />
          <path d="M4 13.75h12" />
          <circle cx="7.75" cy="6.25" r="1.75" fill="currentColor" />
          <circle cx="12.5" cy="13.75" r="1.75" fill="currentColor" />
        </>
      );
  }
}

const styles = stylex.create({
  root: {
    backgroundColor: semanticColors.bg,
    color: semanticColors.fg,
    containerName: "shell-top-nav",
    containerType: "inline-size",
    fontFamily: fonts.body,
    height: "100%",
    minHeight: 0,
    overflow: "hidden",
    width: "100%",
  },
  shrink0: {
    flexShrink: 0,
  },
  fullWidth: {
    width: "100%",
  },
  navbar: {
    "--navbar-height": "3.75rem",
    borderBottomColor: semanticColors.border,
    borderBottomStyle: "solid",
    borderBottomWidth: "1px",
    flexShrink: 0,
    paddingInline: {
      default: spacing._6,
      [NARROW]: spacing._4,
    },
  },
  navbarContent: {
    marginInline: "auto",
    maxWidth: "70rem",
  },
  mobileMenuTrigger: {
    display: {
      default: "none",
      [NARROW]: "inline-flex",
    },
  },
  brandButton: {
    alignItems: "center",
    backgroundColor: "transparent",
    borderStyle: "none",
    borderWidth: 0,
    color: "inherit",
    cursor: "pointer",
    display: "inline-flex",
    gap: spacing._2_5,
    paddingBlock: 0,
    paddingInline: 0,
    textAlign: "start",
  },
  brandMark: {
    alignItems: "center",
    color: semanticColors.accentSolid,
    display: "inline-flex",
    flexShrink: 0,
  },
  brandTitle: {
    letterSpacing: "-0.015em",
  },
  brandBadge: {
    display: {
      default: "inline-flex",
      [MEDIUM]: "none",
    },
  },
  primaryNavGroup: {
    display: {
      default: "flex",
      [NARROW]: "none",
    },
    gap: spacing._1,
  },
  navLinkButton: {
    appearance: "none",
    borderStyle: "none",
    borderWidth: 0,
    color: semanticColors.fgMuted,
    cursor: "pointer",
    fontFamily: fonts.body,
    fontSize: fontSizes.sm,
    fontWeight: fontWeights.medium,
    gap: spacing._1_5,
  },
  navLinkActive: {
    backgroundColor: semanticColors.bgMuted,
    color: semanticColors.fg,
    fontWeight: fontWeights.semibold,
  },
  searchTrigger: {
    alignItems: "center",
    backgroundColor: {
      default: semanticColors.bgMuted,
      ":hover": semanticColors.bgSubtle,
    },
    borderColor: semanticColors.border,
    borderRadius: semanticRadii.control,
    borderStyle: "solid",
    borderWidth: "1px",
    color: semanticColors.fgMuted,
    cursor: "pointer",
    display: "inline-flex",
    fontFamily: fonts.body,
    fontSize: fontSizes.sm,
    gap: spacing._2,
    height: sizes.controlSm,
    justifyContent: "space-between",
    paddingInline: spacing._2_5,
    width: {
      default: "13rem",
      [MEDIUM]: "auto",
    },
  },
  searchTriggerLabel: {
    alignItems: "center",
    display: "inline-flex",
    gap: spacing._2,
    minWidth: 0,
    overflow: "hidden",
    textOverflow: "ellipsis",
    whiteSpace: "nowrap",
  },
  searchPlaceholderText: {
    display: {
      default: "inline",
      [MEDIUM]: "none",
    },
  },
  searchKbd: {
    display: {
      default: "inline-flex",
      [MEDIUM]: "none",
    },
  },
  iconButtonWrap: {
    display: "inline-flex",
    position: "relative",
  },
  unreadDot: {
    backgroundColor: semanticColors.accentSolid,
    borderColor: semanticColors.bgPanel,
    borderRadius: radii.full,
    borderStyle: "solid",
    borderWidth: "1.5px",
    height: "0.5rem",
    pointerEvents: "none",
    position: "absolute",
    right: "0.35rem",
    top: "0.35rem",
    width: "0.5rem",
  },
  avatarTrigger: {
    paddingInline: spacing._1,
  },
  popoverContent: {
    "--popover-size": "21rem",
  },
  popoverHeaderRow: {
    paddingBottom: spacing._2,
  },
  notifButton: {
    backgroundColor: {
      default: "transparent",
      ":hover": semanticColors.bgSubtle,
    },
    borderRadius: semanticRadii.control,
    borderStyle: "none",
    borderWidth: 0,
    color: "inherit",
    cursor: "pointer",
    display: "flex",
    flexDirection: "column",
    gap: spacing._1,
    paddingBlock: spacing._2,
    paddingInline: spacing._2,
    textAlign: "start",
    width: "100%",
  },
  menuWidth: {
    minWidth: "14rem",
  },
  userMenuHeader: {
    paddingBlock: spacing._1_5,
    paddingInline: spacing._2,
  },
  main: {
    backgroundColor: semanticColors.bgContent,
    overflowY: "auto",
  },
  mainInner: {
    marginInline: "auto",
    maxWidth: "70rem",
    paddingBlock: spacing._6,
    paddingInline: {
      default: spacing._6,
      [NARROW]: spacing._4,
    },
    width: "100%",
  },
  pageHeader: {
    alignItems: {
      default: "flex-end",
      [NARROW]: "flex-start",
    },
    flexDirection: {
      default: "row",
      [NARROW]: "column",
    },
  },
  eyebrowRow: {
    color: semanticColors.fgMuted,
    fontSize: fontSizes.xs,
  },
  pageTitle: {
    marginBlock: 0,
  },
  pageSubtitle: {
    maxWidth: "46rem",
  },
  alertRow: {
    alignItems: {
      default: "center",
      [COMPACT]: "flex-start",
    },
    flexDirection: {
      default: "row",
      [COMPACT]: "column",
    },
    width: "100%",
  },
  statGrid: {
    gridTemplateColumns: {
      default: "repeat(4, minmax(0, 1fr))",
      [MEDIUM]: "repeat(2, minmax(0, 1fr))",
      [COMPACT]: "minmax(0, 1fr)",
    },
  },
  twoColGrid: {
    gridTemplateColumns: {
      default: "minmax(0, 1.55fr) minmax(0, 1fr)",
      [NARROW]: "minmax(0, 1fr)",
    },
  },
  equalTwoColGrid: {
    gridTemplateColumns: {
      default: "repeat(2, minmax(0, 1fr))",
      [NARROW]: "minmax(0, 1fr)",
    },
  },
  cardHeaderRow: {
    alignItems: "center",
    display: "flex",
    flexDirection: "row",
    flexWrap: "wrap",
    gap: spacing._3,
    justifyContent: "space-between",
  },
  cardTitleReset: {
    marginBlock: 0,
  },
  cardDescReset: {
    marginBlock: 0,
  },
  searchInputWrap: {
    flexBasis: "16rem",
    flexGrow: 1,
    maxWidth: "22rem",
    minWidth: "12rem",
  },
  serviceRow: {
    alignItems: {
      default: "center",
      [COMPACT]: "flex-start",
    },
    backgroundColor: semanticColors.bg,
    borderColor: semanticColors.borderSubtle,
    borderRadius: semanticRadii.control,
    borderStyle: "solid",
    borderWidth: "1px",
    flexDirection: {
      default: "row",
      [COMPACT]: "column",
    },
    paddingBlock: spacing._2_5,
    paddingInline: spacing._3,
  },
  sparkStrip: {
    alignItems: "center",
    display: "inline-flex",
    gap: "2px",
  },
  sparkBarOk: {
    backgroundColor: semanticColors.greenSolid,
    borderRadius: "1px",
    height: "14px",
    opacity: 0.85,
    width: "4px",
  },
  sparkBarWarn: {
    backgroundColor: semanticColors.amberSolid,
    borderRadius: "1px",
    height: "14px",
    width: "4px",
  },
  uptimeReadout: {
    gap: "2px",
    minWidth: "4.5rem",
    textAlign: "end",
  },
  windowItem: {
    backgroundColor: semanticColors.bg,
    borderColor: semanticColors.borderSubtle,
    borderRadius: semanticRadii.control,
    borderStyle: "solid",
    borderWidth: "1px",
    paddingBlock: spacing._2_5,
    paddingInline: spacing._3,
  },
  tableWrap: {
    overflowX: "auto",
    width: "100%",
  },
  progressCell: {
    minWidth: "9.5rem",
  },
  releaseCardBody: {
    display: "flex",
    flexDirection: "column",
    gap: spacing._3,
  },
  releaseTopRow: {
    alignItems: {
      default: "center",
      [COMPACT]: "flex-start",
    },
    flexDirection: {
      default: "row",
      [COMPACT]: "column",
    },
  },
  rolloutWrap: {
    maxWidth: "24rem",
    width: "100%",
  },
  toggleRow: {
    paddingBlock: spacing._1_5,
  },
  formInputGrow: {
    flexBasis: "14rem",
    flexGrow: 1,
    minWidth: "11rem",
  },
  drawerBody: {
    display: "flex",
    flexDirection: "column",
    gap: spacing._4,
    paddingInline: spacing._3,
  },
  drawerNavList: {
    listStyle: "none",
    marginBlock: 0,
    marginInline: 0,
    paddingBlock: 0,
    paddingInline: 0,
  },
  drawerStatusCard: {
    backgroundColor: semanticColors.bg,
    borderColor: semanticColors.border,
    borderRadius: semanticRadii.control,
    borderStyle: "solid",
    borderWidth: "1px",
    paddingBlock: spacing._2_5,
    paddingInline: spacing._3,
  },
  paletteDialogBody: {
    display: "flex",
    flexDirection: "column",
    gap: spacing._3,
  },
  paletteResults: {
    maxHeight: "18rem",
    overflowY: "auto",
  },
  paletteItem: {
    alignItems: "center",
    backgroundColor: {
      default: "transparent",
      ":hover": semanticColors.bgSubtle,
    },
    borderRadius: semanticRadii.control,
    borderStyle: "none",
    borderWidth: 0,
    color: semanticColors.fg,
    cursor: "pointer",
    display: "flex",
    fontFamily: fonts.body,
    fontSize: fontSizes.sm,
    gap: spacing._3,
    justifyContent: "space-between",
    paddingBlock: spacing._2,
    paddingInline: spacing._2_5,
    textAlign: "start",
    width: "100%",
  },
  emptyStateText: {
    paddingBlock: spacing._6,
  },
});

export interface ShellTopNavProps extends StyleOverrideProps {
  /** Initial active top-level route. Defaults to `"overview"`. */
  defaultRoute?: ShellTopNavRoute;
}

export function ShellTopNav({
  defaultRoute = "overview",
  palette,
  style,
}: ShellTopNavProps) {
  const queue = useMemo(() => Toast.createToaster(), []);

  const [activeRoute, setActiveRoute] = useState<ShellTopNavRoute>(defaultRoute);
  const [mobileNavOpen, setMobileNavOpen] = useState(false);
  const [searchOpen, setSearchOpen] = useState(false);
  const [searchQuery, setSearchQuery] = useState("");

  const [audienceFilter, setAudienceFilter] = useState<AudienceFilter>("all");
  const [pipelines, setPipelines] = useState<PipelineItem[]>(INITIAL_PIPELINES);
  const [pipelineSearch, setPipelineSearch] = useState("");
  const [pipelineFilter, setPipelineFilter] = useState<"all" | PipelineStatus>("all");

  const [releases, setReleases] = useState<ReleaseItem[]>(INITIAL_RELEASES);
  const [releaseFilter, setReleaseFilter] = useState<"All" | ReleaseChannel>("All");

  const [metricsRange, setMetricsRange] = useState<MetricsRange>("24h");

  const [notifications, setNotifications] =
    useState<NotificationItem[]>(INITIAL_NOTIFICATIONS);

  const [publicPageVisible, setPublicPageVisible] = useState(true);
  const [maintenanceBanner, setMaintenanceBanner] = useState(false);
  const [autoPostResolved, setAutoPostResolved] = useState(true);
  const [allowSubscriptions, setAllowSubscriptions] = useState(true);
  const [statusDomain, setStatusDomain] = useState("status.beaconstatus.io");
  const [channels, setChannels] = useState<EscalationChannel[]>(INITIAL_CHANNELS);

  const unreadCount = useMemo(
    () => notifications.filter((item) => item.unread).length,
    [notifications],
  );

  const runningPipelinesCount = useMemo(
    () => pipelines.filter((p) => p.status === "running").length,
    [pipelines],
  );

  const degradedCount = useMemo(
    () => pipelines.filter((p) => p.status === "degraded").length,
    [pipelines],
  );

  const navigateTo = useCallback((route: ShellTopNavRoute) => {
    setActiveRoute(route);
    setMobileNavOpen(false);
  }, []);

  const triggerSyntheticProbe = useCallback(() => {
    const nextNumber = 905 + pipelines.length;
    const nextRun: PipelineItem = {
      id: `pipe-${nextNumber}`,
      name: "beacon-edge-verify",
      branch: "main",
      stage: "9/9 regional probes verified",
      progress: 100,
      status: "passing",
      triggeredBy: "Soren Lindqvist",
      duration: "54s",
      updatedAt: "Just now",
    };
    setPipelines((prev) => [nextRun, ...prev]);
    queue.success("Synthetic probe suite passed", {
      description: `Run ${nextRun.id} verified all 9 global probe regions in 54s.`,
    });
  }, [pipelines.length, queue]);

  const rerunPipeline = useCallback(
    (item: PipelineItem) => {
      setPipelines((prev) =>
        prev.map((row) =>
          row.id === item.id
            ? {
                ...row,
                status: "passing",
                progress: 100,
                stage: "Re-verified cleanly",
                duration: "49s",
                updatedAt: "Just now",
              }
            : row,
        ),
      );
      queue.success(`Re-ran ${item.name}`, {
        description: `${item.branch} passed all verification stages.`,
      });
    },
    [queue],
  );

  const promoteRelease = useCallback(
    (release: ReleaseItem) => {
      setReleases((prev) =>
        prev.map((item) =>
          item.id === release.id
            ? {
                ...item,
                channel: "Production",
                rollout: 100,
                publishedAt: "Just now",
              }
            : item,
        ),
      );
      queue.success(`Promoted ${release.version} to 100%`, {
        description: "Production fleet updated with zero dropped probes.",
      });
    },
    [queue],
  );

  const cutRelease = useCallback(() => {
    const nextMinor = 20 + releases.length;
    const nextVersion = `v4.${nextMinor}.0-canary.1`;
    setReleases((prev) => [
      {
        id: `rel-${Date.now()}`,
        version: nextVersion,
        channel: "Canary",
        summary: "Updated synthetic probe jitter ceiling and SSE heartbeat cadence",
        author: "Soren Lindqvist",
        rollout: 15,
        checksPassed: "14/14 probes",
        publishedAt: "Just now",
      },
      ...prev,
    ]);
    queue.success(`Cut canary ${nextVersion}`, {
      description: "Serving 15% of internal telemetry traffic for verification.",
    });
  }, [queue, releases.length]);

  useEffect(() => {
    const handleKeyDown = (event: KeyboardEvent) => {
      if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
        event.preventDefault();
        setSearchOpen((prev) => !prev);
      }
    };
    window.addEventListener("keydown", handleKeyDown);
    return () => window.removeEventListener("keydown", handleKeyDown);
  }, []);

  const filteredServices = useMemo(() => {
    if (audienceFilter === "all") return SERVICES;
    return SERVICES.filter((svc) => svc.audience === audienceFilter);
  }, [audienceFilter]);

  const filteredPipelines = useMemo(() => {
    const q = pipelineSearch.trim().toLowerCase();
    return pipelines.filter((item) => {
      if (pipelineFilter !== "all" && item.status !== pipelineFilter) {
        return false;
      }
      if (!q) return true;
      return (
        item.name.toLowerCase().includes(q) ||
        item.branch.toLowerCase().includes(q) ||
        item.stage.toLowerCase().includes(q) ||
        item.triggeredBy.toLowerCase().includes(q)
      );
    });
  }, [pipelineFilter, pipelineSearch, pipelines]);

  const filteredReleases = useMemo(() => {
    if (releaseFilter === "All") return releases;
    return releases.filter((item) => item.channel === releaseFilter);
  }, [releaseFilter, releases]);

  const activeMetrics = METRICS_BY_RANGE[metricsRange];

  const paletteCommands = useMemo(() => {
    const items: Array<{
      id: string;
      label: string;
      category: string;
      hint: string;
      run: () => void;
    }> = [
      ...ROUTES.map((route) => ({
        id: `route-${route}`,
        label: ROUTE_META[route].label,
        category: "Route",
        hint: ROUTE_META[route].eyebrow,
        run: () => navigateTo(route),
      })),
      {
        id: "action-probe",
        label: "Run global synthetic probe suite",
        category: "Action",
        hint: "9 regions",
        run: () => {
          triggerSyntheticProbe();
          navigateTo("pipelines");
        },
      },
      {
        id: "action-maintenance",
        label: maintenanceBanner
          ? "Disable scheduled maintenance banner"
          : "Enable scheduled maintenance banner",
        category: "Policy",
        hint: "Public status",
        run: () => {
          setMaintenanceBanner((prev) => {
            const next = !prev;
            queue.info(
              next
                ? "Maintenance banner published to status hub"
                : "Maintenance banner cleared",
            );
            return next;
          });
        },
      },
      {
        id: "action-release",
        label: "Cut new canary release",
        category: "Release",
        hint: "Canary · 15%",
        run: () => {
          cutRelease();
          navigateTo("releases");
        },
      },
    ];

    const q = searchQuery.trim().toLowerCase();
    if (!q) return items;
    return items.filter(
      (item) =>
        item.label.toLowerCase().includes(q) ||
        item.category.toLowerCase().includes(q) ||
        item.hint.toLowerCase().includes(q),
    );
  }, [
    cutRelease,
    maintenanceBanner,
    navigateTo,
    queue,
    searchQuery,
    triggerSyntheticProbe,
  ]);

  const handleSaveDomain = (event: React.FormEvent) => {
    event.preventDefault();
    const trimmed = statusDomain.trim();
    if (!trimmed) {
      queue.warning("Enter a valid public status domain");
      return;
    }
    queue.success(`Saved domain ${trimmed}`, {
      description: "TLS certificate and edge DNS routing verified.",
    });
  };

  return (
    <AppShell.Root palette={palette} style={[styles.root, style]}>
      <Navbar.Root variant="neutral" size="md" style={styles.navbar}>
        <Navbar.Content style={styles.navbarContent}>
          <HStack gap="2.5">
            <IconButton
              variant="ghost"
              size="sm"
              aria-label="Open navigation menu"
              style={styles.mobileMenuTrigger}
              onClick={() => setMobileNavOpen(true)}
            >
              <Icon
                size="sm"
                viewBox="0 0 20 20"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.6"
                strokeLinecap="round"
                aria-hidden="true"
              >
                <path d="M3.5 5.5h13" />
                <path d="M3.5 10h13" />
                <path d="M3.5 14.5h13" />
              </Icon>
            </IconButton>

            <Navbar.Brand
              render={<button type="button" />}
              style={styles.brandButton}
              onClick={() => navigateTo("overview")}
            >
              <span {...stylex.props(styles.brandMark)}>
                <BeaconMark />
              </span>
              <HStack render={<span />} gap="2">
                <Text
                  render={<span />}
                  size="sm"
                  weight="semibold"
                  style={styles.brandTitle}
                >
                  Beacon Status
                </Text>
                <Badge
                  variant="subtle"
                  size="xs"
                  palette={maintenanceBanner ? amberPalette : greenPalette}
                  style={styles.brandBadge}
                >
                  {maintenanceBanner ? "Maintenance" : "Ops Hub"}
                </Badge>
              </HStack>
            </Navbar.Brand>
          </HStack>

          <Navbar.ItemGroup
            aria-label="Primary navigation"
            style={styles.primaryNavGroup}
          >
            {ROUTES.map((route) => {
              const active = activeRoute === route;
              return (
                <Navbar.Link
                  key={route}
                  render={<button type="button" />}
                  aria-current={active ? "page" : undefined}
                  style={[styles.navLinkButton, active && styles.navLinkActive]}
                  onClick={() => navigateTo(route)}
                >
                  <span>{ROUTE_META[route].label}</span>
                  {route === "pipelines" && runningPipelinesCount > 0 ? (
                    <Badge variant="subtle" size="xs" palette={bluePalette}>
                      {runningPipelinesCount}
                    </Badge>
                  ) : null}
                </Navbar.Link>
              );
            })}
          </Navbar.ItemGroup>

          <HStack gap="2" style={styles.shrink0}>
            <button
              type="button"
              aria-label="Search routes and operational commands"
              onClick={() => setSearchOpen(true)}
              {...stylex.props(styles.searchTrigger)}
            >
              <span {...stylex.props(styles.searchTriggerLabel)}>
                <Icon
                  size="xs"
                  viewBox="0 0 16 16"
                  fill="none"
                  stroke="currentColor"
                  strokeWidth="1.5"
                  strokeLinecap="round"
                  aria-hidden="true"
                >
                  <circle cx="7.25" cy="7.25" r="4.5" />
                  <path d="m10.75 10.75 2.75 2.75" />
                </Icon>
                <span {...stylex.props(styles.searchPlaceholderText)}>
                  Search hub…
                </span>
              </span>
              <Kbd size="xs" variant="outline" style={styles.searchKbd}>
                ⌘K
              </Kbd>
            </button>

            <Popover.Root size="sm">
              <div {...stylex.props(styles.iconButtonWrap)}>
                <Popover.Trigger
                  render={
                    <IconButton
                      variant="ghost"
                      size="sm"
                      aria-label={`Notifications (${unreadCount} unread)`}
                    />
                  }
                >
                  <Icon
                    size="sm"
                    viewBox="0 0 20 20"
                    fill="none"
                    stroke="currentColor"
                    strokeWidth="1.5"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                    aria-hidden="true"
                  >
                    <path d="M5.5 8.5a4.5 4.5 0 1 1 9 0c0 3 1.25 4.5 1.75 5.25H3.75C4.25 13 5.5 11.5 5.5 8.5Z" />
                    <path d="M8.5 16a1.75 1.75 0 0 0 3 0" />
                  </Icon>
                </Popover.Trigger>
                {unreadCount > 0 ? (
                  <span {...stylex.props(styles.unreadDot)} aria-hidden="true" />
                ) : null}
              </div>

              <Popover.Content align="end" style={styles.popoverContent}>
                <Popover.Header>
                  <HStack justify="between" style={styles.popoverHeaderRow}>
                    <Popover.Title>Operations Feed</Popover.Title>
                    {unreadCount > 0 ? (
                      <Button
                        variant="plain"
                        size="xs"
                        onClick={() => {
                          setNotifications((prev) =>
                            prev.map((n) => ({ ...n, unread: false })),
                          );
                          queue.info("All operational alerts marked as read");
                        }}
                      >
                        Mark all read
                      </Button>
                    ) : null}
                  </HStack>
                </Popover.Header>
                <Separator />
                <Popover.Body>
                  <VStack gap="1.5">
                    {notifications.map((notif) => (
                      <button
                        key={notif.id}
                        type="button"
                        onClick={() => {
                          setNotifications((prev) =>
                            prev.map((n) =>
                              n.id === notif.id ? { ...n, unread: false } : n,
                            ),
                          );
                          navigateTo(notif.route);
                        }}
                        {...stylex.props(styles.notifButton)}
                      >
                        <HStack
                          gap="2"
                          justify="between"
                          style={styles.fullWidth}
                        >
                          <Text render={<span />} size="sm" weight="medium">
                            {notif.title}
                          </Text>
                          {notif.unread ? (
                            <Badge
                              variant="subtle"
                              size="xs"
                              palette={accentPalette}
                            >
                              New
                            </Badge>
                          ) : (
                            <Text render={<span />} size="xs" tone="muted">
                              {notif.time}
                            </Text>
                          )}
                        </HStack>
                        <Text render={<span />} size="xs" tone="muted">
                          {notif.detail}
                        </Text>
                      </button>
                    ))}
                  </VStack>
                </Popover.Body>
              </Popover.Content>
            </Popover.Root>

            <Menu.Root size="md">
              <Menu.Trigger
                render={
                  <Button
                    variant="ghost"
                    size="sm"
                    aria-label="Account menu"
                    style={styles.avatarTrigger}
                  />
                }
              >
                <Avatar.Root
                  size="sm"
                  variant="subtle"
                  palette={accentPalette}
                >
                  <Avatar.Fallback>SL</Avatar.Fallback>
                </Avatar.Root>
              </Menu.Trigger>
              <Menu.Content align="end" style={styles.menuWidth}>
                <VStack gap="0.5" style={styles.userMenuHeader}>
                  <Text render={<span />} size="sm" weight="semibold">
                    Soren Lindqvist
                  </Text>
                  <Text render={<span />} size="xs" tone="muted">
                    soren@beaconstatus.io · Principal SRE
                  </Text>
                </VStack>
                <Menu.Separator />
                <Menu.Item
                  onSelect={() =>
                    queue.info(`Opening ${statusDomain}`, {
                      description: publicPageVisible
                        ? "Public status page is live for external subscribers."
                        : "Public status page is currently restricted to internal SSO.",
                    })
                  }
                >
                  <Menu.ItemText>View public status page</Menu.ItemText>
                </Menu.Item>
                <Menu.Item onSelect={() => navigateTo("settings")}>
                  <Menu.ItemText>Hub &amp; escalation settings</Menu.ItemText>
                </Menu.Item>
                <Menu.Item onSelect={() => setSearchOpen(true)}>
                  <Menu.ItemText>Command palette</Menu.ItemText>
                  <Menu.ItemCommand>⌘K</Menu.ItemCommand>
                </Menu.Item>
                <Menu.Separator />
                <Menu.Item
                  destructive
                  onSelect={() =>
                    queue.info("Signed out of Beacon Status", {
                      description: "SSO session cleared for this browser.",
                    })
                  }
                >
                  <Menu.ItemText>Sign out</Menu.ItemText>
                </Menu.Item>
              </Menu.Content>
            </Menu.Root>
          </HStack>
        </Navbar.Content>
      </Navbar.Root>

      <AppShell.Content>
        <AppShell.Main style={styles.main}>
          <VStack gap="6" style={styles.mainInner}>
            <HStack
              render={<header />}
              gap="4"
              justify="between"
              style={styles.pageHeader}
            >
              <VStack gap="1">
                <HStack gap="2" style={styles.eyebrowRow}>
                  <span>Beacon Status</span>
                  <span aria-hidden="true">/</span>
                  <span>{ROUTE_META[activeRoute].eyebrow}</span>
                </HStack>
                <Heading render={<h1 />} size="2xl" style={styles.pageTitle}>
                  {ROUTE_META[activeRoute].label}
                </Heading>
                <Text size="sm" tone="muted" style={styles.pageSubtitle}>
                  {ROUTE_META[activeRoute].description}
                </Text>
              </VStack>

              <HStack gap="2" wrap="wrap">
                {activeRoute === "overview" ? (
                  <>
                    <Button
                      variant="surface"
                      size="sm"
                      onClick={() => navigateTo("metrics")}
                    >
                      Inspect SLOs
                    </Button>
                    <Button
                      variant="solid"
                      size="sm"
                      palette={accentPalette}
                      onClick={triggerSyntheticProbe}
                    >
                      Run synthetic probe
                    </Button>
                  </>
                ) : null}

                {activeRoute === "pipelines" ? (
                  <Button
                    variant="solid"
                    size="sm"
                    palette={accentPalette}
                    onClick={triggerSyntheticProbe}
                  >
                    Trigger probe run
                  </Button>
                ) : null}

                {activeRoute === "releases" ? (
                  <Button
                    variant="solid"
                    size="sm"
                    palette={accentPalette}
                    onClick={cutRelease}
                  >
                    Cut canary release
                  </Button>
                ) : null}

                {activeRoute === "metrics" ? (
                  <Button
                    variant="surface"
                    size="sm"
                    onClick={() =>
                      queue.success(`Exported ${metricsRange} telemetry CSV`, {
                        description:
                          "Includes per-region p50/p95/p99 latency and error budget logs.",
                      })
                    }
                  >
                    Export CSV
                  </Button>
                ) : null}

                {activeRoute === "settings" ? (
                  <Button
                    variant="surface"
                    size="sm"
                    onClick={() =>
                      queue.info("Test escalation dispatched", {
                        description:
                          "Verified delivery across all enabled on-call targets.",
                      })
                    }
                  >
                    Send test alert
                  </Button>
                ) : null}
              </HStack>
            </HStack>

            {activeRoute === "overview" ? (
              <>
                <Alert.Root
                  variant="subtle"
                  size="md"
                  status={maintenanceBanner ? "warning" : "success"}
                  palette={maintenanceBanner ? amberPalette : greenPalette}
                >
                  <Alert.Indicator>
                    <Status.Root
                      size="md"
                      palette={maintenanceBanner ? amberPalette : greenPalette}
                    >
                      <Status.Indicator />
                    </Status.Root>
                  </Alert.Indicator>
                  <Alert.Content>
                    <HStack gap="3" justify="between" style={styles.alertRow}>
                      <VStack gap="0.5">
                        <Alert.Title>
                          {maintenanceBanner
                            ? "Scheduled Maintenance Banner Active"
                            : "All Public Surfaces Operational"}
                        </Alert.Title>
                        <Alert.Description>
                          {maintenanceBanner
                            ? `Public visitors on ${statusDomain} see the EU-Central storage expansion notice.`
                            : `5 of 6 monitored components are fully green; Incident Pager Bridge shows minor internal retry latency.`}
                        </Alert.Description>
                      </VStack>
                      <Button
                        variant="surface"
                        size="xs"
                        onClick={() => {
                          setMaintenanceBanner((prev) => {
                            const next = !prev;
                            queue.info(
                              next
                                ? "Maintenance banner enabled"
                                : "Maintenance banner cleared",
                            );
                            return next;
                          });
                        }}
                      >
                        {maintenanceBanner
                          ? "Clear banner"
                          : "Toggle maintenance"}
                      </Button>
                    </HStack>
                  </Alert.Content>
                </Alert.Root>

                <Grid gap="4" style={styles.statGrid}>
                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Public Availability (30d)</Stat.Label>
                        <Stat.ValueText>99.992%</Stat.ValueText>
                        <Stat.HelpText>+0.002% above 99.99% SLA</Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>

                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Global P95 Probe</Stat.Label>
                        <Stat.ValueText>38 ms</Stat.ValueText>
                        <Stat.HelpText>Across 9 edge verification PoPs</Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>

                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Active Pipelines</Stat.Label>
                        <Stat.ValueText>{pipelines.length}</Stat.ValueText>
                        <Stat.HelpText>
                          {runningPipelinesCount} running · {degradedCount} degraded
                        </Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>

                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Subscriber Webhooks</Stat.Label>
                        <Stat.ValueText>99.98%</Stat.ValueText>
                        <Stat.HelpText>18,420 active endpoints</Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>
                </Grid>

                <Grid gap="4" style={styles.twoColGrid}>
                  <Card.Root variant="outline" size="md">
                    <Card.Header style={styles.cardHeaderRow}>
                      <VStack gap="1">
                        <Card.Title style={styles.cardTitleReset}>
                          Component Health Matrix
                        </Card.Title>
                        <Card.Description style={styles.cardDescReset}>
                          Filter public customer surfaces and internal ops services
                        </Card.Description>
                      </VStack>
                      <HStack gap="1.5" wrap="wrap">
                        {(["all", "public", "internal"] as const).map((scope) => (
                          <Button
                            key={scope}
                            variant={audienceFilter === scope ? "solid" : "ghost"}
                            size="xs"
                            palette={
                              audienceFilter === scope ? accentPalette : undefined
                            }
                            onClick={() => setAudienceFilter(scope)}
                          >
                            {scope === "all"
                              ? "All"
                              : scope === "public"
                                ? "Public"
                                : "Internal"}
                          </Button>
                        ))}
                      </HStack>
                    </Card.Header>
                    <Card.Body>
                      <VStack gap="2.5">
                        {filteredServices.map((svc) => (
                          <HStack
                            key={svc.id}
                            gap="3"
                            justify="between"
                            style={styles.serviceRow}
                          >
                            <VStack gap="1">
                              <HStack gap="2" wrap="wrap">
                                <Status.Root
                                  size="sm"
                                  palette={
                                    svc.state === "operational"
                                      ? greenPalette
                                      : amberPalette
                                  }
                                >
                                  <Status.Indicator />
                                </Status.Root>
                                <Text
                                  render={<span />}
                                  size="sm"
                                  weight="medium"
                                >
                                  {svc.name}
                                </Text>
                                <Badge
                                  variant="subtle"
                                  size="xs"
                                  palette={
                                    svc.audience === "public"
                                      ? bluePalette
                                      : undefined
                                  }
                                >
                                  {svc.audience === "public" ? "Public" : "Internal"}
                                </Badge>
                              </HStack>
                              <Text render={<span />} size="xs" tone="muted">
                                {svc.region} · {svc.latencyMs} ms p95
                              </Text>
                            </VStack>

                            <HStack gap="3" style={styles.shrink0}>
                              <div
                                {...stylex.props(styles.sparkStrip)}
                                aria-label={`12-interval uptime history for ${svc.name}`}
                              >
                                {svc.ticks.map((tick, idx) => (
                                  <span
                                    key={`${svc.id}-${idx}`}
                                    {...stylex.props(
                                      tick === "ok"
                                        ? styles.sparkBarOk
                                        : styles.sparkBarWarn,
                                    )}
                                  />
                                ))}
                              </div>
                              <VStack gap="0" style={styles.uptimeReadout}>
                                <Text
                                  render={<span />}
                                  size="sm"
                                  weight="medium"
                                >
                                  {svc.uptime}
                                </Text>
                                <Text render={<span />} size="xs" tone="muted">
                                  {svc.state === "operational"
                                    ? "Operational"
                                    : "Degraded"}
                                </Text>
                              </VStack>
                            </HStack>
                          </HStack>
                        ))}
                      </VStack>
                    </Card.Body>
                  </Card.Root>

                  <VStack gap="3">
                    <Card.Root variant="outline" size="md">
                      <Card.Header style={styles.cardHeaderRow}>
                        <VStack gap="1">
                          <Card.Title style={styles.cardTitleReset}>
                            Scheduled Maintenance
                          </Card.Title>
                          <Card.Description style={styles.cardDescReset}>
                            Upcoming approved change windows
                          </Card.Description>
                        </VStack>
                        <Button
                          variant="ghost"
                          size="xs"
                          onClick={() => navigateTo("releases")}
                        >
                          Releases
                        </Button>
                      </Card.Header>
                      <Card.Body>
                        <VStack gap="3">
                          {UPCOMING_WINDOWS.map((win) => (
                            <VStack
                              key={win.id}
                              gap="1"
                              style={styles.windowItem}
                            >
                              <Text render={<span />} size="sm" weight="medium">
                                {win.title}
                              </Text>
                              <Text
                                render={<span />}
                                variant="mono"
                                size="xs"
                                tone="muted"
                              >
                                {win.schedule}
                              </Text>
                              <Text render={<span />} size="xs" tone="muted">
                                {win.impact}
                              </Text>
                            </VStack>
                          ))}
                        </VStack>
                      </Card.Body>
                    </Card.Root>

                    <Card.Root variant="outline" size="md">
                      <Card.Header style={styles.cardHeaderRow}>
                        <VStack gap="1">
                          <Card.Title style={styles.cardTitleReset}>
                            Latest Verification Runs
                          </Card.Title>
                          <Card.Description style={styles.cardDescReset}>
                            Recent automated probe pipelines
                          </Card.Description>
                        </VStack>
                        <Button
                          variant="ghost"
                          size="xs"
                          onClick={() => navigateTo("pipelines")}
                        >
                          All pipelines
                        </Button>
                      </Card.Header>
                      <Card.Body>
                        <VStack gap="3">
                          {pipelines.slice(0, 3).map((pipe) => (
                            <VStack
                              key={pipe.id}
                              gap="1"
                              style={styles.windowItem}
                            >
                              <HStack
                                gap="2"
                                justify="between"
                                style={styles.fullWidth}
                              >
                                <Text
                                  render={<span />}
                                  size="sm"
                                  weight="medium"
                                >
                                  {pipe.name}
                                </Text>
                                <Badge
                                  variant="subtle"
                                  size="xs"
                                  palette={
                                    pipe.status === "passing"
                                      ? greenPalette
                                      : pipe.status === "running"
                                        ? bluePalette
                                        : amberPalette
                                  }
                                >
                                  {pipe.status}
                                </Badge>
                              </HStack>
                              <Text render={<span />} size="xs" tone="muted">
                                {pipe.stage} · {pipe.updatedAt}
                              </Text>
                            </VStack>
                          ))}
                        </VStack>
                      </Card.Body>
                    </Card.Root>
                  </VStack>
                </Grid>
              </>
            ) : null}

            {activeRoute === "pipelines" ? (
              <Card.Root variant="outline" size="md">
                <Card.Header>
                  <HStack gap="3" wrap="wrap" justify="between">
                    <div {...stylex.props(styles.searchInputWrap)}>
                      <Input
                        size="sm"
                        aria-label="Filter pipelines"
                        placeholder="Filter by pipeline, branch, or author…"
                        value={pipelineSearch}
                        onChange={(event) => setPipelineSearch(event.target.value)}
                      />
                    </div>
                    <HStack gap="1.5" wrap="wrap">
                      {(["all", "passing", "running", "degraded"] as const).map(
                        (status) => (
                          <Button
                            key={status}
                            variant={pipelineFilter === status ? "solid" : "ghost"}
                            size="xs"
                            palette={
                              pipelineFilter === status ? accentPalette : undefined
                            }
                            onClick={() => setPipelineFilter(status)}
                          >
                            {status === "all"
                              ? "All"
                              : status[0].toUpperCase() + status.slice(1)}
                          </Button>
                        ),
                      )}
                    </HStack>
                  </HStack>
                </Card.Header>
                <Card.Body>
                  <div {...stylex.props(styles.tableWrap)}>
                    <Table.Root variant="line" size="md">
                      <Table.Header>
                        <Table.Row>
                          <Table.ColumnHeader>Pipeline</Table.ColumnHeader>
                          <Table.ColumnHeader>Branch</Table.ColumnHeader>
                          <Table.ColumnHeader>Progress</Table.ColumnHeader>
                          <Table.ColumnHeader>Status</Table.ColumnHeader>
                          <Table.ColumnHeader>Duration</Table.ColumnHeader>
                          <Table.ColumnHeader>Action</Table.ColumnHeader>
                        </Table.Row>
                      </Table.Header>
                      <Table.Body>
                        {filteredPipelines.map((pipe) => (
                          <Table.Row key={pipe.id}>
                            <Table.Cell>
                              <VStack gap="1">
                                <Text
                                  render={<span />}
                                  size="sm"
                                  weight="medium"
                                >
                                  {pipe.name}
                                </Text>
                                <Text render={<span />} size="xs" tone="muted">
                                  {pipe.triggeredBy} · {pipe.updatedAt}
                                </Text>
                              </VStack>
                            </Table.Cell>
                            <Table.Cell>
                              <Code size="xs">{pipe.branch}</Code>
                            </Table.Cell>
                            <Table.Cell>
                              <VStack gap="1" style={styles.progressCell}>
                                <Progress.Root
                                  value={pipe.progress}
                                  variant="subtle"
                                  size="xs"
                                  shape="full"
                                  palette={
                                    pipe.status === "passing"
                                      ? greenPalette
                                      : pipe.status === "running"
                                        ? bluePalette
                                        : amberPalette
                                  }
                                >
                                  <Progress.Track>
                                    <Progress.Range />
                                  </Progress.Track>
                                </Progress.Root>
                                <Text render={<span />} size="xs" tone="muted">
                                  {pipe.stage}
                                </Text>
                              </VStack>
                            </Table.Cell>
                            <Table.Cell>
                              <Status.Root
                                size="sm"
                                palette={
                                  pipe.status === "passing"
                                    ? greenPalette
                                    : pipe.status === "running"
                                      ? bluePalette
                                      : amberPalette
                                }
                              >
                                <Status.Indicator />
                                {pipe.status === "passing"
                                  ? "Passing"
                                  : pipe.status === "running"
                                    ? "Running"
                                    : "Degraded"}
                              </Status.Root>
                            </Table.Cell>
                            <Table.Cell>
                              <Text
                                render={<span />}
                                variant="mono"
                                size="xs"
                                tone="muted"
                              >
                                {pipe.duration}
                              </Text>
                            </Table.Cell>
                            <Table.Cell>
                              <Button
                                variant="surface"
                                size="xs"
                                onClick={() => rerunPipeline(pipe)}
                              >
                                Re-run
                              </Button>
                            </Table.Cell>
                          </Table.Row>
                        ))}
                      </Table.Body>
                    </Table.Root>
                    {filteredPipelines.length === 0 ? (
                      <Text
                        size="sm"
                        tone="muted"
                        align="center"
                        style={styles.emptyStateText}
                      >
                        No pipelines match the active filters.
                      </Text>
                    ) : null}
                  </div>
                </Card.Body>
              </Card.Root>
            ) : null}

            {activeRoute === "releases" ? (
              <>
                <HStack gap="1.5" wrap="wrap">
                  {(["All", "Production", "Canary", "Scheduled"] as const).map(
                    (channel) => (
                      <Button
                        key={channel}
                        variant={releaseFilter === channel ? "solid" : "surface"}
                        size="xs"
                        palette={
                          releaseFilter === channel ? accentPalette : undefined
                        }
                        onClick={() => setReleaseFilter(channel)}
                      >
                        {channel}
                      </Button>
                    ),
                  )}
                </HStack>

                <VStack gap="3">
                  {filteredReleases.map((release) => (
                    <Card.Root key={release.id} variant="outline" size="md">
                      <Card.Body style={styles.releaseCardBody}>
                        <HStack
                          gap="3"
                          justify="between"
                          style={styles.releaseTopRow}
                        >
                          <VStack gap="1">
                            <HStack gap="2" wrap="wrap">
                              <Code size="sm">{release.version}</Code>
                              <Badge
                                variant="subtle"
                                size="xs"
                                palette={
                                  release.channel === "Production"
                                    ? greenPalette
                                    : release.channel === "Canary"
                                      ? bluePalette
                                      : amberPalette
                                }
                              >
                                {release.channel}
                              </Badge>
                              <Text render={<span />} size="xs" tone="muted">
                                {release.checksPassed}
                              </Text>
                            </HStack>
                            <Text render={<span />} size="sm" weight="medium">
                              {release.summary}
                            </Text>
                          </VStack>

                          <HStack gap="2" wrap="wrap">
                            {release.channel === "Canary" ? (
                              <Button
                                variant="solid"
                                size="xs"
                                palette={accentPalette}
                                onClick={() => promoteRelease(release)}
                              >
                                Promote to 100%
                              </Button>
                            ) : null}
                            {release.channel === "Production" ? (
                              <Button
                                variant="surface"
                                size="xs"
                                onClick={() =>
                                  queue.warning(`Rollback staged for ${release.version}`, {
                                    description:
                                      "Awaiting secondary SRE confirmation in change control.",
                                  })
                                }
                              >
                                Stage rollback
                              </Button>
                            ) : null}
                            {release.channel === "Scheduled" ? (
                              <Button
                                variant="surface"
                                size="xs"
                                onClick={() =>
                                  queue.info(`Preflight verified for ${release.version}`, {
                                    description:
                                      "Backup snapshots and DNS failover targets are ready.",
                                  })
                                }
                              >
                                Run preflight
                              </Button>
                            ) : null}
                          </HStack>
                        </HStack>

                        <HStack gap="4" wrap="wrap" justify="between">
                          <Text render={<span />} size="xs" tone="muted">
                            Owner: {release.author} · {release.publishedAt}
                          </Text>
                          <VStack gap="1.5" style={styles.rolloutWrap}>
                            <HStack justify="between">
                              <Text render={<span />} size="xs" tone="muted">
                                Fleet rollout
                              </Text>
                              <Text
                                render={<span />}
                                variant="mono"
                                size="xs"
                                tone="muted"
                              >
                                {release.rollout}%
                              </Text>
                            </HStack>
                            <Progress.Root
                              value={release.rollout}
                              variant="subtle"
                              size="xs"
                              shape="full"
                              palette={
                                release.rollout === 100
                                  ? greenPalette
                                  : release.rollout > 0
                                    ? bluePalette
                                    : amberPalette
                              }
                            >
                              <Progress.Track>
                                <Progress.Range />
                              </Progress.Track>
                            </Progress.Root>
                          </VStack>
                        </HStack>
                      </Card.Body>
                    </Card.Root>
                  ))}
                </VStack>
              </>
            ) : null}

            {activeRoute === "metrics" ? (
              <>
                <HStack gap="3" wrap="wrap" justify="between">
                  <Tabs.Root
                    value={metricsRange}
                    onValueChange={setMetricsRange}
                    variant="enclosed"
                    size="sm"
                  >
                    <Tabs.List>
                      <Tabs.Tab value="1h">1h</Tabs.Tab>
                      <Tabs.Tab value="24h">24h</Tabs.Tab>
                      <Tabs.Tab value="7d">7d</Tabs.Tab>
                      <Tabs.Tab value="30d">30d</Tabs.Tab>
                    </Tabs.List>
                  </Tabs.Root>

                  <Text render={<span />} size="xs" tone="muted">
                    Window: last {metricsRange} · aggregated every 10 seconds
                  </Text>
                </HStack>

                <Grid gap="4" style={styles.statGrid}>
                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Error Budget Remaining</Stat.Label>
                        <Stat.ValueText>{activeMetrics.errorBudget}</Stat.ValueText>
                        <Stat.HelpText>
                          {activeMetrics.errorBudgetNote}
                        </Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>

                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Status Requests / min</Stat.Label>
                        <Stat.ValueText>
                          {activeMetrics.requestsPerMin}
                        </Stat.ValueText>
                        <Stat.HelpText>{activeMetrics.requestsDelta}</Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>

                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Median Alert Ack</Stat.Label>
                        <Stat.ValueText>{activeMetrics.medianAck}</Stat.ValueText>
                        <Stat.HelpText>{activeMetrics.ackDelta}</Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>

                  <Card.Root variant="outline" size="md">
                    <Card.Body>
                      <Stat.Root size="md">
                        <Stat.Label>Webhook Delivery</Stat.Label>
                        <Stat.ValueText>
                          {activeMetrics.webhookDelivery}
                        </Stat.ValueText>
                        <Stat.HelpText>{activeMetrics.webhookNote}</Stat.HelpText>
                      </Stat.Root>
                    </Card.Body>
                  </Card.Root>
                </Grid>

                <Card.Root variant="outline" size="md">
                  <Card.Header>
                    <Card.Title style={styles.cardTitleReset}>
                      Regional Synthetic Probe Latency ({metricsRange})
                    </Card.Title>
                    <Card.Description style={styles.cardDescReset}>
                      Measured end-to-end across public status API endpoints and internal ingest collectors
                    </Card.Description>
                  </Card.Header>
                  <Card.Body>
                    <div {...stylex.props(styles.tableWrap)}>
                      <Table.Root variant="line" size="md">
                        <Table.Header>
                          <Table.Row>
                            <Table.ColumnHeader>Probe Region</Table.ColumnHeader>
                            <Table.ColumnHeader>P50</Table.ColumnHeader>
                            <Table.ColumnHeader>P95</Table.ColumnHeader>
                            <Table.ColumnHeader>P99</Table.ColumnHeader>
                            <Table.ColumnHeader>Success Rate</Table.ColumnHeader>
                            <Table.ColumnHeader>Collector Load</Table.ColumnHeader>
                          </Table.Row>
                        </Table.Header>
                        <Table.Body>
                          {activeMetrics.regions.map((region) => (
                            <Table.Row key={region.id}>
                              <Table.Cell>
                                <VStack gap="1">
                                  <Text
                                    render={<span />}
                                    size="sm"
                                    weight="medium"
                                  >
                                    {region.label}
                                  </Text>
                                  <Text
                                    render={<span />}
                                    variant="mono"
                                    size="xs"
                                    tone="muted"
                                  >
                                    {region.id}
                                  </Text>
                                </VStack>
                              </Table.Cell>
                              <Table.Cell>
                                <Text
                                  render={<span />}
                                  variant="mono"
                                  size="xs"
                                  tone="muted"
                                >
                                  {region.p50}
                                </Text>
                              </Table.Cell>
                              <Table.Cell>
                                <Text
                                  render={<span />}
                                  variant="mono"
                                  size="xs"
                                  tone="muted"
                                >
                                  {region.p95}
                                </Text>
                              </Table.Cell>
                              <Table.Cell>
                                <Text
                                  render={<span />}
                                  variant="mono"
                                  size="xs"
                                  tone="muted"
                                >
                                  {region.p99}
                                </Text>
                              </Table.Cell>
                              <Table.Cell>
                                <Badge
                                  variant="subtle"
                                  size="xs"
                                  palette={
                                    region.successRate >= 99.98
                                      ? greenPalette
                                      : amberPalette
                                  }
                                >
                                  {region.successRate.toFixed(2)}%
                                </Badge>
                              </Table.Cell>
                              <Table.Cell>
                                <VStack gap="1" style={styles.progressCell}>
                                  <Progress.Root
                                    value={region.load}
                                    variant="subtle"
                                    size="xs"
                                    shape="full"
                                    palette={
                                      region.load >= 70
                                        ? amberPalette
                                        : accentPalette
                                    }
                                  >
                                    <Progress.Track>
                                      <Progress.Range />
                                    </Progress.Track>
                                  </Progress.Root>
                                  <Text render={<span />} size="xs" tone="muted">
                                    {region.load}% utilization
                                  </Text>
                                </VStack>
                              </Table.Cell>
                            </Table.Row>
                          ))}
                        </Table.Body>
                      </Table.Root>
                    </div>
                  </Card.Body>
                </Card.Root>
              </>
            ) : null}

            {activeRoute === "settings" ? (
              <Grid gap="4" style={styles.equalTwoColGrid}>
                <Card.Root variant="outline" size="md">
                  <Card.Header>
                    <Card.Title style={styles.cardTitleReset}>
                      Public Status Surface
                    </Card.Title>
                    <Card.Description style={styles.cardDescReset}>
                      Control external visibility, maintenance notices, and custom domain routing
                    </Card.Description>
                  </Card.Header>
                  <Card.Body>
                    <VStack gap="3">
                      <HStack gap="4" justify="between" style={styles.toggleRow}>
                        <VStack gap="0.5">
                          <Text render={<span />} size="sm" weight="medium">
                            Public status page visible
                          </Text>
                          <Text render={<span />} size="xs" tone="muted">
                            Allow external visitors to inspect live uptime without SSO.
                          </Text>
                        </VStack>
                        <Switch.Root size="md" palette={accentPalette}>
                          <Switch.Control
                            checked={publicPageVisible}
                            onCheckedChange={(checked) => {
                              setPublicPageVisible(checked);
                              queue.info(
                                checked
                                  ? "Public status page is now externally visible"
                                  : "Status page restricted to internal SSO",
                              );
                            }}
                          />
                        </Switch.Root>
                      </HStack>

                      <Separator />

                      <HStack gap="4" justify="between" style={styles.toggleRow}>
                        <VStack gap="0.5">
                          <Text render={<span />} size="sm" weight="medium">
                            Maintenance banner active
                          </Text>
                          <Text render={<span />} size="xs" tone="muted">
                            Pin the upcoming EU-Central window across public and internal headers.
                          </Text>
                        </VStack>
                        <Switch.Root size="md" palette={amberPalette}>
                          <Switch.Control
                            checked={maintenanceBanner}
                            onCheckedChange={(checked) => {
                              setMaintenanceBanner(checked);
                              queue.info(
                                checked
                                  ? "Maintenance banner published"
                                  : "Maintenance banner cleared",
                              );
                            }}
                          />
                        </Switch.Root>
                      </HStack>

                      <Separator />

                      <HStack gap="4" justify="between" style={styles.toggleRow}>
                        <VStack gap="0.5">
                          <Text render={<span />} size="sm" weight="medium">
                            Auto-post resolved advisories
                          </Text>
                          <Text render={<span />} size="xs" tone="muted">
                            Publish recovery timestamps once 3 consecutive regional probes pass.
                          </Text>
                        </VStack>
                        <Switch.Root size="md" palette={accentPalette}>
                          <Switch.Control
                            checked={autoPostResolved}
                            onCheckedChange={(checked) => {
                              setAutoPostResolved(checked);
                              queue.info(
                                `Auto-post resolved advisories ${checked ? "enabled" : "paused"}`,
                              );
                            }}
                          />
                        </Switch.Root>
                      </HStack>

                      <Separator />

                      <HStack gap="4" justify="between" style={styles.toggleRow}>
                        <VStack gap="0.5">
                          <Text render={<span />} size="sm" weight="medium">
                            RSS &amp; webhook subscriptions
                          </Text>
                          <Text render={<span />} size="xs" tone="muted">
                            Let customers register self-serve HMAC webhook endpoints.
                          </Text>
                        </VStack>
                        <Switch.Root size="md" palette={accentPalette}>
                          <Switch.Control
                            checked={allowSubscriptions}
                            onCheckedChange={(checked) => {
                              setAllowSubscriptions(checked);
                              queue.info(
                                `Subscriber webhooks ${checked ? "enabled" : "disabled"}`,
                              );
                            }}
                          />
                        </Switch.Root>
                      </HStack>

                      <Separator />

                      <HStack
                        render={<form onSubmit={handleSaveDomain} />}
                        gap="2.5"
                        wrap="wrap"
                      >
                        <div {...stylex.props(styles.formInputGrow)}>
                          <Input
                            size="sm"
                            aria-label="Custom status domain"
                            value={statusDomain}
                            onChange={(event) => setStatusDomain(event.target.value)}
                            placeholder="status.example.io"
                          />
                        </div>
                        <Button
                          type="submit"
                          variant="solid"
                          size="sm"
                          palette={accentPalette}
                        >
                          Save domain
                        </Button>
                      </HStack>
                    </VStack>
                  </Card.Body>
                </Card.Root>

                <Card.Root variant="outline" size="md">
                  <Card.Header>
                    <Card.Title style={styles.cardTitleReset}>
                      Escalation &amp; Alert Routing
                    </Card.Title>
                    <Card.Description style={styles.cardDescReset}>
                      Enable or mute on-call channels receiving synthetic probe alerts
                    </Card.Description>
                  </Card.Header>
                  <Card.Body>
                    <VStack gap="3">
                      {channels.map((channel, index) => (
                        <div key={channel.id}>
                          <HStack
                            gap="4"
                            justify="between"
                            style={styles.toggleRow}
                          >
                            <VStack gap="0.5">
                              <HStack gap="2" wrap="wrap">
                                <Text
                                  render={<span />}
                                  size="sm"
                                  weight="medium"
                                >
                                  {channel.name}
                                </Text>
                                <Badge
                                  variant="subtle"
                                  size="xs"
                                  palette={
                                    channel.severity.includes("Sev-1")
                                      ? redPalette
                                      : bluePalette
                                  }
                                >
                                  {channel.severity}
                                </Badge>
                              </HStack>
                              <Text
                                render={<span />}
                                variant="mono"
                                size="xs"
                                tone="muted"
                              >
                                {channel.target}
                              </Text>
                            </VStack>
                            <Switch.Root size="md" palette={greenPalette}>
                              <Switch.Control
                                checked={channel.enabled}
                                onCheckedChange={(checked) => {
                                  setChannels((prev) =>
                                    prev.map((row) =>
                                      row.id === channel.id
                                        ? { ...row, enabled: checked }
                                        : row,
                                    ),
                                  );
                                  queue.info(
                                    `${channel.name} ${checked ? "enabled" : "muted"}`,
                                  );
                                }}
                              />
                            </Switch.Root>
                          </HStack>
                          {index < channels.length - 1 ? <Separator /> : null}
                        </div>
                      ))}
                    </VStack>
                  </Card.Body>
                </Card.Root>
              </Grid>
            ) : null}
          </VStack>
        </AppShell.Main>
      </AppShell.Content>

      <Drawer.Root
        open={mobileNavOpen}
        onOpenChange={setMobileNavOpen}
        placement="start"
        size="xs"
      >
        <Drawer.Backdrop />
        <Drawer.Content>
          <Drawer.Header>
            <HStack gap="2.5">
              <span {...stylex.props(styles.brandMark)}>
                <BeaconMark />
              </span>
              <Drawer.Title>Beacon Status</Drawer.Title>
            </HStack>
            <Drawer.Close
              render={
                <IconButton
                  variant="ghost"
                  size="xs"
                  aria-label="Close navigation menu"
                />
              }
            >
              <Icon
                size="sm"
                viewBox="0 0 16 16"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.6"
                strokeLinecap="round"
                aria-hidden="true"
              >
                <path d="m4 4 8 8" />
                <path d="m12 4-8 8" />
              </Icon>
            </Drawer.Close>
          </Drawer.Header>
          <Separator />
          <Drawer.Body style={styles.drawerBody}>
            <VStack render={<ul />} gap="1" style={styles.drawerNavList}>
              {ROUTES.map((route) => {
                const active = activeRoute === route;
                return (
                  <SidebarNavItem.Item key={route} variant="muted" size="md">
                    <SidebarNavItem.Button
                      type="button"
                      aria-current={active ? "page" : undefined}
                      style={active ? sidebarNavItemActive : undefined}
                      onClick={() => navigateTo(route)}
                    >
                      <SidebarNavItem.Icon
                        viewBox="0 0 20 20"
                        fill="none"
                        stroke="currentColor"
                        strokeWidth="1.5"
                        strokeLinecap="round"
                        strokeLinejoin="round"
                        aria-hidden="true"
                      >
                        <RouteGlyph route={route} />
                      </SidebarNavItem.Icon>
                      <span>{ROUTE_META[route].label}</span>
                      {route === "pipelines" && runningPipelinesCount > 0 ? (
                        <SidebarNavItem.EndElement>
                          <Badge variant="subtle" size="xs" palette={bluePalette}>
                            {runningPipelinesCount}
                          </Badge>
                        </SidebarNavItem.EndElement>
                      ) : null}
                    </SidebarNavItem.Button>
                  </SidebarNavItem.Item>
                );
              })}
            </VStack>

            <VStack gap="1" style={styles.drawerStatusCard}>
              <Status.Root
                size="sm"
                palette={maintenanceBanner ? amberPalette : greenPalette}
              >
                <Status.Indicator />
                {maintenanceBanner
                  ? "Maintenance window active"
                  : "All public monitors healthy"}
              </Status.Root>
              <Text render={<span />} size="xs" tone="muted">
                {statusDomain} · 99.992% 30d uptime
              </Text>
            </VStack>
          </Drawer.Body>
          <Drawer.Footer>
            <Button
              variant="solid"
              size="sm"
              palette={accentPalette}
              onClick={() => {
                setMobileNavOpen(false);
                triggerSyntheticProbe();
              }}
            >
              Run synthetic probe
            </Button>
          </Drawer.Footer>
        </Drawer.Content>
      </Drawer.Root>

      <Dialog.Root
        open={searchOpen}
        onOpenChange={(next) => {
          setSearchOpen(next);
          if (!next) setSearchQuery("");
        }}
        size="md"
        placement="top"
      >
        <Dialog.Backdrop />
        <Dialog.Content>
          <Dialog.Header>
            <Dialog.Title>Quick Jump &amp; Operations</Dialog.Title>
          </Dialog.Header>
          <Dialog.Body style={styles.paletteDialogBody}>
            <Input
              size="md"
              placeholder="Jump to Overview, Pipelines, Releases, Metrics, or run an action…"
              value={searchQuery}
              onChange={(event) => setSearchQuery(event.target.value)}
              autoFocus
            />
            <VStack gap="1" style={styles.paletteResults}>
              {paletteCommands.map((cmd) => (
                <button
                  key={cmd.id}
                  type="button"
                  onClick={() => {
                    cmd.run();
                    setSearchOpen(false);
                    setSearchQuery("");
                  }}
                  {...stylex.props(styles.paletteItem)}
                >
                  <HStack render={<span />} gap="2">
                    <Badge variant="subtle" size="xs">
                      {cmd.category}
                    </Badge>
                    <span>{cmd.label}</span>
                  </HStack>
                  <Text render={<span />} size="xs" tone="muted">
                    {cmd.hint}
                  </Text>
                </button>
              ))}
              {paletteCommands.length === 0 ? (
                <Text
                  size="sm"
                  tone="muted"
                  align="center"
                  style={styles.emptyStateText}
                >
                  No matching commands for &ldquo;{searchQuery}&rdquo;.
                </Text>
              ) : null}
            </VStack>
          </Dialog.Body>
          <Dialog.Footer>
            <Button
              variant="ghost"
              size="sm"
              onClick={() => {
                setSearchOpen(false);
                setSearchQuery("");
              }}
            >
              Close
            </Button>
          </Dialog.Footer>
        </Dialog.Content>
      </Dialog.Root>

      <Toaster toaster={queue} />
    </AppShell.Root>
  );
}
```

Credit: Inspired by [Top Nav](https://astryx.atmeta.com/playground?template=shell-top-nav) from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.)
