Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

refactor(insights): render MCP funnels app with quill charts (#62411)

Sam Pennington006a8d5c9f19
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 0164826b4f65..267ac2e64c67 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3848,6 +3848,10 @@ snapshots:
hash: v1.k794b7964.09249f0d06bf5ef94eaddfcd5a97b97943ed42cae7097741dd3989418ec11f50.ROO2zs_uTFgPB7eI8fwi2GIwSo_HHTlhAal5XWBmz7Y
mcp-apps-feature-flags--testing-no-match--light:
hash: v1.k794b7964.b5eec4d4100dc834d4c7c891e4962c9effa643ff190f3b0957d816d82ebb7269.9Hg0pCpNp895WlYr8k2m97K0fvniLuzPcRSAIWUCtg8
+ mcp-apps-funnels--steep-dropoff--light:
+ hash: v1.k794b7964.923aafaf8e1bce9f1caa2410cd58f7378ff97f8e9fb569e0ce18b45dfb885ff8.osZQjoZOyTIkZuiFFYz_vt8LWPp7oKhCd1an1UQjLwM
+ mcp-apps-funnels--three-step--light:
+ hash: v1.k794b7964.18bd10f06238debddaf314abc41971a2a811e0cc74174b10b3f224ed7df15066.8JtCrE123e2LAu3dIKIT_F0E_u29Q2wT-UKli7kracs
mcp-apps-surveys--active-popover--light:
hash: v1.k794b7964.c47633461e9a437f0761e09f795eb793b02ed0bac4489ce757a5837dbaa3f847.wclUgXFjBkoHXJLNP2R3ncawfRArgVyVEUWbIiQve0o
mcp-apps-surveys--completed--light:
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx
index 877df46f10fd..af76ad839549 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.tsx
@@ -3,7 +3,7 @@ import posthog from 'posthog-js'
import { useCallback, useMemo, type ErrorInfo } from 'react'
import { BarChart, DEFAULT_MARGINS } from '@posthog/quill-charts'
-import type { BarChartConfig, PointClickData, TooltipContext } from '@posthog/quill-charts'
+import type { PointClickData, TooltipContext } from '@posthog/quill-charts'
import { buildTheme } from 'lib/charts/utils/theme'
import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'
@@ -16,6 +16,7 @@ import { themeLogic } from '~/layout/navigation-3000/themeLogic'
import { groupsModel } from '~/models/groupsModel'
import { ChartParams } from '~/types'
+import { buildFunnelStepsBarConfig, FUNNEL_STEPS_BAND_PADDING } from '../shared/funnelStepsBarShared'
import { FunnelStepsBarTooltip } from './FunnelStepsBarTooltip'
import {
buildFunnelStepsBarData,
@@ -25,23 +26,13 @@ import {
const BASE_STEP_WIDTH_PX = 240
const PER_BAR_WIDTH_PX = 20
-const BAND_PADDING = 0.1
-
-const chartConfig: BarChartConfig = {
- barLayout: 'grouped',
- showGrid: true,
- bars: {
- cornerRadius: 10,
- track: true,
- shadow: { color: 'rgba(0,0,0,0.15)', blur: 6, offsetY: -2 },
- bandPadding: BAND_PADDING,
- },
- animateHover: true,
+
+const chartConfig = buildFunnelStepsBarConfig({
hideXAxis: true,
- yTickFormatter: (value) => `${Math.round(value)}%`,
- tooltip: { placement: 'top' },
+ animateHover: true,
+ tooltipPlacement: 'top',
margins: { left: DEFAULT_MARGINS.left },
-}
+})
const handleChartError = (error: Error, info: ErrorInfo): void => {
posthog.captureException(error, {
@@ -86,7 +77,7 @@ export function FunnelStepsBarChart({
const barsWidth = steps.length * stepWidthPx
const chartWidth = DEFAULT_MARGINS.left + barsWidth + DEFAULT_MARGINS.right
- const stepBandWidthPx = stepWidthPx * (1 - BAND_PADDING)
+ const stepBandWidthPx = stepWidthPx * (1 - FUNNEL_STEPS_BAND_PADDING)
const onPointClick = useCallback(
(clickData: PointClickData<FunnelStepsBarSeriesMeta>): void => {
diff --git a/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts b/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts
new file mode 100644
index 000000000000..d90320a88172
--- /dev/null
+++ b/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts
@@ -0,0 +1,99 @@
+import type { BarChartConfig, ChartMargins, Series, TooltipConfig } from '@posthog/quill-charts'
+
+import { funnelConversionRate, RATE_TO_PERCENT } from './funnelBarHorizontalShared'
+
+// Dependency-neutral primitives for the vertical (grouped) funnel bars, shared by the web container
+// (FunnelStepsBarChart) and the MCP UI app. Like funnelBarHorizontalShared.ts, this is free of `~/`,
+// `lib/`, and `scenes/` imports so it compiles in the MCP Vite bundle, which only resolves `products/*`
+// and `@posthog/*`.
+
+export const FUNNEL_STEPS_BAR_SERIES_KEY = 'funnel-steps-bar-series'
+
+/** Inner gap between bars as a fraction of the band slot. Exported because the web container also
+ * needs it for its per-step legend width math. */
+export const FUNNEL_STEPS_BAND_PADDING = 0.1
+
+export interface FunnelStepsBarConfigOptions {
+ /** Hide x-axis category labels — the web container renders its own StepLegend row instead. */
+ hideXAxis?: boolean
+ /** Truncate long category (step-name) labels to this px width; omit to render untruncated. */
+ maxCategoryLabelWidth?: number
+ /** Tooltip anchor. The web container pins to `top`; the compact MCP app tracks the `cursor`. */
+ tooltipPlacement?: TooltipConfig['placement']
+ margins?: Partial<ChartMargins>
+ animateHover?: boolean
+}
+
+/** Grouped vertical bars with a hatched track behind each (the "share of a whole" funnel look) and a
+ * percent value axis. Shared by the web FunnelStepsBarChart and the MCP funnel app so the bar styling
+ * and axis stay identical; per-surface differences (axis labels, tooltip anchor, margins) are options. */
+export function buildFunnelStepsBarConfig(options: FunnelStepsBarConfigOptions = {}): BarChartConfig {
+ return {
+ barLayout: 'grouped',
+ showGrid: true,
+ animateHover: options.animateHover,
+ hideXAxis: options.hideXAxis,
+ maxCategoryLabelWidth: options.maxCategoryLabelWidth,
+ margins: options.margins,
+ yTickFormatter: (value) => `${Math.round(value)}%`,
+ tooltip: { placement: options.tooltipPlacement ?? 'top' },
+ bars: {
+ cornerRadius: 10,
+ track: true,
+ shadow: { color: 'rgba(0,0,0,0.15)', blur: 6, offsetY: -2 },
+ bandPadding: FUNNEL_STEPS_BAND_PADDING,
+ },
+ }
+}
+
+/** Per-step conversion data, indexed to match the chart's `dataIndex` so a tooltip can look it up. */
+export interface FunnelStepsBarRow {
+ stepIndex: number
+ name: string
+ count: number
+ /** Conversion relative to the first step (0..1). */
+ fractionOfBasis: number
+ /** Conversion relative to the previous step (0..1); 0 for the first step. */
+ fromPrevious: number
+}
+
+export interface FunnelStepsBarsModel {
+ /** Single grouped series whose `data[stepIndex]` is the step's conversion from the first step, as
+ * a percent (0–100). The `track: true` bar config draws the drop-off remainder up to 100%. */
+ series: Series[]
+ /** X-axis category labels — the step names. */
+ labels: string[]
+ rows: FunnelStepsBarRow[]
+ overall: { rate: number; firstCount: number; lastCount: number }
+}
+
+/** Builds the grouped vertical-bar data for the simple (non-breakdown) MCP funnel. Mirrors the web
+ * FunnelStepsBarChart's single-variant path: one series valued by conversion rate from the basis step. */
+export function buildFunnelStepsBars(
+ steps: { name: string; count: number }[],
+ opts: { color: string }
+): FunnelStepsBarsModel {
+ const firstCount = steps[0]?.count ?? 0
+ const lastCount = steps[steps.length - 1]?.count ?? 0
+ const rows: FunnelStepsBarRow[] = steps.map((step, stepIndex) => ({
+ stepIndex,
+ name: step.name,
+ count: step.count,
+ fractionOfBasis: funnelConversionRate(step.count, firstCount),
+ fromPrevious: funnelConversionRate(step.count, steps[stepIndex - 1]?.count ?? 0),
+ }))
+ const series: Series[] = [
+ {
+ key: FUNNEL_STEPS_BAR_SERIES_KEY,
+ label: 'Conversion',
+ data: rows.map((row) => row.fractionOfBasis * RATE_TO_PERCENT),
+ color: opts.color,
+ },
+ ]
+ return {
+ series,
+ labels: steps.map((step) => step.name),
+ rows,
+ overall: { rate: funnelConversionRate(lastCount, firstCount), firstCount, lastCount },
+ }
+}
diff --git a/products/product_analytics/mcp/apps/Funnels.stories.tsx b/products/product_analytics/mcp/apps/Funnels.stories.tsx
new file mode 100644
index 000000000000..175b3db49474
--- /dev/null
+++ b/products/product_analytics/mcp/apps/Funnels.stories.tsx
@@ -0,0 +1,105 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import type { ReactElement } from 'react'
+
+import { McpThemeDecorator } from '@posthog/mcp-ui/storybook/decorator'
+import { BarChart, type ChartTheme, type TooltipContext, TooltipSurface } from '@posthog/quill-charts'
+
+import {
+ buildFunnelStepsBarConfig,
+ buildFunnelStepsBars,
+ type FunnelStepsBarRow,
+} from '../../frontend/insights/funnels/shared/funnelStepsBarShared'
+
+// PostHog brand palette — mirrors services/mcp/src/ui-apps/components/charts/theme.ts
+const CHART_THEME: ChartTheme = {
+ colors: ['#1d4aff', '#621da6', '#00d683', '#f54e00', '#f7a501', '#dc2626'],
+ backgroundColor: '#ffffff',
+ axisColor: '#9ca3af',
+ gridColor: 'rgba(128,128,128,0.2)',
+ crosshairColor: 'rgba(128,128,128,0.5)',
+ tooltipBackground: '#ffffff',
+ tooltipColor: '#111827',
+}
+const FUNNEL_COLOR = '#1d4aff'
+
+const NOOP = (): void => {}
+
+const CHART_CONFIG = buildFunnelStepsBarConfig({ maxCategoryLabelWidth: 120, tooltipPlacement: 'cursor' })
+
+function renderTooltip(rows: FunnelStepsBarRow[]) {
+ return function FunnelTooltip(ctx: TooltipContext): ReactElement | null {
+ const row = rows[ctx.dataIndex]
+ if (!row) {
+ return null
+ }
+ return (
+ <TooltipSurface>
+ <div className="font-semibold mb-1">
+ {row.stepIndex + 1}. {row.name}
+ </div>
+ <div>
+ {row.count.toLocaleString()} ({Math.round(row.fractionOfBasis * 100)}% of first step)
+ </div>
+ </TooltipSurface>
+ )
+ }
+}
+
+const meta: Meta = {
+ title: 'MCP Apps/Funnels',
+ decorators: [McpThemeDecorator],
+ parameters: {
+ testOptions: {
+ skipDarkMode: true,
+ },
+ },
+}
+export default meta
+
+type Story = StoryObj<{}>
+
+// Fixed pixel size, not width:100% — the chart sizes its canvas off a ResizeObserver, which measures
+// 0 for a percentage width at mount in the headless snapshot runner and draws nothing.
+function FunnelDemo({ steps }: { steps: { name: string; count: number }[] }): ReactElement {
+ const { series, labels, rows } = buildFunnelStepsBars(steps, { color: FUNNEL_COLOR })
+ return (
+ // eslint-disable-next-line react/forbid-dom-props
+ <div style={{ width: 640, height: 320, display: 'flex', flexDirection: 'column' }}>
+ <BarChart
+ series={series}
+ labels={labels}
+ theme={CHART_THEME}
+ config={CHART_CONFIG}
+ tooltip={renderTooltip(rows)}
+ onError={NOOP}
+ />
+ </div>
+ )
+}
+
+export const ThreeStep: Story = {
+ render: () => (
+ <FunnelDemo
+ steps={[
+ { name: 'Pageview', count: 1000 },
+ { name: 'Signed up', count: 420 },
+ { name: 'Activated', count: 180 },
+ ]}
+ />
+ ),
+ name: 'Three-step funnel',
+}
+
+export const SteepDropoff: Story = {
+ render: () => (
+ <FunnelDemo
+ steps={[
+ { name: 'Visited', count: 5000 },
+ { name: 'Added to cart', count: 800 },
+ { name: 'Checkout started', count: 240 },
+ { name: 'Purchased', count: 96 },
+ ]}
+ />
+ ),
+ name: 'Steep drop-off',
+}
diff --git a/services/mcp/CONTRIBUTING.md b/services/mcp/CONTRIBUTING.md
index adc88614aa00..77edde64c4ac 100644
--- a/services/mcp/CONTRIBUTING.md
+++ b/services/mcp/CONTRIBUTING.md
@@ -201,7 +201,6 @@ The visualization system is designed to be extractable to a standalone `@posthog
- **LineChart** - SVG line chart
- **BarChart** - SVG vertical bar chart
-- **HorizontalBarChart** - SVG horizontal bar chart (for funnels)
- **BigNumber** - Large number display
- **DataTable** - HTML table with pagination
diff --git a/services/mcp/src/ui-apps/components/FunnelVisualizer.tsx b/services/mcp/src/ui-apps/components/FunnelVisualizer.tsx
index d4d247f535c6..1fb5272622e0 100644
--- a/services/mcp/src/ui-apps/components/FunnelVisualizer.tsx
+++ b/services/mcp/src/ui-apps/components/FunnelVisualizer.tsx
@@ -2,13 +2,47 @@ import type { ReactElement } from 'react'
import { emptyStateIllustration } from '@posthog/mcp-ui'
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia } from '@posthog/quill'
+import { BarChart, TooltipSurface, type TooltipContext } from '@posthog/quill-charts'
-import { type HorizontalBar, HorizontalBarChart } from './charts'
+import {
+ buildFunnelStepsBarConfig,
+ buildFunnelStepsBars,
+ type FunnelStepsBarRow,
+} from 'products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared'
+
+import { CHART_THEME, FUNNEL_COLOR } from './charts/theme'
import type { FunnelVisualizerProps } from './types'
import { formatNumber, formatPercent, normalizeFunnelSteps } from './utils'
+const NOOP = (): void => {}
+
+// The web container hides the x-axis and renders its own StepLegend row; this compact UI app instead
+// shows the step names on the axis (truncated) and tracks the cursor with the tooltip.
+const CHART_CONFIG = buildFunnelStepsBarConfig({ maxCategoryLabelWidth: 120, tooltipPlacement: 'cursor' })
+
+function renderTooltip(rows: FunnelStepsBarRow[]) {
+ return function FunnelTooltip(ctx: TooltipContext): ReactElement | null {
+ const row = rows[ctx.dataIndex]
+ if (!row) {
+ return null
+ }
+ return (
+ <TooltipSurface>
+ <div className="font-semibold mb-1">
+ {row.stepIndex + 1}. {row.name}
+ </div>
+ <div>
+ {formatNumber(row.count)} ({formatPercent(row.fractionOfBasis)} of first step)
+ </div>
+ {row.stepIndex > 0 && <div>{formatPercent(row.fromPrevious)} from previous step</div>}
+ </TooltipSurface>
+ )
+ }
+}
+
export function FunnelVisualizer({ results }: FunnelVisualizerProps): ReactElement {
const steps = normalizeFunnelSteps(results)
+ const { series, labels, rows, overall } = buildFunnelStepsBars(steps, { color: FUNNEL_COLOR })
if (steps.length === 0) {
return (
@@ -21,32 +55,23 @@ export function FunnelVisualizer({ results }: FunnelVisualizerProps): ReactEleme
)
}
- const firstCount = steps[0]?.count || 1
-
- const bars: HorizontalBar[] = steps.map((step) => ({
- label: step.name,
- value: step.count,
- innerText: formatPercent(step.count / firstCount),
- }))
-
- const funnelColor = (index: number): string => {
- if (index === 0) {
- return 'var(--posthog-chart-1, #1d4ed8)'
- }
- // Fade color for subsequent steps
- return `color-mix(in srgb, var(--posthog-chart-1, #1d4ed8) ${100 - index * 15}%, var(--card))`
- }
-
- const lastCount = steps[steps.length - 1]?.count ?? 0
-
return (
- <div>
- <HorizontalBarChart bars={bars} color={funnelColor} />
+ <div data-attr="funnel-steps-bar" className="w-full">
+ <div className="flex flex-col h-72 w-full">
+ <BarChart
+ series={series}
+ labels={labels}
+ theme={CHART_THEME}
+ config={CHART_CONFIG}
+ tooltip={renderTooltip(rows)}
+ onError={NOOP}
+ />
+ </div>
{steps.length >= 2 && (
<div className="mt-4 rounded-md bg-muted/50 p-3 text-sm text-muted-foreground">
- <strong className="text-foreground">Overall conversion:</strong>{' '}
- {formatPercent(lastCount / firstCount)} ({formatNumber(lastCount)} of {formatNumber(firstCount)})
+ <strong className="text-foreground">Overall conversion:</strong> {formatPercent(overall.rate)} (
+ {formatNumber(overall.lastCount)} of {formatNumber(overall.firstCount)})
</div>
)}
</div>
diff --git a/services/mcp/src/ui-apps/components/charts/HorizontalBarChart.tsx b/services/mcp/src/ui-apps/components/charts/HorizontalBarChart.tsx
deleted file mode 100644
index cd8639b1bc81..000000000000
--- a/services/mcp/src/ui-apps/components/charts/HorizontalBarChart.tsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import type { ReactElement } from 'react'
-
-import { emptyStateIllustration } from '@posthog/mcp-ui'
-import { Empty, EmptyDescription, EmptyHeader, EmptyMedia } from '@posthog/quill'
-
-import { formatNumber } from '../utils'
-
-// TODO(quill): replace with a Quill chart primitive (e.g. `HorizontalBarChart`
-// / `Charts.HorizontalBar`) once Quill ships one. Quill currently has no
-// chart layer. Empty state already routes through Quill's `Empty` primitive.
-
-const BAR_HEIGHT = 32
-const BAR_GAP = 8
-const LABEL_WIDTH = 120
-const VALUE_WIDTH = 80
-
-export interface HorizontalBar {
- label: string
- value: number
- /** Optional secondary text shown inside the bar */
- innerText?: string
-}
-
-export interface HorizontalBarChartProps {
- bars: HorizontalBar[]
- /** If provided, bars are sized relative to this. Otherwise uses max value. */
- maxValue?: number
- /** Color for the bars. Can be a function for per-bar colors. */
- color?: string | ((index: number, bar: HorizontalBar) => string)
-}
-
-const DEFAULT_COLOR = 'var(--posthog-chart-1, #1d4ed8)'
-
-export function HorizontalBarChart({ bars, maxValue, color = DEFAULT_COLOR }: HorizontalBarChartProps): ReactElement {
- if (bars.length === 0) {
- return (
- <Empty>
- <EmptyHeader>
- <EmptyMedia>{emptyStateIllustration('funnel')}</EmptyMedia>
- <EmptyDescription>No data available</EmptyDescription>
- </EmptyHeader>
- </Empty>
- )
- }
-
- const max = maxValue ?? Math.max(...bars.map((b) => b.value), 1)
-
- const getColor = (index: number, bar: HorizontalBar): string => {
- if (typeof color === 'function') {
- return color(index, bar)
- }
- return color
- }
-
- return (
- <div style={{ padding: '0.5rem 0' }}>
- {bars.map((bar, index) => {
- const widthPercent = (bar.value / max) * 100
- const barColor = getColor(index, bar)
-
- return (
- <div
- key={index}
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '0.75rem',
- marginBottom: index < bars.length - 1 ? `${BAR_GAP}px` : 0,
- }}
- >
- {/* Label */}
- <div
- style={{
- width: `${LABEL_WIDTH}px`,
- fontSize: '0.875rem',
- color: 'var(--color-text-primary, #101828)',
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- flexShrink: 0,
- }}
- title={bar.label}
- >
- {bar.label}
- </div>
-
- {/* Bar container */}
- <div
- style={{
- flex: 1,
- height: `${BAR_HEIGHT}px`,
- backgroundColor: 'var(--color-background-secondary, #f9fafb)',
- borderRadius: '4px',
- overflow: 'hidden',
- position: 'relative',
- }}
- >
- {/* Filled bar */}
- <div
- style={{
- height: '100%',
- width: `${widthPercent}%`,
- backgroundColor: barColor,
- borderRadius: '4px',
- transition: 'width 0.3s ease',
- }}
- />
-
- {/* Inner text */}
- {bar.innerText && (
- <div
- style={{
- position: 'absolute',
- left: '8px',
- top: '50%',
- transform: 'translateY(-50%)',
- fontSize: '0.75rem',
- fontWeight: 500,
- color:
- widthPercent > 30
- ? 'var(--color-text-inverse, #fff)'
- : 'var(--color-text-secondary, #6b7280)',
- }}
- >
- {bar.innerText}
- </div>
- )}
- </div>
-
- {/* Value */}
- <div
- style={{
- width: `${VALUE_WIDTH}px`,
- textAlign: 'right',
- fontSize: '0.875rem',
- fontWeight: 500,
- color: 'var(--color-text-primary, #101828)',
- flexShrink: 0,
- }}
- >
- {formatNumber(bar.value)}
- </div>
- </div>
- )
- })}
- </div>
- )
-}
diff --git a/services/mcp/src/ui-apps/components/charts/index.ts b/services/mcp/src/ui-apps/components/charts/index.ts
index b17b642231fc..d0685b12494c 100644
--- a/services/mcp/src/ui-apps/components/charts/index.ts
+++ b/services/mcp/src/ui-apps/components/charts/index.ts
@@ -1,5 +1,4 @@
export { BigNumber, type BigNumberProps } from './BigNumber'
export { LineChart, type LineChartProps, type Series, type DataPoint } from './LineChart'
export { BarChart, type BarChartProps } from './BarChart'
-export { HorizontalBarChart, type HorizontalBarChartProps, type HorizontalBar } from './HorizontalBarChart'
export { Select, type SelectProps, type SelectOption } from './Select'
diff --git a/services/mcp/src/ui-apps/components/charts/theme.ts b/services/mcp/src/ui-apps/components/charts/theme.ts
index 21d89b63b7e4..cbb11fc8b635 100644
--- a/services/mcp/src/ui-apps/components/charts/theme.ts
+++ b/services/mcp/src/ui-apps/components/charts/theme.ts
@@ -15,6 +15,10 @@ export const CHART_COLORS = [
// Picks a palette color by index, wrapping when there are more series than colors.
export const colorAt = (index: number): string => CHART_COLORS[index % CHART_COLORS.length]!
+// Single brand blue for every funnel step's converted bar — the bar height already encodes
+// conversion, so distinct per-step colors would only add noise.
+export const FUNNEL_COLOR = '#1d4aff'
+
// Single mid-gray for axis labels — readable on both light and dark hosts. Claude
// Desktop's iframe doesn't set `prefers-color-scheme`, so we can't detect the host
// theme and adapt at runtime.