{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "developer-console",
  "title": "Developer Console Flagship Block",
  "description": "Complete FRAME/12 API & webhook control-plane Developer Console combining Expressive hero telemetry and charts with Quiet operational views for services, masked fictional API keys, and searchable/paginated request logs.",
  "dependencies": [
    "@radix-ui/react-select"
  ],
  "registryDependencies": [
    "https://frame12.dev/r/frame12-styles.json",
    "https://frame12.dev/r/frame12.json"
  ],
  "files": [
    {
      "path": "blocks/developer-console.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { type MotionMode, useChanged } from '@/hooks/use-on-twos';\nimport { useResolvedMotion } from '@/hooks/use-tempo';\nimport {\n  Sheet,\n  Scene,\n  Panel,\n  SegmentedControl,\n  Tabs,\n  TabsList,\n  TabsTrigger,\n  TabsContent,\n  Button,\n  Field,\n  Input,\n  Checkbox,\n  RadioGroup,\n  RadioGroupItem,\n  Switch,\n  Select,\n  SelectTrigger,\n  SelectValue,\n  SelectContent,\n  SelectItem,\n  Badge,\n  Tag,\n  type TagStatus,\n  Alert,\n  Notice,\n  ToastProvider,\n  useToast,\n  useOptionalToast,\n  Skeleton,\n  SkeletonText,\n  EmptyState,\n  Breadcrumb,\n  Pagination,\n  Metric,\n  ToneAreaChart,\n  type ToneAreaDatum,\n  ToneBarList,\n  type ToneBarItem,\n  ToneSpark,\n  Dialog,\n  DialogContent,\n  DialogHeader,\n  DialogTitle,\n  DialogDescription,\n  DialogFooter,\n  DialogClose,\n  Table,\n  TableHeader,\n  TableBody,\n  TableFooter,\n  TableRow,\n  TableHead,\n  TableCell,\n  TableCaption,\n} from '@/components/frame12';\n\nexport type ConsoleSection = 'overview' | 'services' | 'api-keys' | 'request-logs';\nexport type ConsoleDatasetState = 'populated' | 'loading' | 'empty' | 'error';\nexport type ConsoleTimeRange = '24h' | '7d' | '30d';\nexport type ConsoleEnvironment = 'prod-us-east-1' | 'staging-eu-central-1';\nexport type EndpointHealthFilter = 'all' | 'healthy' | 'degraded' | 'canary';\nexport type EndpointMethodFilter = 'ALL' | 'POST' | 'GET' | 'PUT' | 'DELETE';\nexport type LogStatusFilter = 'all' | '2xx' | '4xx' | '5xx';\nexport type ApiKeyScope = 'read_only' | 'dispatch_write' | 'admin';\n\nexport interface ConsoleRangeSnapshot {\n  range: ConsoleTimeRange;\n  label: string;\n  windowNote: string;\n  totalRequests: number;\n  requestDeltaPct: number;\n  requestDeltaNote: string;\n  errorRateBasisPoints: number; // e.g. 42 => 0.42%\n  errorCount: number;\n  errorDeltaPp: number;\n  errorDeltaNote: string;\n  p95LatencyMs: number;\n  p50LatencyMs: number;\n  p99LatencyMs: number;\n  latencyDeltaPct: number;\n  latencyDeltaNote: string;\n  peakCallout: string;\n  latencySpark: number[];\n  series: ToneAreaDatum[];\n  serviceSeries: Record<string, number[]>;\n}\n\nexport interface ConsoleServiceItem {\n  id: string;\n  name: string;\n  code: string;\n  owner: string;\n  status: 'healthy' | 'degraded' | 'canary';\n  requests24h: number;\n  share24h: number;\n  p95Ms: number;\n  errorRatePct: string;\n  pattern: 'dense' | 'hatch' | 'dots';\n  spark: number[];\n  summary: string;\n}\n\nexport interface ConsoleEndpointItem {\n  id: string;\n  serviceId: string;\n  serviceName: string;\n  method: 'POST' | 'GET' | 'PUT' | 'DELETE';\n  route: string;\n  owner: string;\n  rateLimitRps: number;\n  requests24h: number;\n  errorRatePct: string;\n  p95Ms: number;\n  status: 'healthy' | 'degraded' | 'canary';\n  schemaVersion: string;\n  timeoutMs: number;\n  retryPolicy: string;\n  description: string;\n}\n\nexport interface SimulatedApiKey {\n  id: string;\n  label: string;\n  maskedToken: string;\n  scope: ApiKeyScope;\n  rateTier: string;\n  requireHmac: boolean;\n  createdAt: string;\n  lastUsed: string;\n  status: 'active' | 'revoked';\n}\n\nexport interface ConsoleRequestLogItem {\n  id: string;\n  requestId: string;\n  timestamp: string;\n  method: 'POST' | 'GET' | 'PUT' | 'DELETE';\n  route: string;\n  serviceId: string;\n  serviceName: string;\n  statusCode: number;\n  statusClass: '2xx' | '4xx' | '5xx';\n  durationMs: number;\n  region: string;\n  apiKeyId: string;\n  idempotencyKey: string;\n  tlsMs: number;\n  queueMs: number;\n  upstreamMs: number;\n  requestPayload: string;\n  responsePayload: string;\n  replayed?: boolean;\n}\n\nexport const CONSOLE_RANGE_SNAPSHOTS: Record<ConsoleTimeRange, ConsoleRangeSnapshot> = {\n  '24h': {\n    range: '24h',\n    label: '24 Hours',\n    windowNote: 'Oct 31, 2026 · 00:00–24:00 UTC',\n    totalRequests: 1482900,\n    requestDeltaPct: 0.064,\n    requestDeltaNote: 'vs prior 24h (1,393,700)',\n    errorRateBasisPoints: 42,\n    errorCount: 6228,\n    errorDeltaPp: -0.18,\n    errorDeltaNote: '6,228 non-2xx of 1.48M reqs',\n    p95LatencyMs: 38,\n    p50LatencyMs: 14,\n    p99LatencyMs: 94,\n    latencyDeltaPct: -0.191,\n    latencyDeltaNote: 'p50 14 ms · p99 94 ms',\n    peakCallout: 'Peak 15:00 UTC · 248.4k reqs · 34 ms p95',\n    latencySpark: [42, 39, 37, 35, 44, 41, 38, 36],\n    series: [\n      { label: '00:00', value: 142, compareValue: 134 },\n      { label: '03:00', value: 128, compareValue: 125 },\n      { label: '06:00', value: 164, compareValue: 152 },\n      { label: '09:00', value: 198, compareValue: 184 },\n      { label: '12:00', value: 221, compareValue: 205 },\n      { label: '15:00', value: 248, compareValue: 229 },\n      { label: '18:00', value: 204, compareValue: 192 },\n      { label: '21:00', value: 178, compareValue: 173 },\n    ],\n    serviceSeries: {\n      'svc-webhook-dispatch': [62, 56, 72, 87, 97, 109, 90, 79],\n      'svc-checkout-session': [43, 38, 49, 59, 66, 74, 61, 55],\n      'svc-inventory-ledger': [24, 22, 28, 34, 38, 42, 35, 29],\n      'svc-tax-quote': [13, 12, 15, 18, 20, 23, 18, 15],\n    },\n  },\n  '7d': {\n    range: '7d',\n    label: '7 Days',\n    windowNote: 'Oct 25 – Oct 31, 2026 UTC',\n    totalRequests: 9840200,\n    requestDeltaPct: 0.112,\n    requestDeltaNote: 'vs prior 7d (8,849,100)',\n    errorRateBasisPoints: 51,\n    errorCount: 50185,\n    errorDeltaPp: -0.09,\n    errorDeltaNote: '50,185 non-2xx of 9.84M reqs',\n    p95LatencyMs: 41,\n    p50LatencyMs: 15,\n    p99LatencyMs: 102,\n    latencyDeltaPct: -0.109,\n    latencyDeltaNote: 'p50 15 ms · p99 102 ms',\n    peakCallout: 'Peak Oct 31 · 1,482.9k reqs · 38 ms p95',\n    latencySpark: [46, 45, 43, 44, 41, 40, 38],\n    series: [\n      { label: 'Oct 25', value: 1290, compareValue: 1180 },\n      { label: 'Oct 26', value: 1340, compareValue: 1210 },\n      { label: 'Oct 27', value: 1385, compareValue: 1255 },\n      { label: 'Oct 28', value: 1410, compareValue: 1270 },\n      { label: 'Oct 29', value: 1452, compareValue: 1310 },\n      { label: 'Oct 30', value: 1480, compareValue: 1330 },\n      { label: 'Oct 31', value: 1483, compareValue: 1394 },\n    ],\n    serviceSeries: {\n      'svc-webhook-dispatch': [568, 590, 609, 620, 639, 651, 652],\n      'svc-checkout-session': [387, 402, 416, 423, 436, 444, 445],\n      'svc-inventory-ledger': [219, 228, 235, 240, 247, 252, 252],\n      'svc-tax-quote': [116, 120, 125, 127, 130, 133, 134],\n    },\n  },\n  '30d': {\n    range: '30d',\n    label: '30 Days',\n    windowNote: 'Oct 02 – Oct 31, 2026 UTC',\n    totalRequests: 39410000,\n    requestDeltaPct: 0.186,\n    requestDeltaNote: 'vs prior 30d (33,229,300)',\n    errorRateBasisPoints: 58,\n    errorCount: 228578,\n    errorDeltaPp: -0.24,\n    errorDeltaNote: '228.6k non-2xx of 39.41M reqs',\n    p95LatencyMs: 44,\n    p50LatencyMs: 16,\n    p99LatencyMs: 112,\n    latencyDeltaPct: -0.2,\n    latencyDeltaNote: 'p50 16 ms · p99 112 ms',\n    peakCallout: 'Peak Oct 29–31 · 4,415k reqs · 38 ms p95',\n    latencySpark: [52, 50, 48, 47, 45, 44, 42, 41, 39, 38],\n    series: [\n      { label: 'Oct 04', value: 3520, compareValue: 3010 },\n      { label: 'Oct 07', value: 3640, compareValue: 3120 },\n      { label: 'Oct 10', value: 3710, compareValue: 3190 },\n      { label: 'Oct 13', value: 3820, compareValue: 3260 },\n      { label: 'Oct 16', value: 3890, compareValue: 3310 },\n      { label: 'Oct 19', value: 3980, compareValue: 3390 },\n      { label: 'Oct 22', value: 4090, compareValue: 3460 },\n      { label: 'Oct 25', value: 4160, compareValue: 3520 },\n      { label: 'Oct 28', value: 4185, compareValue: 3580 },\n      { label: 'Oct 31', value: 4415, compareValue: 3640 },\n    ],\n    serviceSeries: {\n      'svc-webhook-dispatch': [1549, 1602, 1632, 1681, 1712, 1751, 1800, 1830, 1841, 1943],\n      'svc-checkout-session': [1056, 1092, 1113, 1146, 1167, 1194, 1227, 1248, 1256, 1325],\n      'svc-inventory-ledger': [598, 619, 631, 649, 661, 677, 695, 707, 711, 750],\n      'svc-tax-quote': [317, 327, 334, 344, 350, 358, 368, 375, 377, 397],\n    },\n  },\n};\n\n// Note: 652,476 + 444,870 + 252,093 + 133,461 === 1,482,900 (reconciled with 24h totalRequests)\nexport const CONSOLE_SERVICES: ConsoleServiceItem[] = [\n  {\n    id: 'svc-webhook-dispatch',\n    name: 'Webhook Dispatch Engine',\n    code: 'SVC-01',\n    owner: 'Core Messaging',\n    status: 'healthy',\n    requests24h: 652476,\n    share24h: 0.44,\n    p95Ms: 34,\n    errorRatePct: '0.21%',\n    pattern: 'dense',\n    spark: [36, 35, 34, 33, 35, 34, 33, 34],\n    summary: 'Signed HMAC-SHA256 outbound event delivery and dead-letter replay queue.',\n  },\n  {\n    id: 'svc-checkout-session',\n    name: 'Checkout Session Edge',\n    code: 'SVC-02',\n    owner: 'Commerce Edge',\n    status: 'healthy',\n    requests24h: 444870,\n    share24h: 0.3,\n    p95Ms: 29,\n    errorRatePct: '0.14%',\n    pattern: 'hatch',\n    spark: [31, 30, 29, 28, 30, 29, 28, 29],\n    summary: 'Low-latency cart token validation, recovery holdout assignment, and session state.',\n  },\n  {\n    id: 'svc-inventory-ledger',\n    name: 'Inventory Ledger Sync',\n    code: 'SVC-03',\n    owner: 'Fulfillment Ops',\n    status: 'degraded',\n    requests24h: 252093,\n    share24h: 0.17,\n    p95Ms: 58,\n    errorRatePct: '1.18%',\n    pattern: 'dots',\n    spark: [44, 47, 52, 61, 64, 59, 57, 58],\n    summary: 'Warehouse allocation lock contention in eu-central-1 replica (+14 ms p95 drift).',\n  },\n  {\n    id: 'svc-tax-quote',\n    name: 'Customs & Duty Quote API',\n    code: 'SVC-04',\n    owner: 'Cross-Border',\n    status: 'canary',\n    requests24h: 133461,\n    share24h: 0.09,\n    p95Ms: 46,\n    errorRatePct: '0.95%',\n    pattern: 'dots',\n    spark: [49, 48, 47, 46, 47, 45, 46, 46],\n    summary: 'HS-tariff harmonization v2.4 canary rollout (15% traffic weight).',\n  },\n];\n\n// Note: Endpoint 24h volumes sum exactly to each parent service's 24h volume (total 1,482,900)\nexport const CONSOLE_ENDPOINTS: ConsoleEndpointItem[] = [\n  {\n    id: 'ep-webhook-dispatch',\n    serviceId: 'svc-webhook-dispatch',\n    serviceName: 'Webhook Dispatch Engine',\n    method: 'POST',\n    route: '/v2/webhooks/dispatch',\n    owner: 'Core Messaging',\n    rateLimitRps: 2500,\n    requests24h: 541200,\n    errorRatePct: '0.19%',\n    p95Ms: 32,\n    status: 'healthy',\n    schemaVersion: '2026-10-15.v2',\n    timeoutMs: 3000,\n    retryPolicy: '5 attempts · exponential backoff (1s..60s)',\n    description: 'Enqueues and signs an outbound webhook event for immediate delivery.',\n  },\n  {\n    id: 'ep-webhook-replay',\n    serviceId: 'svc-webhook-dispatch',\n    serviceName: 'Webhook Dispatch Engine',\n    method: 'POST',\n    route: '/v2/webhooks/replay',\n    owner: 'Core Messaging',\n    rateLimitRps: 600,\n    requests24h: 111276,\n    errorRatePct: '0.31%',\n    p95Ms: 41,\n    status: 'healthy',\n    schemaVersion: '2026-10-15.v2',\n    timeoutMs: 5000,\n    retryPolicy: '3 attempts · idempotent replay token required',\n    description: 'Re-dispatches a previously recorded delivery attempt using its original payload hash.',\n  },\n  {\n    id: 'ep-session-create',\n    serviceId: 'svc-checkout-session',\n    serviceName: 'Checkout Session Edge',\n    method: 'POST',\n    route: '/v2/sessions',\n    owner: 'Commerce Edge',\n    rateLimitRps: 2000,\n    requests24h: 268400,\n    errorRatePct: '0.16%',\n    p95Ms: 31,\n    status: 'healthy',\n    schemaVersion: '2026-09-01.v2',\n    timeoutMs: 2000,\n    retryPolicy: '2 attempts · edge failover enabled',\n    description: 'Creates a signed checkout recovery session with experiment cohort assignment.',\n  },\n  {\n    id: 'ep-session-get',\n    serviceId: 'svc-checkout-session',\n    serviceName: 'Checkout Session Edge',\n    method: 'GET',\n    route: '/v2/sessions/:id',\n    owner: 'Commerce Edge',\n    rateLimitRps: 4000,\n    requests24h: 176470,\n    errorRatePct: '0.11%',\n    p95Ms: 24,\n    status: 'healthy',\n    schemaVersion: '2026-09-01.v2',\n    timeoutMs: 1500,\n    retryPolicy: 'Read-through edge cache (TTL 30s)',\n    description: 'Reads checkout session state, line items, and intervention attribution.',\n  },\n  {\n    id: 'ep-inventory-reserve',\n    serviceId: 'svc-inventory-ledger',\n    serviceName: 'Inventory Ledger Sync',\n    method: 'PUT',\n    route: '/v2/inventory/reserve',\n    owner: 'Fulfillment Ops',\n    rateLimitRps: 800,\n    requests24h: 158900,\n    errorRatePct: '1.62%',\n    p95Ms: 64,\n    status: 'degraded',\n    schemaVersion: '2026-10-01.v2',\n    timeoutMs: 4000,\n    retryPolicy: 'Optimistic lock retry (max 3)',\n    description: 'Places a 15-minute SKU reservation hold across regional fulfillment nodes.',\n  },\n  {\n    id: 'ep-inventory-stock',\n    serviceId: 'svc-inventory-ledger',\n    serviceName: 'Inventory Ledger Sync',\n    method: 'GET',\n    route: '/v2/inventory/stock',\n    owner: 'Fulfillment Ops',\n    rateLimitRps: 1500,\n    requests24h: 93193,\n    errorRatePct: '0.43%',\n    p95Ms: 45,\n    status: 'healthy',\n    schemaVersion: '2026-10-01.v2',\n    timeoutMs: 2000,\n    retryPolicy: 'Stale-while-revalidate (15s)',\n    description: 'Queries real-time available-to-promise inventory counts by warehouse.',\n  },\n  {\n    id: 'ep-customs-quote',\n    serviceId: 'svc-tax-quote',\n    serviceName: 'Customs & Duty Quote API',\n    method: 'POST',\n    route: '/v2/customs/quote',\n    owner: 'Cross-Border',\n    rateLimitRps: 500,\n    requests24h: 109200,\n    errorRatePct: '1.08%',\n    p95Ms: 48,\n    status: 'canary',\n    schemaVersion: '2026-10-28.v2-canary',\n    timeoutMs: 3500,\n    retryPolicy: 'Fallback to static tariff schedule on timeout',\n    description: 'Computes landed duty, VAT, and brokerage fees for cross-border shipments.',\n  },\n  {\n    id: 'ep-customs-cache',\n    serviceId: 'svc-tax-quote',\n    serviceName: 'Customs & Duty Quote API',\n    method: 'DELETE',\n    route: '/v2/customs/cache',\n    owner: 'Cross-Border',\n    rateLimitRps: 120,\n    requests24h: 24261,\n    errorRatePct: '0.37%',\n    p95Ms: 37,\n    status: 'healthy',\n    schemaVersion: '2026-10-28.v2',\n    timeoutMs: 2500,\n    retryPolicy: 'Idempotent purge broadcast',\n    description: 'Invalidates cached HS-code tariff lookups for a merchant catalog.',\n  },\n];\n\n// All credentials below are strictly fictional simulation strings (f12_sim_*)\nexport const INITIAL_API_KEYS: SimulatedApiKey[] = [\n  {\n    id: 'key-prod-primary',\n    label: 'Primary Webhook Dispatcher',\n    maskedToken: 'f12_sim_live_••••_9a4c',\n    scope: 'dispatch_write',\n    rateTier: 'Burst · 2,000 req/s',\n    requireHmac: true,\n    createdAt: '2026-09-14',\n    lastUsed: 'Oct 31 · 14:58 UTC',\n    status: 'active',\n  },\n  {\n    id: 'key-checkout-edge',\n    label: 'Storefront Edge Worker',\n    maskedToken: 'f12_sim_live_••••_3d81',\n    scope: 'dispatch_write',\n    rateTier: 'Dedicated · 5,000 req/s',\n    requireHmac: true,\n    createdAt: '2026-10-02',\n    lastUsed: 'Oct 31 · 14:59 UTC',\n    status: 'active',\n  },\n  {\n    id: 'key-datadog-exporter',\n    label: 'Audit Ledger Read-Only',\n    maskedToken: 'f12_sim_read_••••_7e20',\n    scope: 'read_only',\n    rateTier: 'Standard · 500 req/s',\n    requireHmac: false,\n    createdAt: '2026-08-19',\n    lastUsed: 'Oct 31 · 14:45 UTC',\n    status: 'active',\n  },\n  {\n    id: 'key-legacy-migration',\n    label: 'Legacy Batch Importer (Q3)',\n    maskedToken: 'f12_sim_admin_••••_1b09',\n    scope: 'admin',\n    rateTier: 'Standard · 500 req/s',\n    requireHmac: true,\n    createdAt: '2026-07-01',\n    lastUsed: 'Oct 12 · 09:14 UTC',\n    status: 'revoked',\n  },\n];\n\nexport const INITIAL_REQUEST_LOGS: ConsoleRequestLogItem[] = [\n  {\n    id: 'log-1',\n    requestId: 'req_01J9Z8K4M2',\n    timestamp: '14:59:12 UTC',\n    method: 'POST',\n    route: '/v2/webhooks/dispatch',\n    serviceId: 'svc-webhook-dispatch',\n    serviceName: 'Webhook Dispatch Engine',\n    statusCode: 202,\n    statusClass: '2xx',\n    durationMs: 28,\n    region: 'us-east-1',\n    apiKeyId: 'key-prod-primary',\n    idempotencyKey: 'idem_ord_9041_a8f',\n    tlsMs: 4,\n    queueMs: 6,\n    upstreamMs: 18,\n    requestPayload:\n      '{\"event\":\"cart.abandoned\",\"orderId\":\"ORD-9041\",\"channel\":\"email\",\"amountUsd\":1420}',\n    responsePayload: '{\"accepted\":true,\"deliveryId\":\"dlv_8841a\",\"queuedAt\":\"14:59:12.028Z\"}',\n  },\n  {\n    id: 'log-2',\n    requestId: 'req_01J9Z8J9P0',\n    timestamp: '14:58:47 UTC',\n    method: 'PUT',\n    route: '/v2/inventory/reserve',\n    serviceId: 'svc-inventory-ledger',\n    serviceName: 'Inventory Ledger Sync',\n    statusCode: 504,\n    statusClass: '5xx',\n    durationMs: 4002,\n    region: 'eu-central-1',\n    apiKeyId: 'key-checkout-edge',\n    idempotencyKey: 'idem_sku_4410_lock',\n    tlsMs: 5,\n    queueMs: 112,\n    upstreamMs: 3885,\n    requestPayload:\n      '{\"sku\":\"F12-INK-PEN-04\",\"warehouse\":\"FRA-02\",\"quantity\":12,\"holdSeconds\":900}',\n    responsePayload:\n      '{\"error\":\"upstream_lock_timeout\",\"code\":\"ERR_LEDGER_LOCK_504\",\"retryable\":true}',\n  },\n  {\n    id: 'log-3',\n    requestId: 'req_01J9Z8H3T8',\n    timestamp: '14:57:31 UTC',\n    method: 'POST',\n    route: '/v2/sessions',\n    serviceId: 'svc-checkout-session',\n    serviceName: 'Checkout Session Edge',\n    statusCode: 200,\n    statusClass: '2xx',\n    durationMs: 19,\n    region: 'us-east-1',\n    apiKeyId: 'key-checkout-edge',\n    idempotencyKey: 'idem_sess_7721_c01',\n    tlsMs: 3,\n    queueMs: 2,\n    upstreamMs: 14,\n    requestPayload: '{\"merchantId\":\"m_fernwood\",\"cartTotal\":980,\"currency\":\"USD\",\"cohort\":\"on_twos\"}',\n    responsePayload: '{\"sessionId\":\"cs_live_9042\",\"holdout\":false,\"expiresIn\":1800}',\n  },\n  {\n    id: 'log-4',\n    requestId: 'req_01J9Z8G1V4',\n    timestamp: '14:56:04 UTC',\n    method: 'POST',\n    route: '/v2/customs/quote',\n    serviceId: 'svc-tax-quote',\n    serviceName: 'Customs & Duty Quote API',\n    statusCode: 422,\n    statusClass: '4xx',\n    durationMs: 31,\n    region: 'eu-central-1',\n    apiKeyId: 'key-checkout-edge',\n    idempotencyKey: 'idem_duty_3319_hs',\n    tlsMs: 4,\n    queueMs: 5,\n    upstreamMs: 22,\n    requestPayload: '{\"origin\":\"US\",\"destination\":\"JP\",\"hsCode\":\"9608.20.INVALID\",\"declaredValue\":640}',\n    responsePayload:\n      '{\"error\":\"invalid_hs_tariff_code\",\"field\":\"hsCode\",\"expectedPattern\":\"^\\\\\\\\d{4}\\\\\\\\.\\\\\\\\d{2}$\"}',\n  },\n  {\n    id: 'log-5',\n    requestId: 'req_01J9Z8E8B2',\n    timestamp: '14:54:50 UTC',\n    method: 'GET',\n    route: '/v2/sessions/:id',\n    serviceId: 'svc-checkout-session',\n    serviceName: 'Checkout Session Edge',\n    statusCode: 200,\n    statusClass: '2xx',\n    durationMs: 12,\n    region: 'us-east-1',\n    apiKeyId: 'key-datadog-exporter',\n    idempotencyKey: 'idem_read_9044_q',\n    tlsMs: 3,\n    queueMs: 1,\n    upstreamMs: 8,\n    requestPayload: '{\"sessionId\":\"cs_live_9044\",\"includeAttribution\":true}',\n    responsePayload: '{\"sessionId\":\"cs_live_9044\",\"status\":\"recovered\",\"liftPP\":3.6}',\n  },\n  {\n    id: 'log-6',\n    requestId: 'req_01J9Z8C2W9',\n    timestamp: '14:52:19 UTC',\n    method: 'POST',\n    route: '/v2/webhooks/replay',\n    serviceId: 'svc-webhook-dispatch',\n    serviceName: 'Webhook Dispatch Engine',\n    statusCode: 429,\n    statusClass: '4xx',\n    durationMs: 9,\n    region: 'us-east-1',\n    apiKeyId: 'key-prod-primary',\n    idempotencyKey: 'idem_replay_burst_19',\n    tlsMs: 3,\n    queueMs: 2,\n    upstreamMs: 4,\n    requestPayload: '{\"deliveryId\":\"dlv_8810c\",\"reason\":\"endpoint_timeout_retry\"}',\n    responsePayload:\n      '{\"error\":\"rate_limit_exceeded\",\"limitRps\":600,\"retryAfterSeconds\":2}',\n  },\n  {\n    id: 'log-7',\n    requestId: 'req_01J9Z8A7Q1',\n    timestamp: '14:50:03 UTC',\n    method: 'GET',\n    route: '/v2/inventory/stock',\n    serviceId: 'svc-inventory-ledger',\n    serviceName: 'Inventory Ledger Sync',\n    statusCode: 200,\n    statusClass: '2xx',\n    durationMs: 33,\n    region: 'us-east-1',\n    apiKeyId: 'key-datadog-exporter',\n    idempotencyKey: 'idem_stock_us_08',\n    tlsMs: 4,\n    queueMs: 5,\n    upstreamMs: 24,\n    requestPayload: '{\"warehouse\":\"EWR-01\",\"skus\":[\"F12-TONE-SHEET\",\"F12-PEG-BAR\"]}',\n    responsePayload: '{\"warehouse\":\"EWR-01\",\"available\":{\"F12-TONE-SHEET\":480,\"F12-PEG-BAR\":195}}',\n  },\n  {\n    id: 'log-8',\n    requestId: 'req_01J9Z890N5',\n    timestamp: '14:48:22 UTC',\n    method: 'DELETE',\n    route: '/v2/customs/cache',\n    serviceId: 'svc-tax-quote',\n    serviceName: 'Customs & Duty Quote API',\n    statusCode: 401,\n    statusClass: '4xx',\n    durationMs: 7,\n    region: 'us-east-1',\n    apiKeyId: 'key-legacy-migration',\n    idempotencyKey: 'idem_purge_revoked_01',\n    tlsMs: 3,\n    queueMs: 1,\n    upstreamMs: 3,\n    requestPayload: '{\"merchantId\":\"m_fernwood\",\"scope\":\"hs_chapter_96\"}',\n    responsePayload:\n      '{\"error\":\"revoked_api_key\",\"keyId\":\"key-legacy-migration\",\"message\":\"Simulated credential was revoked.\"}',\n  },\n  {\n    id: 'log-9',\n    requestId: 'req_01J9Z874L3',\n    timestamp: '14:45:11 UTC',\n    method: 'POST',\n    route: '/v2/webhooks/dispatch',\n    serviceId: 'svc-webhook-dispatch',\n    serviceName: 'Webhook Dispatch Engine',\n    statusCode: 502,\n    statusClass: '5xx',\n    durationMs: 618,\n    region: 'eu-central-1',\n    apiKeyId: 'key-prod-primary',\n    idempotencyKey: 'idem_ord_9038_badgw',\n    tlsMs: 5,\n    queueMs: 14,\n    upstreamMs: 599,\n    requestPayload: '{\"event\":\"payment.retry_scheduled\",\"orderId\":\"ORD-9038\",\"attempt\":2}',\n    responsePayload:\n      '{\"error\":\"upstream_bad_gateway\",\"code\":\"ERR_WEBHOOK_TARGET_502\",\"scheduledRetryInSec\":4}',\n  },\n  {\n    id: 'log-10',\n    requestId: 'req_01J9Z859D7',\n    timestamp: '14:42:08 UTC',\n    method: 'POST',\n    route: '/v2/customs/quote',\n    serviceId: 'svc-tax-quote',\n    serviceName: 'Customs & Duty Quote API',\n    statusCode: 200,\n    statusClass: '2xx',\n    durationMs: 42,\n    region: 'us-east-1',\n    apiKeyId: 'key-checkout-edge',\n    idempotencyKey: 'idem_duty_9037_ok',\n    tlsMs: 4,\n    queueMs: 6,\n    upstreamMs: 32,\n    requestPayload: '{\"origin\":\"US\",\"destination\":\"DE\",\"hsCode\":\"9608.20\",\"declaredValue\":1250}',\n    responsePayload: '{\"dutyUsd\":37.5,\"vatUsd\":244.63,\"totalLandedUsd\":1532.13,\"canary\":true}',\n  },\n  {\n    id: 'log-11',\n    requestId: 'req_01J9Z832F6',\n    timestamp: '14:39:44 UTC',\n    method: 'PUT',\n    route: '/v2/inventory/reserve',\n    serviceId: 'svc-inventory-ledger',\n    serviceName: 'Inventory Ledger Sync',\n    statusCode: 200,\n    statusClass: '2xx',\n    durationMs: 49,\n    region: 'us-east-1',\n    apiKeyId: 'key-checkout-edge',\n    idempotencyKey: 'idem_sku_4402_ok',\n    tlsMs: 4,\n    queueMs: 8,\n    upstreamMs: 37,\n    requestPayload: '{\"sku\":\"F12-RULED-PAD\",\"warehouse\":\"EWR-01\",\"quantity\":4,\"holdSeconds\":900}',\n    responsePayload: '{\"reservationId\":\"rsv_33019\",\"expiresAt\":\"14:54:44Z\",\"remainingStock\":92}',\n  },\n  {\n    id: 'log-12',\n    requestId: 'req_01J9Z811R2',\n    timestamp: '14:36:15 UTC',\n    method: 'POST',\n    route: '/v2/webhooks/dispatch',\n    serviceId: 'svc-webhook-dispatch',\n    serviceName: 'Webhook Dispatch Engine',\n    statusCode: 202,\n    statusClass: '2xx',\n    durationMs: 26,\n    region: 'us-east-1',\n    apiKeyId: 'key-prod-primary',\n    idempotencyKey: 'idem_ord_9035_ok',\n    tlsMs: 4,\n    queueMs: 4,\n    upstreamMs: 18,\n    requestPayload: '{\"event\":\"order.recovered\",\"orderId\":\"ORD-9035\",\"amountUsd\":2150}',\n    responsePayload: '{\"accepted\":true,\"deliveryId\":\"dlv_8792f\",\"queuedAt\":\"14:36:15.026Z\"}',\n  },\n];\n\nconst AUDIT_FEED = [\n  {\n    id: 'aud-1',\n    time: '14:58 UTC',\n    actor: 'svc-inventory-ledger',\n    summary: 'Replica lock contention alert opened in eu-central-1 (+14 ms p95 drift).',\n    status: 'warning' as TagStatus,\n    badge: 'DEGRADED',\n  },\n  {\n    id: 'aud-2',\n    time: '14:48 UTC',\n    actor: 'key-legacy-migration',\n    summary: 'Rejected DELETE /v2/customs/cache with revoked credential (401).',\n    status: 'danger' as TagStatus,\n    badge: 'BLOCKED',\n  },\n  {\n    id: 'aud-3',\n    time: '14:20 UTC',\n    actor: 'svc-tax-quote',\n    summary: 'Canary tariff schedule v2.4 promoted to 15% traffic weight.',\n    status: 'info' as TagStatus,\n    badge: 'CANARY',\n  },\n  {\n    id: 'aud-4',\n    time: '13:55 UTC',\n    actor: 'svc-webhook-dispatch',\n    summary: 'HMAC-SHA256 key rotation verified across 4 regional edge pop nodes.',\n    status: 'success' as TagStatus,\n    badge: 'VERIFIED',\n  },\n];\n\nfunction statusToTagStatus(status: 'healthy' | 'degraded' | 'canary'): TagStatus {\n  if (status === 'healthy') return 'success';\n  if (status === 'degraded') return 'warning';\n  return 'info';\n}\n\nfunction statusToLabel(status: 'healthy' | 'degraded' | 'canary'): string {\n  if (status === 'healthy') return 'HEALTHY';\n  if (status === 'degraded') return 'DEGRADED';\n  return 'CANARY';\n}\n\nfunction httpCodeToTagStatus(statusCode: number): TagStatus {\n  if (statusCode >= 500) return 'danger';\n  if (statusCode >= 400) return 'warning';\n  return 'success';\n}\n\nfunction scopeToLabel(scope: ApiKeyScope): string {\n  if (scope === 'admin') return 'ADMIN';\n  if (scope === 'dispatch_write') return 'DISPATCH_WRITE';\n  return 'READ_ONLY';\n}\n\n/** Scrolls a region into view only when it is off-screen, honouring reduced motion and `cut`. */\nfunction revealIfOffscreen(el: HTMLElement, motion: MotionMode) {\n  const rect = el.getBoundingClientRect();\n  const viewportHeight = window.innerHeight || document.documentElement.clientHeight;\n  if (rect.top >= 0 && rect.bottom <= viewportHeight) return;\n  const reduce = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;\n  el.scrollIntoView({ block: 'start', behavior: reduce || motion === 'cut' ? 'auto' : 'smooth' });\n}\n\nfunction fmtCompactNumber(n: number): string {\n  return Math.round(n).toLocaleString('en-US');\n}\n\nexport interface DeveloperConsoleProps {\n  defaultSection?: ConsoleSection;\n  defaultDatasetState?: ConsoleDatasetState;\n  defaultTimeRange?: ConsoleTimeRange;\n  defaultEnvironment?: ConsoleEnvironment;\n  /** Alias for `defaultSection`. */\n  initialSection?: ConsoleSection;\n  /** Alias for `defaultDatasetState`. */\n  initialDatasetState?: ConsoleDatasetState;\n  /** Alias for `defaultTimeRange`. */\n  initialTimeRange?: ConsoleTimeRange;\n  /** Alias for `defaultEnvironment`. */\n  initialEnvironment?: ConsoleEnvironment;\n  motion?: MotionMode;\n  theme?: 'light' | 'dark';\n  idPrefix?: string;\n  showSandboxControls?: boolean;\n  className?: string;\n  headerSlot?: React.ReactNode;\n  footerSlot?: React.ReactNode;\n  /**\n   * Called once with the new section after every internal section change (tab click, breadcrumb,\n   * empty-state or cross-link). Never called on mount. Use it to mirror the section into a URL\n   * (e.g. `?section=`) without making the block router-aware.\n   */\n  onSectionChange?: (section: ConsoleSection) => void;\n}\n\nconst SLO_TARGET_MAX_ERROR_BPS = 50;\n\nfunction DeveloperConsoleInner({\n  defaultSection,\n  defaultDatasetState,\n  defaultTimeRange,\n  defaultEnvironment,\n  initialSection,\n  initialDatasetState,\n  initialTimeRange,\n  initialEnvironment,\n  motion = 'stepped',\n  theme,\n  idPrefix,\n  showSandboxControls = true,\n  className = '',\n  headerSlot,\n  footerSlot,\n  onSectionChange,\n}: DeveloperConsoleProps) {\n  const { toast } = useToast();\n  const reactId = React.useId().replace(/[^a-zA-Z0-9_-]/g, '');\n  const resolvedIdPrefix = idPrefix ?? `f12-console-${reactId || 'instance'}`;\n\n  // Top-level navigation, environment, time window, and dataset simulation state\n  const [activeSection, setActiveSection] = React.useState<ConsoleSection>(\n    defaultSection ?? initialSection ?? 'overview',\n  );\n  // Report each committed section change (never the initial mount) to the optional callback.\n  // Comparing against the last reported value keeps StrictMode effect replays from double-firing.\n  const onSectionChangeRef = React.useRef(onSectionChange);\n  onSectionChangeRef.current = onSectionChange;\n  const reportedSectionRef = React.useRef(activeSection);\n  React.useEffect(() => {\n    if (reportedSectionRef.current === activeSection) return;\n    reportedSectionRef.current = activeSection;\n    onSectionChangeRef.current?.(activeSection);\n  }, [activeSection]);\n  const [datasetState, setDatasetState] = React.useState<ConsoleDatasetState>(\n    defaultDatasetState ?? initialDatasetState ?? 'populated',\n  );\n  const [timeRange, setTimeRange] = React.useState<ConsoleTimeRange>(\n    defaultTimeRange ?? initialTimeRange ?? '24h',\n  );\n  const [environment, setEnvironment] = React.useState<ConsoleEnvironment>(\n    defaultEnvironment ?? initialEnvironment ?? 'prod-us-east-1',\n  );\n\n  // Overview state: selected service for comparison overlay\n  const [selectedServiceId, setSelectedServiceId] = React.useState<string>('svc-webhook-dispatch');\n\n  // Services & Endpoints state\n  const [endpointSearch, setEndpointSearch] = React.useState('');\n  const [endpointHealthFilter, setEndpointHealthFilter] =\n    React.useState<EndpointHealthFilter>('all');\n  const [endpointMethodFilter, setEndpointMethodFilter] =\n    React.useState<EndpointMethodFilter>('ALL');\n  const [sheddingByService, setSheddingByService] = React.useState<Record<string, boolean>>({\n    'svc-webhook-dispatch': false,\n    'svc-checkout-session': false,\n    'svc-inventory-ledger': true,\n    'svc-tax-quote': false,\n  });\n  const [inspectedEndpointId, setInspectedEndpointId] = React.useState<string>(\n    CONSOLE_ENDPOINTS[0].id,\n  );\n\n  // API Keys state\n  const [apiKeys, setApiKeys] = React.useState<SimulatedApiKey[]>(INITIAL_API_KEYS);\n  const [newKeyLabel, setNewKeyLabel] = React.useState('');\n  const [newKeyScope, setNewKeyScope] = React.useState<ApiKeyScope>('dispatch_write');\n  const [newKeyTier, setNewKeyTier] = React.useState('Burst · 2,000 req/s');\n  const [newKeyHmac, setNewKeyHmac] = React.useState(true);\n  const [keyLabelError, setKeyLabelError] = React.useState<string | undefined>(undefined);\n  const [lastIssuedKey, setLastIssuedKey] = React.useState<SimulatedApiKey | null>(null);\n  const [revokeTargetKey, setRevokeTargetKey] = React.useState<SimulatedApiKey | null>(null);\n  const keyInputRef = React.useRef<HTMLInputElement | null>(null);\n  const keySeqRef = React.useRef(1);\n\n  // Request Logs state\n  const [requestLogs, setRequestLogs] =\n    React.useState<ConsoleRequestLogItem[]>(INITIAL_REQUEST_LOGS);\n  const [logSearch, setLogSearch] = React.useState('');\n  const [logStatusFilter, setLogStatusFilter] = React.useState<LogStatusFilter>('all');\n  const [logServiceFilter, setLogServiceFilter] = React.useState<string>('all');\n  const [logPage, setLogPage] = React.useState(1);\n  const [inspectedLog, setInspectedLog] = React.useState<ConsoleRequestLogItem | null>(null);\n  const lastInspectedLogIdRef = React.useRef<string | null>(null);\n  const pendingFocusTargetIdRef = React.useRef<string | null>(null);\n  // Set alongside a pending focus target when the move should also bring the section tabs into\n  // view (breadcrumb navigation from the sheet header to the tab strip below the KPI scene).\n  const pendingRevealMotionRef = React.useRef<MotionMode | null>(null);\n  // Programmatic reveal scrolls follow the resolved motion (smooth unless cut, still or reduced).\n  const resolvedMotion = useResolvedMotion(motion);\n  const replaySeqRef = React.useRef(1);\n\n  const snapshot = CONSOLE_RANGE_SNAPSHOTS[timeRange];\n  const rangeChanged = useChanged(timeRange);\n  const isEmptyDataset = datasetState === 'empty';\n  const sloWithinBudget = snapshot.errorRateBasisPoints <= SLO_TARGET_MAX_ERROR_BPS;\n\n  const peakPoint = React.useMemo(\n    () =>\n      snapshot.series.reduce(\n        (best, pt) => (pt.value > best.value ? pt : best),\n        snapshot.series[0],\n      ),\n    [snapshot],\n  );\n\n  const rangeFooterMetrics = React.useMemo(() => {\n    const peakWindowValue =\n      snapshot.range === '24h'\n        ? `${fmtCompactNumber(peakPoint.value)}k (${peakPoint.label} UTC)`\n        : `${fmtCompactNumber(peakPoint.value)}k (${peakPoint.label})`;\n    const peakChartNote =\n      snapshot.range === '24h'\n        ? `peak ${fmtCompactNumber(peakPoint.value)}k at ${peakPoint.label} UTC`\n        : `peak ${fmtCompactNumber(peakPoint.value)}k on ${peakPoint.label}`;\n    const deliveredPct = ((10000 - snapshot.errorRateBasisPoints) / 100).toFixed(2);\n    const deliveredCount = snapshot.totalRequests - snapshot.errorCount;\n    const deliveredCountLabel =\n      deliveredCount >= 1_000_000\n        ? `${(deliveredCount / 1_000_000).toFixed(2)}M`\n        : `${(deliveredCount / 1_000).toFixed(1)}k`;\n    const deliveredValue = `${deliveredPct}% · ${deliveredCountLabel}`;\n\n    // Partition non-2xx responses into 5xx upstream faults and 4xx client/throttled (401/422/429)\n    const errorBreakdown =\n      snapshot.range === '24h'\n        ? {\n            upstream5xx: '0.11% · 1,631',\n            client4xx: '0.31% · 4,597',\n          }\n        : snapshot.range === '7d'\n          ? {\n              upstream5xx: '0.14% · 13,776',\n              client4xx: '0.37% · 36,409',\n            }\n          : {\n              upstream5xx: '0.16% · 63,056',\n              client4xx: '0.42% · 165,522',\n            };\n\n    return {\n      peakWindowValue,\n      peakChartNote,\n      deliveredValue,\n      ...errorBreakdown,\n    };\n  }, [snapshot, peakPoint]);\n\n  const effectiveServices = React.useMemo<ConsoleServiceItem[]>(\n    () =>\n      CONSOLE_SERVICES.map((svc) =>\n        isEmptyDataset\n          ? {\n              ...svc,\n              requests24h: 0,\n              share24h: 0,\n              p95Ms: 0,\n              errorRatePct: '0.00%',\n            }\n          : svc,\n      ),\n    [isEmptyDataset],\n  );\n\n  const selectedService =\n    effectiveServices.find((s) => s.id === selectedServiceId) ?? effectiveServices[0];\n  const degradedServices = effectiveServices.filter((s) => s.status === 'degraded');\n  const primaryDegradedService = degradedServices[0] ?? effectiveServices[2];\n\n  const chartData = React.useMemo<ToneAreaDatum[]>(() => {\n    if (isEmptyDataset) return [];\n    const compareValues = snapshot.serviceSeries[selectedService.id] ?? [];\n    return snapshot.series.map((pt, idx) => ({\n      ...pt,\n      compareValue: compareValues[idx] ?? pt.compareValue,\n    }));\n  }, [isEmptyDataset, snapshot, selectedService.id]);\n\n  const serviceBarItems = React.useMemo<ToneBarItem[]>(\n    () =>\n      effectiveServices.map((svc) => ({\n        id: svc.id,\n        name: `${svc.name} (${svc.code})`,\n        value: svc.requests24h,\n        formattedValue: isEmptyDataset\n          ? `${fmtCompactNumber(svc.requests24h)} · ${svc.errorRatePct} err`\n          : svc.status === 'degraded'\n            ? `${fmtCompactNumber(svc.requests24h)} · ${svc.errorRatePct} err (!)`\n            : svc.status === 'canary'\n              ? `${fmtCompactNumber(svc.requests24h)} · ${svc.errorRatePct} err (~1%)`\n              : `${fmtCompactNumber(svc.requests24h)} · ${svc.errorRatePct} err`,\n        share: svc.share24h,\n        pattern: svc.pattern,\n      })),\n    [effectiveServices, isEmptyDataset],\n  );\n\n  const effectiveEndpoints = React.useMemo<ConsoleEndpointItem[]>(\n    () =>\n      CONSOLE_ENDPOINTS.map((ep) =>\n        isEmptyDataset\n          ? {\n              ...ep,\n              requests24h: 0,\n              p95Ms: 0,\n              errorRatePct: '0.00%',\n            }\n          : ep,\n      ),\n    [isEmptyDataset],\n  );\n\n  // Filtered endpoints\n  const filteredEndpoints = React.useMemo(() => {\n    const q = endpointSearch.trim().toLowerCase();\n    return effectiveEndpoints.filter((ep) => {\n      if (endpointHealthFilter !== 'all' && ep.status !== endpointHealthFilter) return false;\n      if (endpointMethodFilter !== 'ALL' && ep.method !== endpointMethodFilter) return false;\n      if (!q) return true;\n      return (\n        ep.route.toLowerCase().includes(q) ||\n        ep.serviceName.toLowerCase().includes(q) ||\n        ep.owner.toLowerCase().includes(q) ||\n        ep.description.toLowerCase().includes(q)\n      );\n    });\n  }, [effectiveEndpoints, endpointSearch, endpointHealthFilter, endpointMethodFilter]);\n\n  const inspectedEndpoint =\n    effectiveEndpoints.find((ep) => ep.id === inspectedEndpointId) ??\n    filteredEndpoints[0] ??\n    effectiveEndpoints[0];\n\n  const effectiveRequestLogs = React.useMemo<ConsoleRequestLogItem[]>(\n    () => (isEmptyDataset ? [] : requestLogs),\n    [isEmptyDataset, requestLogs],\n  );\n\n  // Filtered & paginated request logs\n  const filteredLogs = React.useMemo(() => {\n    const q = logSearch.trim().toLowerCase();\n    return effectiveRequestLogs.filter((item) => {\n      if (logStatusFilter !== 'all' && item.statusClass !== logStatusFilter) return false;\n      if (logServiceFilter !== 'all' && item.serviceId !== logServiceFilter) return false;\n      if (!q) return true;\n      return (\n        item.requestId.toLowerCase().includes(q) ||\n        item.route.toLowerCase().includes(q) ||\n        item.idempotencyKey.toLowerCase().includes(q) ||\n        item.serviceName.toLowerCase().includes(q) ||\n        String(item.statusCode).includes(q)\n      );\n    });\n  }, [effectiveRequestLogs, logSearch, logStatusFilter, logServiceFilter]);\n\n  const LOGS_PER_PAGE = 5;\n  const totalLogPages = Math.max(1, Math.ceil(filteredLogs.length / LOGS_PER_PAGE));\n  const safeLogPage = Math.min(logPage, totalLogPages);\n  const pagedLogs = React.useMemo(() => {\n    const start = (safeLogPage - 1) * LOGS_PER_PAGE;\n    return filteredLogs.slice(start, start + LOGS_PER_PAGE);\n  }, [filteredLogs, safeLogPage]);\n\n  const activeKeyCount = apiKeys.filter((k) => k.status === 'active').length;\n\n  const sectionLabels: Record<ConsoleSection, string> = {\n    overview: 'Overview',\n    services: 'Services & Endpoints',\n    'api-keys': 'API Keys',\n    'request-logs': 'Request Logs',\n  };\n\n  const envLabel =\n    environment === 'prod-us-east-1' ? 'Production (us-east-1)' : 'Staging (eu-central-1)';\n\n  const handleResetSandbox = () => {\n    pendingFocusTargetIdRef.current = null;\n    setDatasetState('populated');\n    setTimeRange('24h');\n    setEnvironment('prod-us-east-1');\n    setSelectedServiceId('svc-webhook-dispatch');\n    setEndpointSearch('');\n    setEndpointHealthFilter('all');\n    setEndpointMethodFilter('ALL');\n    setInspectedEndpointId(CONSOLE_ENDPOINTS[0].id);\n    setSheddingByService({\n      'svc-webhook-dispatch': false,\n      'svc-checkout-session': false,\n      'svc-inventory-ledger': true,\n      'svc-tax-quote': false,\n    });\n    setApiKeys(INITIAL_API_KEYS);\n    setNewKeyLabel('');\n    setNewKeyScope('dispatch_write');\n    setNewKeyTier('Burst · 2,000 req/s');\n    setNewKeyHmac(true);\n    setKeyLabelError(undefined);\n    setLastIssuedKey(null);\n    setRevokeTargetKey(null);\n    setRequestLogs(INITIAL_REQUEST_LOGS);\n    setLogSearch('');\n    setLogStatusFilter('all');\n    setLogServiceFilter('all');\n    setLogPage(1);\n    setInspectedLog(null);\n    window.requestAnimationFrame(() => {\n      document.getElementById(`${resolvedIdPrefix}-reset-sandbox`)?.focus();\n    });\n    toast({\n      status: 'info',\n      title: 'Sandbox fixtures reset',\n      description: 'Restored initial deterministic API keys, endpoints, and request logs.',\n    });\n  };\n\n  const handleToggleShedding = (svc: ConsoleServiceItem, nextChecked: boolean) => {\n    setSheddingByService((prev) => ({ ...prev, [svc.id]: nextChecked }));\n    toast({\n      status: nextChecked ? 'warning' : 'success',\n      title: `${svc.name}: ${nextChecked ? 'Queue shedding enabled' : 'Normal routing restored'}`,\n      description: `Simulated circuit-breaker state updated in local memory (${svc.code}).`,\n    });\n  };\n\n  const handleIssueApiKey = (e: React.FormEvent<HTMLFormElement>) => {\n    e.preventDefault();\n    const trimmed = newKeyLabel.trim();\n    if (trimmed.length < 3) {\n      setKeyLabelError('Enter a descriptive key label of at least 3 characters.');\n      keyInputRef.current?.focus();\n      return;\n    }\n    if (trimmed.length > 40) {\n      setKeyLabelError('Key label must be 40 characters or fewer.');\n      keyInputRef.current?.focus();\n      return;\n    }\n    const duplicate = apiKeys.some(\n      (k) => k.status === 'active' && k.label.toLowerCase() === trimmed.toLowerCase(),\n    );\n    if (duplicate) {\n      setKeyLabelError('An active simulated key with this label already exists.');\n      keyInputRef.current?.focus();\n      return;\n    }\n\n    keySeqRef.current += 1;\n    const suffix = String(4100 + keySeqRef.current * 37).slice(-4);\n    const scopeSegment =\n      newKeyScope === 'admin' ? 'admin' : newKeyScope === 'dispatch_write' ? 'live' : 'read';\n    const created: SimulatedApiKey = {\n      id: `key-sim-${keySeqRef.current}`,\n      label: trimmed,\n      maskedToken: `f12_sim_${scopeSegment}_••••_${suffix}`,\n      scope: newKeyScope,\n      rateTier: newKeyTier,\n      requireHmac: newKeyHmac,\n      createdAt: '2026-10-31',\n      lastUsed: 'Never (just issued)',\n      status: 'active',\n    };\n\n    setApiKeys((prev) => [created, ...prev]);\n    setNewKeyLabel('');\n    setKeyLabelError(undefined);\n    setLastIssuedKey(created);\n    toast({\n      status: 'success',\n      title: 'Simulated API key issued',\n      description: `Created ${created.maskedToken} (${scopeToLabel(created.scope)}) in browser memory.`,\n    });\n  };\n\n  const handleConfirmRevokeKey = () => {\n    if (!revokeTargetKey) return;\n    const target = revokeTargetKey;\n    setApiKeys((prev) =>\n      prev.map((k) => (k.id === target.id ? { ...k, status: 'revoked' } : k)),\n    );\n    if (lastIssuedKey?.id === target.id) {\n      setLastIssuedKey(null);\n    }\n    setRevokeTargetKey(null);\n    toast({\n      status: 'warning',\n      title: 'Simulated API key revoked',\n      description: `${target.label} (${target.maskedToken}) marked REVOKED in local state.`,\n    });\n    if (typeof window !== 'undefined') {\n      window.requestAnimationFrame(() => {\n        document.getElementById(`${resolvedIdPrefix}-copy-key-${target.id}`)?.focus();\n      });\n    }\n  };\n\n  const handleReplayRequest = (logItem: ConsoleRequestLogItem) => {\n    replaySeqRef.current += 1;\n    const replayId = `req_01J9Z9RPL${replaySeqRef.current}`;\n    const associatedKey = apiKeys.find((k) => k.id === logItem.apiKeyId);\n    const isKeyRevoked = !associatedKey || associatedKey.status === 'revoked';\n    const statusCode = isKeyRevoked ? 401 : logItem.method === 'POST' ? 202 : 200;\n    const statusClass: ConsoleRequestLogItem['statusClass'] = isKeyRevoked ? '4xx' : '2xx';\n    const durationMs = isKeyRevoked ? 7 : 21;\n    const replayedEntry: ConsoleRequestLogItem = {\n      ...logItem,\n      id: `log-replay-${replaySeqRef.current}`,\n      requestId: replayId,\n      timestamp: '15:00:04 UTC',\n      statusCode,\n      statusClass,\n      durationMs,\n      tlsMs: 3,\n      queueMs: isKeyRevoked ? 1 : 3,\n      upstreamMs: isKeyRevoked ? 3 : 15,\n      responsePayload: isKeyRevoked\n        ? `{\"replayedFrom\":\"${logItem.requestId}\",\"error\":\"revoked_api_key\",\"message\":\"Credential ${logItem.apiKeyId} was revoked; replay rejected at edge.\"}`\n        : `{\"replayedFrom\":\"${logItem.requestId}\",\"status\":\"accepted\",\"simulated\":true}`,\n      replayed: true,\n    };\n    setRequestLogs((prev) => [replayedEntry, ...prev]);\n    setInspectedLog(replayedEntry);\n    setLogPage(1);\n    if (datasetState === 'empty') {\n      setDatasetState('populated');\n    }\n    toast({\n      status: isKeyRevoked ? 'danger' : 'success',\n      title: isKeyRevoked\n        ? `Replay rejected (${logItem.requestId})`\n        : `Replayed ${logItem.requestId}`,\n      description: isKeyRevoked\n        ? `Recorded simulated replay ${replayId} (401 Unauthorized · revoked credential ${logItem.apiKeyId}).`\n        : `Recorded simulated replay ${replayId} (${replayedEntry.statusCode} OK · 21 ms).`,\n    });\n  };\n\n  React.useEffect(() => {\n    if (inspectedLog) {\n      lastInspectedLogIdRef.current = inspectedLog.id;\n      return;\n    }\n    const closingLogId = lastInspectedLogIdRef.current;\n    if (!closingLogId || typeof document === 'undefined') return;\n    lastInspectedLogIdRef.current = null;\n\n    const restore = () => {\n      const targetBtn = document.getElementById(\n        `${resolvedIdPrefix}-inspect-log-${closingLogId}`,\n      );\n      const active = document.activeElement;\n      const focusLost =\n        !active ||\n        active === document.body ||\n        active === document.documentElement ||\n        !active.isConnected;\n      if (targetBtn && (focusLost || closingLogId.startsWith('log-replay-'))) {\n        targetBtn.focus({ preventScroll: true });\n        return;\n      }\n      if (focusLost) {\n        document.getElementById(`${resolvedIdPrefix}-log-search`)?.focus({ preventScroll: true });\n      }\n    };\n    restore();\n    const raf = window.requestAnimationFrame(restore);\n    return () => window.cancelAnimationFrame(raf);\n  }, [inspectedLog, resolvedIdPrefix]);\n\n  React.useEffect(() => {\n    const targetId = pendingFocusTargetIdRef.current;\n    const revealMotion = pendingRevealMotionRef.current;\n    pendingRevealMotionRef.current = null;\n    if (!targetId || typeof document === 'undefined') return;\n    pendingFocusTargetIdRef.current = null;\n    const applyFocus = () => {\n      const el =\n        document.getElementById(targetId) ??\n        document.getElementById(`${resolvedIdPrefix}-tab-${activeSection}`);\n      el?.focus({ preventScroll: true });\n    };\n    applyFocus();\n    const raf = window.requestAnimationFrame(() => {\n      applyFocus();\n      const el = document.getElementById(targetId);\n      if (revealMotion && el) {\n        revealIfOffscreen(el.closest<HTMLElement>('[role=\"tablist\"]') ?? el, revealMotion);\n      }\n    });\n    return () => window.cancelAnimationFrame(raf);\n  }, [\n    activeSection,\n    datasetState,\n    endpointSearch,\n    endpointHealthFilter,\n    endpointMethodFilter,\n    logSearch,\n    logStatusFilter,\n    logServiceFilter,\n    selectedServiceId,\n    resolvedIdPrefix,\n  ]);\n\n  return (\n    <Sheet\n      id={`${resolvedIdPrefix}-sheet`}\n      autoCut\n      pegs\n      motion={motion}\n      theme={theme}\n      className={['f12-console', className].filter(Boolean).join(' ')}\n    >\n      {/* Top Header & Breadcrumb */}\n      <header className=\"f12-hd\">\n        <div className=\"f12-hd-text\">\n          <Breadcrumb\n            aria-label=\"Console hierarchy\"\n            density=\"compact\"\n            items={[\n              // Org root: context text — no org-level view exists inside this block.\n              { label: 'Fernwood Relay' },\n              {\n                // Environment level → its landing section (Overview). Only actionable when it\n                // would change the view.\n                label: envLabel,\n                onSelect:\n                  activeSection !== 'overview'\n                    ? () => {\n                        const targetId = `${resolvedIdPrefix}-tab-overview`;\n                        // Move focus before this button unmounts (it turns back into text at the\n                        // landing section) so Firefox carries :focus-visible over for keyboard use.\n                        document.getElementById(targetId)?.focus({ preventScroll: true });\n                        pendingFocusTargetIdRef.current = targetId;\n                        pendingRevealMotionRef.current = resolvedMotion;\n                        setActiveSection('overview');\n                      }\n                    : undefined,\n              },\n              {\n                label: sectionLabels[activeSection],\n                current: true,\n              },\n            ]}\n          />\n          <p className=\"f12-eyebrow\">\n            <span>API &amp; WEBHOOK CONTROL PLANE</span>\n            <Tag>v2.4</Tag>\n            <Badge status=\"info\" burst={false}>\n              SIMULATED LOCAL FIXTURES\n            </Badge>\n          </p>\n          <h1 className=\"f12-title\">Developer Console</h1>\n          <p className=\"f12-sub\">\n            {snapshot.windowNote} · Simulated credentials (f12_sim_*), circuit breakers, and replays\n            execute against deterministic in-memory fixtures.\n          </p>\n        </div>\n\n        <div className=\"f12-stack-pair\">\n          <div\n            className=\"f12-console-toolbar f12-console-hd-toolbar\"\n            role=\"group\"\n            aria-label=\"Environment and time window\"\n          >\n            <Select\n              id={`${resolvedIdPrefix}-env-select`}\n              label=\"Simulated Environment\"\n              value={environment}\n              onValueChange={(v) => setEnvironment(v as ConsoleEnvironment)}\n            >\n              <SelectTrigger aria-label=\"Target environment\">\n                <SelectValue />\n              </SelectTrigger>\n              <SelectContent>\n                <SelectItem value=\"prod-us-east-1\">Production · us-east-1</SelectItem>\n                <SelectItem value=\"staging-eu-central-1\">Staging · eu-central-1</SelectItem>\n              </SelectContent>\n            </Select>\n\n            <SegmentedControl\n              idPrefix={`${resolvedIdPrefix}-range`}\n              ariaLabel=\"Telemetry time window\"\n              value={timeRange}\n              onChange={setTimeRange}\n              options={[\n                { value: '24h', label: '24', unit: 'hrs' },\n                { value: '7d', label: '7', unit: 'days' },\n                { value: '30d', label: '30', unit: 'days' },\n              ]}\n            />\n          </div>\n\n          {showSandboxControls ? (\n            <div\n              className=\"f12-row-pair\"\n              role=\"group\"\n              aria-label=\"Sandbox dataset state and simulation controls\"\n            >\n              <SegmentedControl\n                idPrefix={`${resolvedIdPrefix}-dataset-state`}\n                ariaLabel=\"Dataset simulation state\"\n                value={datasetState}\n                onChange={setDatasetState}\n                options={[\n                  { value: 'populated', label: 'LIVE', unit: 'fixture' },\n                  { value: 'loading', label: 'LOAD', unit: 'skel' },\n                  { value: 'empty', label: 'ZERO', unit: 'empty' },\n                  { value: 'error', label: 'ERR', unit: '503' },\n                ]}\n              />\n              <Button\n                id={`${resolvedIdPrefix}-reset-sandbox`}\n                variant=\"secondary\"\n                size=\"sm\"\n                onClick={handleResetSandbox}\n              >\n                Reset sandbox\n              </Button>\n            </div>\n          ) : null}\n        </div>\n      </header>\n\n      {headerSlot}\n\n      {/* Scene 1: Expressive Establishing Shot KPI Panels (C-01, C-02, C-03) */}\n      <Scene\n        gutter=\"scene\"\n        layout=\"three\"\n        className=\"f12-console-kpi-scene\"\n        aria-busy={datasetState === 'loading'}\n      >\n        <Panel label=\"Gateway request volume\">\n          {datasetState === 'loading' ? (\n            <div className=\"f12-stack-pair\" data-testid=\"console-kpi-skeleton\">\n              <Skeleton variant=\"line\" width=\"55%\" label=\"Loading request volume label\" />\n              <Skeleton variant=\"metric\" width=\"75%\" />\n              <SkeletonText lines={2} />\n            </div>\n          ) : (\n            <div className=\"f12-console-kpi-card\">\n              <div className=\"f12-row-between\">\n                <Tag>THROUGHPUT</Tag>\n                <span className=\"f12-mono-note\">{snapshot.windowNote}</span>\n              </div>\n              <Metric\n                big\n                headingLevel=\"h2\"\n                label=\"Gateway Request Volume\"\n                value={isEmptyDataset ? 0 : snapshot.totalRequests}\n                format={fmtCompactNumber}\n                motion={motion}\n                delta={isEmptyDataset ? 0 : snapshot.requestDeltaPct}\n                deltaKind=\"pct\"\n                comparisonLabel={\n                  isEmptyDataset ? 'awaiting first dispatch' : snapshot.requestDeltaNote\n                }\n              />\n              <div className=\"f12-console-kv-list f12-console-kpi-foot\">\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">Peak Interval</span>\n                  <span className=\"f12-console-kv-value\">\n                    {isEmptyDataset ? '0 reqs' : rangeFooterMetrics.peakWindowValue}\n                  </span>\n                </div>\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">2xx Delivered</span>\n                  <span className=\"f12-console-kv-value\">\n                    {isEmptyDataset ? '0.00% · 0' : rangeFooterMetrics.deliveredValue}\n                  </span>\n                </div>\n              </div>\n            </div>\n          )}\n        </Panel>\n\n        <Panel label=\"Gateway error rate and status\">\n          {datasetState === 'loading' ? (\n            <div className=\"f12-stack-pair\">\n              <Skeleton variant=\"line\" width=\"50%\" label=\"Loading error rate label\" />\n              <Skeleton variant=\"metric\" width=\"65%\" />\n              <SkeletonText lines={2} />\n            </div>\n          ) : (\n            <div className=\"f12-console-kpi-card\">\n              <div className=\"f12-row-between\">\n                <Tag\n                  id={`${resolvedIdPrefix}-slo-status-tag`}\n                  status={\n                    datasetState === 'error'\n                      ? 'danger'\n                      : isEmptyDataset\n                        ? 'neutral'\n                        : sloWithinBudget\n                          ? 'success'\n                          : 'warning'\n                  }\n                >\n                  {datasetState === 'error'\n                    ? 'COLLECTOR 503'\n                    : isEmptyDataset\n                      ? 'IDLE'\n                      : sloWithinBudget\n                        ? 'GATEWAY SLO: HEALTHY'\n                        : 'GATEWAY SLO: BREACHED'}\n                </Tag>\n                <span className=\"f12-mono-note\">0.50% non-2xx limit</span>\n              </div>\n              <Metric\n                big\n                headingLevel=\"h2\"\n                label=\"Error & Throttle Rate\"\n                value={isEmptyDataset ? 0 : snapshot.errorRateBasisPoints}\n                format={(n) => `${(n / 100).toFixed(2)}%`}\n                motion={motion}\n                delta={isEmptyDataset ? 0 : snapshot.errorDeltaPp}\n                deltaKind=\"pp\"\n                comparisonLabel={\n                  isEmptyDataset ? 'no failed requests' : snapshot.errorDeltaNote\n                }\n              />\n              <div className=\"f12-console-kv-list f12-console-kpi-foot\">\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">5xx Upstream Faults</span>\n                  <span className=\"f12-console-kv-value\">\n                    {isEmptyDataset ? '0 (0.00%)' : rangeFooterMetrics.upstream5xx}\n                  </span>\n                </div>\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">4xx Client &amp; Throttled</span>\n                  <span className=\"f12-console-kv-value\">\n                    {isEmptyDataset ? '0 (0.00%)' : rangeFooterMetrics.client4xx}\n                  </span>\n                </div>\n              </div>\n            </div>\n          )}\n        </Panel>\n\n        <Panel label=\"Gateway p95 latency\">\n          {datasetState === 'loading' ? (\n            <div className=\"f12-stack-pair\">\n              <Skeleton variant=\"line\" width=\"52%\" label=\"Loading p95 latency label\" />\n              <Skeleton variant=\"metric\" width=\"60%\" />\n              <Skeleton variant=\"block\" height={74} />\n            </div>\n          ) : (\n            <div className=\"f12-console-kpi-card\">\n              <div className=\"f12-row-between\">\n                <Tag status=\"info\">EDGE P95</Tag>\n                <span className=\"f12-mono-note\">Budget &lt; 65 ms</span>\n              </div>\n              <Metric\n                big\n                headingLevel=\"h2\"\n                label=\"p95 Edge Latency\"\n                value={isEmptyDataset ? 0 : snapshot.p95LatencyMs}\n                format={(n) => `${Math.round(n)} ms`}\n                motion={motion}\n                delta={isEmptyDataset ? 0 : snapshot.latencyDeltaPct}\n                deltaKind=\"pct\"\n                comparisonLabel={\n                  isEmptyDataset ? 'no latency samples' : snapshot.latencyDeltaNote\n                }\n              />\n              {datasetState === 'populated' && (\n                <div className=\"f12-console-kpi-spark\">\n                  <ToneSpark\n                    values={snapshot.latencySpark}\n                    label={`${snapshot.label} p95 trend (window ${snapshot.p95LatencyMs} ms)`}\n                    rangeKey={snapshot.range}\n                    motion={motion}\n                  />\n                </div>\n              )}\n            </div>\n          )}\n        </Panel>\n      </Scene>\n\n      {/* Dataset-level Error / Empty states */}\n      {datasetState === 'error' && (\n        <Alert\n          id={`${resolvedIdPrefix}-error-banner`}\n          status=\"danger\"\n          live=\"polite\"\n          title=\"Upstream telemetry aggregator timeout (ERR_RELAY_UPSTREAM_503)\"\n          description=\"Simulated telemetry collector in us-east-1 did not respond within 2,500ms. Cached control-plane configuration remains available below.\"\n          actions={\n            <Button\n              id={`${resolvedIdPrefix}-retry-telemetry`}\n              variant=\"secondary\"\n              size=\"sm\"\n              onClick={() => {\n                pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-dataset-state-populated`;\n                setDatasetState('populated');\n                toast({\n                  status: 'success',\n                  title: 'Telemetry stream restored',\n                  description: 'Reconnected to simulated us-east-1 collector checkpoint.',\n                });\n              }}\n            >\n              Retry telemetry sync\n            </Button>\n          }\n        />\n      )}\n\n      {isEmptyDataset && (\n        <EmptyState\n          id={`${resolvedIdPrefix}-empty-workspace`}\n          code=\"0 TELEMETRY EVENTS\"\n          title=\"No API requests recorded in this sandbox window\"\n          description=\"This workspace has not dispatched any webhook or checkout session requests in the selected window. This state is expected for newly provisioned sandboxes prior to first key issuance.\"\n          action={\n            <Button\n              id={`${resolvedIdPrefix}-load-sample-btn`}\n              variant=\"primary\"\n              size=\"sm\"\n              onClick={() => {\n                pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-dataset-state-populated`;\n                setDatasetState('populated');\n                toast({\n                  status: 'success',\n                  title: 'Sample telemetry loaded',\n                  description: 'Populated 1.48M simulated requests across 4 services.',\n                });\n              }}\n            >\n              Load sample data\n            </Button>\n          }\n          secondaryAction={\n            <Button\n              id={`${resolvedIdPrefix}-empty-issue-key-btn`}\n              variant=\"secondary\"\n              size=\"sm\"\n              onClick={() => {\n                pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-key-label-input`;\n                setDatasetState('populated');\n                setActiveSection('api-keys');\n              }}\n            >\n              Issue simulated API key\n            </Button>\n          }\n        />\n      )}\n\n      {/* Scene 2: Four Main Console Experiences */}\n      <Tabs\n        value={activeSection}\n        onValueChange={(next) => setActiveSection(next as ConsoleSection)}\n      >\n        <TabsList aria-label=\"Developer console sections\">\n          <TabsTrigger value=\"overview\" id={`${resolvedIdPrefix}-tab-overview`}>\n            01 · Overview\n          </TabsTrigger>\n          <TabsTrigger value=\"services\" id={`${resolvedIdPrefix}-tab-services`}>\n            02 · Services &amp; Endpoints\n          </TabsTrigger>\n          <TabsTrigger value=\"api-keys\" id={`${resolvedIdPrefix}-tab-api-keys`}>\n            03 · API Keys ({activeKeyCount})\n          </TabsTrigger>\n          <TabsTrigger value=\"request-logs\" id={`${resolvedIdPrefix}-tab-request-logs`}>\n            04 · Request Logs ({effectiveRequestLogs.length})\n          </TabsTrigger>\n        </TabsList>\n\n        {/* =============================================================== TAB 1: OVERVIEW */}\n        <TabsContent value=\"overview\">\n          <div className=\"f12-stack-scene\">\n            <Scene gutter=\"scene\" layout=\"equal\" className=\"f12-console-overview-scene\">\n              <Panel\n                variant=\"expressive\"\n                label=\"Primary request throughput and service overlay\"\n              >\n                {datasetState === 'loading' ? (\n                  <div className=\"f12-stack-pair\">\n                    <Skeleton variant=\"line\" width=\"45%\" />\n                    <Skeleton variant=\"block\" height={240} />\n                    <SkeletonText lines={2} />\n                  </div>\n                ) : (\n                  <div className=\"f12-stack-pair\">\n                    <div className=\"f12-row-between\">\n                      <div className=\"f12-row-pair\">\n                        <Tag>REQUEST TRAFFIC (K)</Tag>\n                        <Badge status=\"neutral\" burst={false}>\n                          {`OVERLAY: ${selectedService.code}`}\n                        </Badge>\n                      </div>\n                      <span className=\"f12-console-kbd-hint\">\n                        <kbd>←</kbd> <kbd>→</kbd> Inspect intervals\n                      </span>\n                    </div>\n                    <h2 className=\"f12-section-title\">\n                      Gateway Throughput &amp; Selected Service\n                    </h2>\n\n                    <p className=\"f12-console-quiet-sub\">\n                      {isEmptyDataset ? (\n                        <>\n                          {`No throughput samples recorded in the selected ${snapshot.label.toLowerCase()} window · Selected overlay = `}\n                          <strong>{selectedService.name}</strong> ({selectedService.code}).\n                        </>\n                      ) : (\n                        <>\n                          {`Shaded area = Total gateway traffic (${rangeFooterMetrics.peakChartNote}) · Dashed line = `}\n                          <strong>{selectedService.name}</strong> ({selectedService.code}).\n                        </>\n                      )}\n                    </p>\n\n                    {isEmptyDataset ? (\n                      <EmptyState\n                        id={`${resolvedIdPrefix}-chart-empty`}\n                        density=\"compact\"\n                        code=\"0 THROUGHPUT SAMPLES\"\n                        title=\"No throughput intervals recorded in this window\"\n                        description=\"Load sample telemetry or dispatch a simulated request to populate the exposure curve and tabular breakdown.\"\n                      />\n                    ) : (\n                      <>\n                        <ToneAreaChart\n                          data={chartData}\n                          motion={motion}\n                          ariaLabel={`Gateway request throughput over ${snapshot.label} with ${selectedService.name} comparison series`}\n                          tableSummary=\"View tabular throughput and service overlay data\"\n                          seriesLabel={`Total Gateway (${snapshot.label})`}\n                          compareLabel={`${selectedService.name} (${selectedService.code})`}\n                          formatValue={(v) => `${fmtCompactNumber(v)}k reqs`}\n                        />\n                        <div\n                          className=\"f12-console-kv-list\"\n                          aria-label=\"Throughput window summary\"\n                        >\n                          <div className=\"f12-console-kv-item\">\n                            <span className=\"f12-console-kv-label\">Sampling Resolution</span>\n                            <span className=\"f12-console-kv-value\">\n                              {`${chartData.length} intervals · ${snapshot.label}`}\n                            </span>\n                          </div>\n                          <div className=\"f12-console-kv-item\">\n                            <span className=\"f12-console-kv-label\">Overlay Series</span>\n                            <span className=\"f12-console-kv-value\">\n                              {`${selectedService.code} · ${Math.round(selectedService.share24h * 100)}% share (${selectedService.errorRatePct} err)`}\n                            </span>\n                          </div>\n                        </div>\n                      </>\n                    )}\n                  </div>\n                )}\n              </Panel>\n\n              <Panel\n                variant=\"quiet\"\n                label=\"Ranked service traffic and error status\"\n              >\n                {datasetState === 'loading' ? (\n                  <div className=\"f12-stack-pair\">\n                    <Skeleton variant=\"line\" width=\"60%\" />\n                    <Skeleton variant=\"block\" height={180} />\n                    <SkeletonText lines={3} />\n                  </div>\n                ) : (\n                  <div className=\"f12-stack-pair\">\n                    <div className=\"f12-row-between\">\n                      <span className=\"f12-console-quiet-title\">\n                        SERVICE TRAFFIC &amp; HEALTH (1.00% LIMIT)\n                      </span>\n                      <Badge status={isEmptyDataset ? 'neutral' : 'warning'} burst={false}>\n                        {isEmptyDataset\n                          ? '0 SAMPLES · IDLE'\n                          : `${degradedServices.length} OF ${effectiveServices.length} DEGRADED · 1 NEAR LIMIT`}\n                      </Badge>\n                    </div>\n                    <p className=\"f12-console-quiet-sub\">\n                      Select any service row to overlay its traffic on the gateway chart. Service\n                      error limit is 1.00% (vs. 0.50% gateway-wide limit).\n                    </p>\n\n                    <ToneBarList\n                      idPrefix={`${resolvedIdPrefix}-svc-bar`}\n                      density=\"compact\"\n                      title=\"24h Traffic & Error Rate by Service\"\n                      subtitle={\n                        isEmptyDataset ? 'Total 0 requests' : 'Total 1,482,900 requests'\n                      }\n                      items={serviceBarItems}\n                      changed={rangeChanged}\n                      selectedId={selectedService.id}\n                      onSelect={(id) => {\n                        if (id) setSelectedServiceId(id);\n                      }}\n                    />\n\n                    <div className=\"f12-console-kv-list\" aria-label=\"Selected service telemetry\">\n                      <div className=\"f12-console-kv-item\">\n                        <span className=\"f12-console-kv-label\">{`Selected Service (${selectedService.code})`}</span>\n                        <span className=\"f12-console-kv-value\">{selectedService.name}</span>\n                      </div>\n                      <div className=\"f12-console-kv-item\">\n                        <span className=\"f12-console-kv-label\">\n                          Service Health (1.00% Limit)\n                        </span>\n                        <span className=\"f12-console-kv-value\">\n                          {isEmptyDataset\n                            ? `${selectedService.p95Ms} ms · ${selectedService.errorRatePct} (NO SAMPLES)`\n                            : selectedService.status === 'degraded'\n                              ? `${selectedService.p95Ms} ms · ${selectedService.errorRatePct} (DEGRADED > 1.0%)`\n                              : selectedService.status === 'canary'\n                                ? `${selectedService.p95Ms} ms · ${selectedService.errorRatePct} (NEAR LIMIT · CANARY)`\n                                : `${selectedService.p95Ms} ms · ${selectedService.errorRatePct} (HEALTHY)`}\n                        </span>\n                      </div>\n                    </div>\n\n                    <div\n                      className=\"f12-console-investigate-bar\"\n                      role=\"group\"\n                      aria-label=\"Service investigation actions\"\n                    >\n                      <p className=\"f12-mono-note\">{selectedService.summary}</p>\n                      <div className=\"f12-row-pair\">\n                        {!isEmptyDataset && selectedService.id !== primaryDegradedService.id && (\n                          <Button\n                            id={`${resolvedIdPrefix}-focus-degraded-svc`}\n                            variant=\"secondary\"\n                            size=\"sm\"\n                            onClick={() => {\n                              const targetId = `int-${resolvedIdPrefix}-svc-bar-${primaryDegradedService.id}`;\n                              document\n                                .getElementById(targetId)\n                                ?.focus({ preventScroll: true });\n                              pendingFocusTargetIdRef.current = targetId;\n                              setSelectedServiceId(primaryDegradedService.id);\n                            }}\n                          >\n                            {`Overlay ${primaryDegradedService.code} (${primaryDegradedService.errorRatePct} err)`}\n                          </Button>\n                        )}\n                        <Button\n                          id={`${resolvedIdPrefix}-investigate-svc-logs`}\n                          variant=\"secondary\"\n                          size=\"sm\"\n                          onClick={() => {\n                            setLogServiceFilter(selectedService.id);\n                            setLogStatusFilter('all');\n                            setLogSearch('');\n                            setLogPage(1);\n                            pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-log-search`;\n                            setActiveSection('request-logs');\n                          }}\n                        >\n                          {`Inspect ${selectedService.code} logs →`}\n                        </Button>\n                      </div>\n                    </div>\n                  </div>\n                )}\n              </Panel>\n            </Scene>\n\n            {/* Quiet Operational Audit Feed at bottom of Overview */}\n            <Panel variant=\"quiet\" label=\"Recent control-plane audit activity\">\n              <div className=\"f12-stack-pair\">\n                <div className=\"f12-row-between\">\n                  <div className=\"f12-row-pair\">\n                    <span className=\"f12-console-quiet-title\">\n                      RECENT CONTROL-PLANE AUDIT LOG\n                    </span>\n                    <Badge status=\"neutral\" burst={false}>\n                      LAST 4 EVENTS\n                    </Badge>\n                  </div>\n                  <Button\n                    id={`${resolvedIdPrefix}-overview-goto-logs`}\n                    variant=\"secondary\"\n                    size=\"sm\"\n                    onClick={() => {\n                      pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-log-search`;\n                      setActiveSection('request-logs');\n                    }}\n                  >\n                    Inspect request logs →\n                  </Button>\n                </div>\n\n                <ul className=\"f12-console-feed\" aria-label=\"Recent control-plane events\">\n                  {AUDIT_FEED.map((ev) => (\n                    <li key={ev.id} className=\"f12-console-feed-item\">\n                      <div className=\"f12-row-pair\">\n                        <Tag status={ev.status}>{ev.badge}</Tag>\n                        <code className=\"f12-code-inline\">{ev.actor}</code>\n                        <span>{ev.summary}</span>\n                      </div>\n                      <span className=\"f12-mono-note\">{ev.time}</span>\n                    </li>\n                  ))}\n                </ul>\n              </div>\n            </Panel>\n          </div>\n        </TabsContent>\n\n        {/* =============================================================== TAB 2: SERVICES & ENDPOINTS */}\n        <TabsContent value=\"services\">\n          <div className=\"f12-stack-scene\">\n            {/* Service Health & Circuit-Breaker Matrix (Quiet) */}\n            <Panel variant=\"quiet\" label=\"Service health and simulated circuit breakers\">\n              <div className=\"f12-stack-pair\">\n                <div className=\"f12-row-between\">\n                  <div className=\"f12-stack-pair\">\n                    <div className=\"f12-row-pair\">\n                      <span className=\"f12-console-quiet-title\">\n                        SERVICE FLEET &amp; CIRCUIT-BREAKER CONTROLS\n                      </span>\n                      <Tag status=\"neutral\">QUIET OPERATIONAL VIEW</Tag>\n                    </div>\n                    <p className=\"f12-console-quiet-sub\">\n                      Toggle simulated queue shedding per service to test degraded-state operational\n                      handling without affecting external infrastructure.\n                    </p>\n                  </div>\n                </div>\n\n                <div className=\"f12-console-grid-2\">\n                  {effectiveServices.map((svc) => {\n                    const shedding = Boolean(sheddingByService[svc.id]);\n                    const effectiveStatus = shedding ? 'degraded' : svc.status;\n                    return (\n                      <div key={svc.id} className=\"f12-console-kv-item\">\n                        <div className=\"f12-row-between\">\n                          <div className=\"f12-row-pair\">\n                            <code className=\"f12-code-inline\">{svc.code}</code>\n                            <strong>{svc.name}</strong>\n                          </div>\n                          <Tag status={statusToTagStatus(effectiveStatus)}>\n                            {shedding ? 'SHEDDING' : statusToLabel(effectiveStatus)}\n                          </Tag>\n                        </div>\n                        <p className=\"f12-mono-note\">\n                          {`Owner: ${svc.owner} · 24h: ${fmtCompactNumber(svc.requests24h)} reqs · p95: ${svc.p95Ms} ms · Err: ${svc.errorRatePct}`}\n                        </p>\n                        <Switch\n                          id={`${resolvedIdPrefix}-shed-${svc.id}`}\n                          density=\"compact\"\n                          checked={shedding}\n                          onCheckedChange={(next) => handleToggleShedding(svc, next)}\n                          label={`Queue shedding (${svc.code})`}\n                          hint={svc.summary}\n                        />\n                      </div>\n                    );\n                  })}\n                </div>\n              </div>\n            </Panel>\n\n            {/* Endpoint Search & Filter Controls (Quiet) */}\n            <Panel variant=\"quiet\" label=\"Endpoint directory filters and table\">\n              <div className=\"f12-stack-scene\">\n                <div className=\"f12-console-filters\" role=\"search\" aria-label=\"Filter endpoints\">\n                  <Input\n                    id={`${resolvedIdPrefix}-endpoint-search`}\n                    label=\"Search endpoints\"\n                    density=\"compact\"\n                    type=\"search\"\n                    placeholder=\"Filter by route (/v2/...), service, or owner\"\n                    value={endpointSearch}\n                    onChange={(e) => setEndpointSearch(e.target.value)}\n                  />\n\n                  <Select\n                    id={`${resolvedIdPrefix}-endpoint-method`}\n                    label=\"HTTP method\"\n                    density=\"compact\"\n                    value={endpointMethodFilter}\n                    onValueChange={(v) => setEndpointMethodFilter(v as EndpointMethodFilter)}\n                  >\n                    <SelectTrigger aria-label=\"HTTP method filter\">\n                      <SelectValue />\n                    </SelectTrigger>\n                    <SelectContent>\n                      <SelectItem value=\"ALL\">All HTTP methods</SelectItem>\n                      <SelectItem value=\"POST\">POST only</SelectItem>\n                      <SelectItem value=\"GET\">GET only</SelectItem>\n                      <SelectItem value=\"PUT\">PUT only</SelectItem>\n                      <SelectItem value=\"DELETE\">DELETE only</SelectItem>\n                    </SelectContent>\n                  </Select>\n\n                  <div className=\"f12-stack-pair\">\n                    <span className=\"f12-console-kv-label\">Health status</span>\n                    <SegmentedControl\n                      idPrefix={`${resolvedIdPrefix}-ep-health`}\n                      ariaLabel=\"Endpoint health status filter\"\n                      value={endpointHealthFilter}\n                      onChange={setEndpointHealthFilter}\n                      options={[\n                        { value: 'all', label: 'ALL', unit: '8' },\n                        { value: 'healthy', label: 'OK', unit: '6' },\n                        { value: 'degraded', label: 'DEG', unit: '1' },\n                        { value: 'canary', label: 'CAN', unit: '1' },\n                      ]}\n                    />\n                  </div>\n                </div>\n\n                {filteredEndpoints.length === 0 ? (\n                  <EmptyState\n                    id={`${resolvedIdPrefix}-endpoints-empty`}\n                    density=\"compact\"\n                    code=\"0 MATCHING ENDPOINTS\"\n                    title=\"No endpoints match the current filter criteria\"\n                    description={`No registered routes matched query \"${endpointSearch || '—'}\" with method ${endpointMethodFilter} and status ${endpointHealthFilter.toUpperCase()}.`}\n                    action={\n                      <Button\n                        id={`${resolvedIdPrefix}-reset-endpoint-filters`}\n                        variant=\"secondary\"\n                        size=\"sm\"\n                        onClick={() => {\n                          pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-endpoint-search`;\n                          setEndpointSearch('');\n                          setEndpointHealthFilter('all');\n                          setEndpointMethodFilter('ALL');\n                        }}\n                      >\n                        Reset endpoint filters\n                      </Button>\n                    }\n                  />\n                ) : (\n                  <Table density=\"compact\">\n                    <TableCaption>\n                      {`Showing ${filteredEndpoints.length} of ${effectiveEndpoints.length} registered API endpoints (24h volume reconciled to ${isEmptyDataset ? '0' : '1,482,900'} requests).`}\n                    </TableCaption>\n                    <TableHeader>\n                      <TableRow>\n                        <TableHead scope=\"col\">Method &amp; Route</TableHead>\n                        <TableHead scope=\"col\">Service &amp; Owner</TableHead>\n                        <TableHead scope=\"col\">Rate Limit</TableHead>\n                        <TableHead scope=\"col\">24h Volume</TableHead>\n                        <TableHead scope=\"col\">p95 / Error</TableHead>\n                        <TableHead scope=\"col\">Status</TableHead>\n                        <TableHead scope=\"col\">Contract</TableHead>\n                      </TableRow>\n                    </TableHeader>\n                    <TableBody>\n                      {filteredEndpoints.map((ep) => {\n                        const isSelected = ep.id === inspectedEndpoint.id;\n                        return (\n                          <TableRow key={ep.id}>\n                            <TableCell>\n                              <div className=\"f12-row-pair\">\n                                <Tag\n                                  status={\n                                    ep.method === 'DELETE'\n                                      ? 'danger'\n                                      : ep.method === 'PUT'\n                                        ? 'warning'\n                                        : ep.method === 'POST'\n                                          ? 'info'\n                                          : 'neutral'\n                                  }\n                                >\n                                  {ep.method}\n                                </Tag>\n                                <code className=\"f12-code-inline f12-nowrap\">{ep.route}</code>\n                              </div>\n                            </TableCell>\n                            <TableCell>\n                              <div className=\"f12-stack-pair\">\n                                <strong>{ep.serviceName}</strong>\n                                <span className=\"f12-mono-note\">{ep.owner}</span>\n                              </div>\n                            </TableCell>\n                            <TableCell>{`${fmtCompactNumber(ep.rateLimitRps)} req/s`}</TableCell>\n                            <TableCell>{fmtCompactNumber(ep.requests24h)}</TableCell>\n                            <TableCell>{`${ep.p95Ms} ms · ${ep.errorRatePct}`}</TableCell>\n                            <TableCell>\n                              <Tag status={statusToTagStatus(ep.status)}>\n                                {statusToLabel(ep.status)}\n                              </Tag>\n                            </TableCell>\n                            <TableCell>\n                              <Button\n                                id={`${resolvedIdPrefix}-inspect-ep-${ep.id}`}\n                                variant={isSelected ? 'primary' : 'secondary'}\n                                size=\"sm\"\n                                aria-pressed={isSelected}\n                                onClick={() => setInspectedEndpointId(ep.id)}\n                              >\n                                {isSelected ? 'Selected' : 'Inspect'}\n                              </Button>\n                            </TableCell>\n                          </TableRow>\n                        );\n                      })}\n                    </TableBody>\n                  </Table>\n                )}\n\n                {/* Selected Endpoint Metadata Inspector */}\n                <div\n                  className=\"f12-console-kv-list\"\n                  role=\"region\"\n                  aria-label=\"Selected endpoint contract metadata\"\n                >\n                  <div className=\"f12-console-kv-item\">\n                    <span className=\"f12-console-kv-label\">Selected Endpoint</span>\n                    <span className=\"f12-console-kv-value\">\n                      {`${inspectedEndpoint.method} ${inspectedEndpoint.route}`}\n                    </span>\n                    <span className=\"f12-mono-note\">{inspectedEndpoint.description}</span>\n                  </div>\n                  <div className=\"f12-console-kv-item\">\n                    <span className=\"f12-console-kv-label\">Schema &amp; Timeout Budget</span>\n                    <span className=\"f12-console-kv-value\">\n                      {`${inspectedEndpoint.schemaVersion} · ${inspectedEndpoint.timeoutMs} ms`}\n                    </span>\n                    <span className=\"f12-mono-note\">{inspectedEndpoint.retryPolicy}</span>\n                  </div>\n                  <div className=\"f12-console-kv-item\">\n                    <span className=\"f12-console-kv-label\">Trace Correlation</span>\n                    <div className=\"f12-row-pair\">\n                      <Button\n                        id={`${resolvedIdPrefix}-ep-filter-logs`}\n                        variant=\"secondary\"\n                        size=\"sm\"\n                        onClick={() => {\n                          pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-log-search`;\n                          if (datasetState === 'empty') {\n                            setDatasetState('populated');\n                          }\n                          setLogSearch(inspectedEndpoint.route);\n                          setLogStatusFilter('all');\n                          setLogServiceFilter('all');\n                          setLogPage(1);\n                          setActiveSection('request-logs');\n                        }}\n                      >\n                        View logs for route →\n                      </Button>\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </Panel>\n          </div>\n        </TabsContent>\n\n        {/* =============================================================== TAB 3: API KEYS */}\n        <TabsContent value=\"api-keys\">\n          <div className=\"f12-stack-scene\">\n            <Notice\n              status=\"info\"\n              title=\"Simulated credential vault (f12_sim_*)\"\n              description=\"Keys displayed below are deterministic fictional tokens. Issuing or revoking a key mutates local React state only and never transmits secrets over the network.\"\n            />\n\n            {lastIssuedKey && (\n              <Alert\n                id={`${resolvedIdPrefix}-issued-key-banner`}\n                status=\"success\"\n                live=\"polite\"\n                title={`Simulated key issued: ${lastIssuedKey.label}`}\n                description={`Token preview: ${lastIssuedKey.maskedToken} · Scope: ${scopeToLabel(lastIssuedKey.scope)} · Tier: ${lastIssuedKey.rateTier}`}\n                onDismiss={() => setLastIssuedKey(null)}\n                actions={\n                  <Button\n                    id={`${resolvedIdPrefix}-copy-issued-key`}\n                    variant=\"secondary\"\n                    size=\"sm\"\n                    onClick={() => {\n                      toast({\n                        status: 'info',\n                        title: 'Copied simulated token prefix',\n                        description: `${lastIssuedKey.maskedToken} copied to simulated clipboard.`,\n                      });\n                    }}\n                  >\n                    Copy simulated token\n                  </Button>\n                }\n              />\n            )}\n\n            <Scene gutter=\"scene\" layout=\"split\">\n              {/* Issue New Simulated Key Form */}\n              <Panel variant=\"quiet\" label=\"Issue simulated API key form\">\n                <form\n                  className=\"f12-stack-pair\"\n                  noValidate\n                  onSubmit={handleIssueApiKey}\n                  aria-label=\"Issue new simulated API key\"\n                >\n                  <div className=\"f12-row-between\">\n                    <span className=\"f12-console-quiet-title\">ISSUE SIMULATED API KEY</span>\n                    <Tag status=\"neutral\">CLIENT-SIDE ONLY</Tag>\n                  </div>\n\n                  <Field\n                    label=\"Key label\"\n                    required\n                    hint=\"Descriptive name for audit logs (3–40 characters).\"\n                    error={keyLabelError}\n                  >\n                    <Input\n                      ref={keyInputRef}\n                      id={`${resolvedIdPrefix}-key-label-input`}\n                      density=\"compact\"\n                      placeholder=\"e.g. Tokyo Fulfillment Worker\"\n                      value={newKeyLabel}\n                      onChange={(e) => {\n                        setNewKeyLabel(e.target.value);\n                        if (keyLabelError) setKeyLabelError(undefined);\n                      }}\n                    />\n                  </Field>\n\n                  <RadioGroup\n                    name={`${resolvedIdPrefix}-key-scope`}\n                    label=\"Permission scope\"\n                    value={newKeyScope}\n                    onValueChange={(v) => setNewKeyScope(v as ApiKeyScope)}\n                  >\n                    <RadioGroupItem\n                      value=\"read_only\"\n                      label=\"READ_ONLY · Query sessions, stock, and telemetry logs\"\n                    />\n                    <RadioGroupItem\n                      value=\"dispatch_write\"\n                      label=\"DISPATCH_WRITE · Enqueue webhooks and reserve inventory\"\n                    />\n                    <RadioGroupItem\n                      value=\"admin\"\n                      label=\"ADMIN · Rotate credentials and purge tariff caches\"\n                    />\n                  </RadioGroup>\n\n                  <Select\n                    id={`${resolvedIdPrefix}-key-tier`}\n                    label=\"Rate-limit tier\"\n                    density=\"compact\"\n                    value={newKeyTier}\n                    onValueChange={setNewKeyTier}\n                  >\n                    <SelectTrigger aria-label=\"Rate-limit tier\">\n                      <SelectValue />\n                    </SelectTrigger>\n                    <SelectContent>\n                      <SelectItem value=\"Standard · 500 req/s\">Standard · 500 req/s</SelectItem>\n                      <SelectItem value=\"Burst · 2,000 req/s\">Burst · 2,000 req/s</SelectItem>\n                      <SelectItem value=\"Dedicated · 5,000 req/s\">Dedicated · 5,000 req/s</SelectItem>\n                    </SelectContent>\n                  </Select>\n\n                  <Checkbox\n                    id={`${resolvedIdPrefix}-key-hmac`}\n                    checked={newKeyHmac}\n                    onCheckedChange={setNewKeyHmac}\n                    label=\"Enforce HMAC-SHA256 timestamp signature on webhook payloads\"\n                  />\n\n                  <div className=\"f12-row-pair\">\n                    <Button\n                      id={`${resolvedIdPrefix}-issue-key-submit`}\n                      type=\"submit\"\n                      variant=\"primary\"\n                    >\n                      Issue simulated key\n                    </Button>\n                    <Button\n                      id={`${resolvedIdPrefix}-issue-key-clear`}\n                      type=\"button\"\n                      variant=\"secondary\"\n                      onClick={() => {\n                        setNewKeyLabel('');\n                        setKeyLabelError(undefined);\n                      }}\n                    >\n                      Clear\n                    </Button>\n                  </div>\n                </form>\n              </Panel>\n\n              {/* Active vs Revoked Summary */}\n              <Panel variant=\"quiet\" label=\"Credential security posture\">\n                <div className=\"f12-stack-pair\">\n                  <span className=\"f12-console-quiet-title\">CREDENTIAL POSTURE</span>\n                  <Metric\n                    variant=\"quiet\"\n                    headingLevel=\"h3\"\n                    label=\"Active Signing Keys\"\n                    value={activeKeyCount}\n                    format={(n) => `${Math.round(n)} active`}\n                    note={`${apiKeys.length - activeKeyCount} revoked · zero unmasked secrets in DOM`}\n                  />\n                  <p className=\"f12-console-quiet-sub\">\n                    Revoking an active key immediately marks it <code className=\"f12-code-inline\">REVOKED</code>{' '}\n                    after modal confirmation. Subsequent simulated requests using a revoked key\n                    return <code className=\"f12-code-inline\">401 Unauthorized</code>.\n                  </p>\n                </div>\n              </Panel>\n            </Scene>\n\n            {/* API Keys Table */}\n            <Panel variant=\"quiet\" label=\"Issued simulated API keys table\">\n              <Table density=\"compact\">\n                <TableCaption>\n                  Simulated API credentials with masked prefixes, permission scopes, and revocation\n                  controls.\n                </TableCaption>\n                <TableHeader>\n                  <TableRow>\n                    <TableHead scope=\"col\">Label &amp; Key ID</TableHead>\n                    <TableHead scope=\"col\">Masked Token</TableHead>\n                    <TableHead scope=\"col\">Scope</TableHead>\n                    <TableHead scope=\"col\">Rate Tier</TableHead>\n                    <TableHead scope=\"col\">Last Used</TableHead>\n                    <TableHead scope=\"col\">Status</TableHead>\n                    <TableHead scope=\"col\">Actions</TableHead>\n                  </TableRow>\n                </TableHeader>\n                <TableBody>\n                  {apiKeys.map((keyItem) => (\n                    <TableRow key={keyItem.id}>\n                      <TableCell>\n                        <div className=\"f12-stack-pair\">\n                          <strong>{keyItem.label}</strong>\n                          <span className=\"f12-mono-note\">\n                            {`${keyItem.id} · Created ${keyItem.createdAt}`}\n                          </span>\n                        </div>\n                      </TableCell>\n                      <TableCell>\n                        <code className=\"f12-code-inline f12-nowrap\">{keyItem.maskedToken}</code>\n                      </TableCell>\n                      <TableCell>\n                        <Tag status={keyItem.scope === 'admin' ? 'warning' : 'neutral'}>\n                          {scopeToLabel(keyItem.scope)}\n                        </Tag>\n                      </TableCell>\n                      <TableCell>{keyItem.rateTier}</TableCell>\n                      <TableCell>{keyItem.lastUsed}</TableCell>\n                      <TableCell>\n                        <Tag status={keyItem.status === 'active' ? 'success' : 'danger'}>\n                          {keyItem.status === 'active' ? 'ACTIVE' : 'REVOKED'}\n                        </Tag>\n                      </TableCell>\n                      <TableCell>\n                        <div className=\"f12-row-pair\">\n                          <Button\n                            id={`${resolvedIdPrefix}-copy-key-${keyItem.id}`}\n                            variant=\"secondary\"\n                            size=\"sm\"\n                            onClick={() => {\n                              toast({\n                                status: 'info',\n                                title: 'Masked prefix copied',\n                                description: `${keyItem.maskedToken} copied to simulated clipboard.`,\n                              });\n                            }}\n                          >\n                            Copy prefix\n                          </Button>\n                          {keyItem.status === 'active' && (\n                            <Button\n                              id={`${resolvedIdPrefix}-revoke-key-${keyItem.id}`}\n                              variant=\"secondary\"\n                              size=\"sm\"\n                              onClick={(e) => {\n                                e.currentTarget.focus();\n                                setRevokeTargetKey(keyItem);\n                              }}\n                            >\n                              Revoke…\n                            </Button>\n                          )}\n                        </div>\n                      </TableCell>\n                    </TableRow>\n                  ))}\n                </TableBody>\n              </Table>\n            </Panel>\n          </div>\n        </TabsContent>\n\n        {/* =============================================================== TAB 4: REQUEST LOGS */}\n        <TabsContent value=\"request-logs\">\n          <div className=\"f12-stack-scene\">\n            <Panel variant=\"quiet\" label=\"Request log search, filters, and paginated ledger\">\n              <div className=\"f12-stack-scene\">\n                <div\n                  className=\"f12-console-filters\"\n                  role=\"search\"\n                  aria-label=\"Filter request logs\"\n                >\n                  <Input\n                    id={`${resolvedIdPrefix}-log-search`}\n                    label=\"Search request logs\"\n                    density=\"compact\"\n                    type=\"search\"\n                    placeholder=\"Request ID (req_...), route, or idempotency key\"\n                    value={logSearch}\n                    onChange={(e) => {\n                      setLogSearch(e.target.value);\n                      setLogPage(1);\n                    }}\n                  />\n\n                  <Select\n                    id={`${resolvedIdPrefix}-log-service`}\n                    label=\"Service filter\"\n                    density=\"compact\"\n                    value={logServiceFilter}\n                    onValueChange={(v) => {\n                      setLogServiceFilter(v);\n                      setLogPage(1);\n                    }}\n                  >\n                    <SelectTrigger aria-label=\"Service filter\">\n                      <SelectValue />\n                    </SelectTrigger>\n                    <SelectContent>\n                      <SelectItem value=\"all\">All services (4)</SelectItem>\n                      {CONSOLE_SERVICES.map((svc) => (\n                        <SelectItem key={svc.id} value={svc.id}>\n                          {svc.name}\n                        </SelectItem>\n                      ))}\n                    </SelectContent>\n                  </Select>\n\n                  <div className=\"f12-stack-pair\">\n                    <span className=\"f12-console-kv-label\">HTTP status class</span>\n                    <SegmentedControl\n                      idPrefix={`${resolvedIdPrefix}-log-status`}\n                      ariaLabel=\"HTTP status class filter\"\n                      value={logStatusFilter}\n                      onChange={(next) => {\n                        setLogStatusFilter(next);\n                        setLogPage(1);\n                      }}\n                      options={[\n                        { value: 'all', label: 'ALL', unit: 'status' },\n                        { value: '2xx', label: '2XX', unit: 'ok' },\n                        { value: '4xx', label: '4XX', unit: 'client' },\n                        { value: '5xx', label: '5XX', unit: 'server' },\n                      ]}\n                    />\n                  </div>\n                </div>\n\n                {filteredLogs.length === 0 ? (\n                  <EmptyState\n                    id={`${resolvedIdPrefix}-logs-empty`}\n                    density=\"compact\"\n                    code={isEmptyDataset ? '0 RECORDED LOGS' : '0 MATCHING LOGS'}\n                    title={\n                      isEmptyDataset\n                        ? 'No request logs recorded in this empty workspace'\n                        : 'No request logs match the active filters'\n                    }\n                    description={\n                      isEmptyDataset\n                        ? 'This workspace has zero recorded request traces in the empty dataset state. Load sample telemetry to inspect and replay simulated requests.'\n                        : `No recorded requests matched \"${logSearch || '—'}\" with status filter ${logStatusFilter.toUpperCase()}.`\n                    }\n                    action={\n                      isEmptyDataset ? (\n                        <Button\n                          id={`${resolvedIdPrefix}-logs-load-sample`}\n                          variant=\"primary\"\n                          size=\"sm\"\n                          onClick={() => {\n                            pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-log-search`;\n                            setDatasetState('populated');\n                          }}\n                        >\n                          Load sample telemetry\n                        </Button>\n                      ) : (\n                        <Button\n                          id={`${resolvedIdPrefix}-clear-log-filters`}\n                          variant=\"secondary\"\n                          size=\"sm\"\n                          onClick={() => {\n                            pendingFocusTargetIdRef.current = `${resolvedIdPrefix}-log-search`;\n                            setLogSearch('');\n                            setLogStatusFilter('all');\n                            setLogServiceFilter('all');\n                            setLogPage(1);\n                          }}\n                        >\n                          Clear log filters\n                        </Button>\n                      )\n                    }\n                  />\n                ) : (\n                  <>\n                    <Table density=\"compact\">\n                      <TableCaption>\n                        {`Showing page ${safeLogPage} of ${totalLogPages} (${filteredLogs.length} matching request log events).`}\n                      </TableCaption>\n                      <TableHeader>\n                        <TableRow>\n                          <TableHead scope=\"col\">Request ID &amp; Time</TableHead>\n                          <TableHead scope=\"col\">Method &amp; Route</TableHead>\n                          <TableHead scope=\"col\">Service</TableHead>\n                          <TableHead scope=\"col\">Status</TableHead>\n                          <TableHead scope=\"col\">Latency</TableHead>\n                          <TableHead scope=\"col\">Region</TableHead>\n                          <TableHead scope=\"col\">Trace</TableHead>\n                        </TableRow>\n                      </TableHeader>\n                      <TableBody>\n                        {pagedLogs.map((logItem) => (\n                          <TableRow key={logItem.id}>\n                            <TableCell>\n                              <div className=\"f12-stack-pair\">\n                                <div className=\"f12-row-pair\">\n                                  <code className=\"f12-code-inline f12-nowrap\">\n                                    {logItem.requestId}\n                                  </code>\n                                  {logItem.replayed && <Tag status=\"info\">REPLAYED</Tag>}\n                                </div>\n                                <span className=\"f12-mono-note\">{logItem.timestamp}</span>\n                              </div>\n                            </TableCell>\n                            <TableCell>\n                              <div className=\"f12-row-pair\">\n                                <Tag status=\"neutral\">{logItem.method}</Tag>\n                                <code className=\"f12-code-inline f12-nowrap\">{logItem.route}</code>\n                              </div>\n                            </TableCell>\n                            <TableCell>{logItem.serviceName}</TableCell>\n                            <TableCell>\n                              <Tag status={httpCodeToTagStatus(logItem.statusCode)}>\n                                {`${logItem.statusCode}`}\n                              </Tag>\n                            </TableCell>\n                            <TableCell>{`${fmtCompactNumber(logItem.durationMs)} ms`}</TableCell>\n                            <TableCell>\n                              <code className=\"f12-code-inline\">{logItem.region}</code>\n                            </TableCell>\n                            <TableCell>\n                              <Button\n                                id={`${resolvedIdPrefix}-inspect-log-${logItem.id}`}\n                                variant=\"secondary\"\n                                size=\"sm\"\n                                onClick={(e) => {\n                                  e.currentTarget.focus();\n                                  setInspectedLog(logItem);\n                                }}\n                              >\n                                Inspect…\n                              </Button>\n                            </TableCell>\n                          </TableRow>\n                        ))}\n                      </TableBody>\n                      <TableFooter>\n                        <TableRow>\n                          <TableCell colSpan={4}>Filtered Window Summary</TableCell>\n                          <TableCell colSpan={3}>\n                            {`${filteredLogs.length} events · Page ${safeLogPage}/${totalLogPages}`}\n                          </TableCell>\n                        </TableRow>\n                      </TableFooter>\n                    </Table>\n\n                    <div className=\"f12-row-between\">\n                      <span className=\"f12-mono-note\">\n                        Click &ldquo;Inspect…&rdquo; on any row to view JSON payloads and replay\n                        simulated requests.\n                      </span>\n                      <Pagination\n                        aria-label=\"Request logs pagination\"\n                        density=\"compact\"\n                        page={safeLogPage}\n                        totalPages={totalLogPages}\n                        onPageChange={setLogPage}\n                        showSummary\n                      />\n                    </div>\n                  </>\n                )}\n              </div>\n            </Panel>\n          </div>\n        </TabsContent>\n      </Tabs>\n\n      {footerSlot}\n\n      {/* Modal Dialog 1: Confirm Simulated API Key Revocation */}\n      <Dialog\n        open={revokeTargetKey !== null}\n        onOpenChange={(open) => {\n          if (!open) setRevokeTargetKey(null);\n        }}\n      >\n        <DialogContent cut=\"C-04\">\n          <DialogHeader>\n            <DialogTitle>Revoke simulated API key?</DialogTitle>\n            <DialogDescription>\n              This simulated action marks the credential as revoked in local browser state. Any\n              subsequent simulated request using this token will be rejected with HTTP 401\n              Unauthorized.\n            </DialogDescription>\n          </DialogHeader>\n          {revokeTargetKey && (\n            <div className=\"f12-console-kv-list\">\n              <div className=\"f12-console-kv-item\">\n                <span className=\"f12-console-kv-label\">Key Label</span>\n                <span className=\"f12-console-kv-value\">{revokeTargetKey.label}</span>\n              </div>\n              <div className=\"f12-console-kv-item\">\n                <span className=\"f12-console-kv-label\">Masked Token</span>\n                <span className=\"f12-console-kv-value\">{revokeTargetKey.maskedToken}</span>\n              </div>\n              <div className=\"f12-console-kv-item\">\n                <span className=\"f12-console-kv-label\">Permission Scope</span>\n                <span className=\"f12-console-kv-value\">{scopeToLabel(revokeTargetKey.scope)}</span>\n              </div>\n            </div>\n          )}\n          <DialogFooter>\n            <DialogClose id={`${resolvedIdPrefix}-cancel-revoke`} variant=\"secondary\">\n              Cancel\n            </DialogClose>\n            <Button\n              id={`${resolvedIdPrefix}-confirm-revoke`}\n              variant=\"primary\"\n              onClick={handleConfirmRevokeKey}\n            >\n              Confirm simulated revocation\n            </Button>\n          </DialogFooter>\n        </DialogContent>\n      </Dialog>\n\n      {/* Modal Dialog 2: Request Log Trace Detail & Simulated Replay */}\n      <Dialog\n        open={inspectedLog !== null}\n        onOpenChange={(open) => {\n          if (!open) setInspectedLog(null);\n        }}\n      >\n        <DialogContent cut=\"C-05\">\n          <DialogHeader>\n            <DialogTitle>\n              {inspectedLog\n                ? `Trace ${inspectedLog.requestId} · ${inspectedLog.method} ${inspectedLog.route}`\n                : 'Request Trace Inspector'}\n            </DialogTitle>\n            <DialogDescription>\n              Simulated edge request trace, latency breakdown, and payload inspection.\n            </DialogDescription>\n          </DialogHeader>\n          {inspectedLog && (\n            <div className=\"f12-stack-pair\">\n              <div className=\"f12-console-kv-list\">\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">HTTP Status &amp; Region</span>\n                  <span className=\"f12-console-kv-value\">\n                    {`${inspectedLog.statusCode} (${inspectedLog.statusClass.toUpperCase()}) · ${inspectedLog.region}`}\n                  </span>\n                </div>\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">Latency Breakdown</span>\n                  <span className=\"f12-console-kv-value\">\n                    {`Total ${inspectedLog.durationMs} ms (TLS ${inspectedLog.tlsMs} ms · Queue ${inspectedLog.queueMs} ms · Upstream ${inspectedLog.upstreamMs} ms)`}\n                  </span>\n                </div>\n                <div className=\"f12-console-kv-item\">\n                  <span className=\"f12-console-kv-label\">Idempotency &amp; Key ID</span>\n                  <span className=\"f12-console-kv-value\">\n                    {`${inspectedLog.idempotencyKey} · ${inspectedLog.apiKeyId}`}\n                  </span>\n                </div>\n              </div>\n\n              <div className=\"f12-stack-pair\">\n                <span className=\"f12-console-kv-label\">Request Payload (JSON)</span>\n                <pre className=\"f12-console-code\">{inspectedLog.requestPayload}</pre>\n              </div>\n\n              <div className=\"f12-stack-pair\">\n                <span className=\"f12-console-kv-label\">Response Body (JSON)</span>\n                <pre className=\"f12-console-code\">{inspectedLog.responsePayload}</pre>\n              </div>\n            </div>\n          )}\n          <DialogFooter>\n            <DialogClose id={`${resolvedIdPrefix}-close-log-dialog`} variant=\"secondary\">\n              Close\n            </DialogClose>\n            {inspectedLog && (\n              <Button\n                id={`${resolvedIdPrefix}-replay-log-btn`}\n                variant=\"primary\"\n                onClick={() => handleReplayRequest(inspectedLog)}\n              >\n                Replay simulated request\n              </Button>\n            )}\n          </DialogFooter>\n        </DialogContent>\n      </Dialog>\n    </Sheet>\n  );\n}\n\nexport function DeveloperConsole(props: DeveloperConsoleProps) {\n  const existingToast = useOptionalToast();\n  if (existingToast) {\n    return <DeveloperConsoleInner {...props} />;\n  }\n  return (\n    <ToastProvider maxVisible={3}>\n      <DeveloperConsoleInner {...props} />\n    </ToastProvider>\n  );\n}\n",
      "type": "registry:block",
      "target": "components/frame12/blocks/developer-console.tsx"
    }
  ],
  "type": "registry:block"
}