{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "customer-snapshot-panel",
  "title": "Customer Snapshot Panel",
  "description": "Everything about one account on a single screen: revenue, health, seats and renewal, a weekly usage chart you can read week by week, plus contacts, activity and team notes.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/new-york/customer-snapshot-panel/customer-snapshot-panel.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface SnapshotMetric {\n  id: string;\n  label: string;\n  /** Word after the number, e.g. \"active users\". */\n  unit: string;\n  /** One value per week, oldest first. */\n  values: number[];\n}\n\nexport interface SnapshotContact {\n  id: string;\n  name: string;\n  role: string;\n  /** e.g. \"2h ago\". */\n  lastSeen: string;\n  champion?: boolean;\n}\n\nexport interface SnapshotEvent {\n  id: string;\n  text: string;\n  who: string;\n  /** e.g. \"Yesterday\". */\n  when: string;\n}\n\nexport interface SnapshotCustomer {\n  name: string;\n  industry: string;\n  /** e.g. \"Mar 2024\". */\n  since: string;\n  owner: string;\n  /** Monthly revenue, in whole currency units. */\n  mrr: number;\n  /** Change against last quarter, in percent. */\n  mrrChange: number;\n  /** From 0 to 100. */\n  health: number;\n  seatsUsed: number;\n  seats: number;\n  openTickets: number;\n  /** Renewal date as YYYY-MM-DD. */\n  renewal: string;\n  tags: string[];\n}\n\nexport interface CustomerSnapshotPanelProps extends Omit<\n  React.ComponentPropsWithoutRef<\"section\">,\n  \"title\"\n> {\n  theme?: \"dark\" | \"light\";\n  customer?: SnapshotCustomer;\n  metrics?: SnapshotMetric[];\n  contacts?: SnapshotContact[];\n  activity?: SnapshotEvent[];\n  /** The last week in the chart, as YYYY-MM-DD. */\n  weekEnd?: string;\n  /** Used to count the days to renewal. YYYY-MM-DD. */\n  today?: string;\n  currency?: string;\n  onOpenProfile?: () => void;\n  onLogCall?: () => void;\n  onFlag?: (flagged: boolean) => void;\n  onAddNote?: (note: string) => void;\n}\n\nconst FONT =\n  '\"Inter Variable\", Inter, \"SF Pro Display\", -apple-system, BlinkMacSystemFont, sans-serif';\nconst ACCENT = \"#5E6AD2\";\nconst GREEN = \"#27A644\";\nconst ORANGE = \"#FC7840\";\nconst RING = \"outline-none focus-visible:ring-2 focus-visible:ring-[#5E6AD2]\";\nconst H = 168;\nconst TOP = 12;\nconst BASE = H - 22;\nconst LEFT = 34;\nconst RIGHT = 10;\nconst ROW = 44;\nconst ROWS = 5;\nconst DAY = 864e5;\n\nconst PALETTES = {\n  dark: {\n    bg: \"#08090A\",\n    cell: \"#0B0C0D\",\n    picked: \"#121315\",\n    field: \"#0F1011\",\n    border: \"rgba(255,255,255,0.08)\",\n    grid: \"rgba(255,255,255,0.05)\",\n    text: \"#F7F8F8\",\n    soft: \"#D0D6E0\",\n    sub: \"#8A8F98\",\n    faint: \"#62666D\",\n    chip: \"rgba(255,255,255,0.05)\",\n    fill: 0.22,\n    btn: \"#E5E5E6\",\n    btnText: \"#08090A\",\n  },\n  light: {\n    bg: \"#FFFFFF\",\n    cell: \"#FFFFFF\",\n    picked: \"#F7F8F8\",\n    field: \"#F7F8F8\",\n    border: \"rgba(8,9,10,0.08)\",\n    grid: \"rgba(8,9,10,0.06)\",\n    text: \"#08090A\",\n    soft: \"#3C3F44\",\n    sub: \"#62666D\",\n    faint: \"#8A8F98\",\n    chip: \"rgba(8,9,10,0.04)\",\n    fill: 0.14,\n    btn: \"#08090A\",\n    btnText: \"#F7F8F8\",\n  },\n};\n\nconst DEFAULT_CUSTOMER: SnapshotCustomer = {\n  name: \"Halden Freight\",\n  industry: \"Logistics\",\n  since: \"Mar 2024\",\n  owner: \"Mira Okafor\",\n  mrr: 4820,\n  mrrChange: 12,\n  health: 82,\n  seatsUsed: 46,\n  seats: 50,\n  openTickets: 2,\n  renewal: \"2026-12-15\",\n  tags: [\"Enterprise\", \"EU region\", \"Expansion\"],\n};\n\nconst DEFAULT_METRICS: SnapshotMetric[] = [\n  {\n    id: \"users\",\n    label: \"Active users\",\n    unit: \"active users\",\n    values: [28, 30, 29, 33, 35, 34, 38, 40, 39, 42, 44, 46],\n  },\n  {\n    id: \"calls\",\n    label: \"API calls\",\n    unit: \"API calls\",\n    values: [\n      9200, 10400, 9800, 11800, 12600, 12100, 14300, 15900, 15200, 17400, 18100,\n      19600,\n    ],\n  },\n  {\n    id: \"tickets\",\n    label: \"Tickets\",\n    unit: \"tickets\",\n    values: [9, 7, 8, 6, 7, 5, 6, 4, 5, 3, 4, 2],\n  },\n];\n\nconst DEFAULT_CONTACTS: SnapshotContact[] = [\n  {\n    id: \"jt\",\n    name: \"Jonas Tiller\",\n    role: \"Head of Operations\",\n    lastSeen: \"2h ago\",\n    champion: true,\n  },\n  {\n    id: \"ar\",\n    name: \"Amara Reyes\",\n    role: \"Finance lead\",\n    lastSeen: \"Yesterday\",\n  },\n  { id: \"kv\", name: \"Kai Varga\", role: \"IT admin\", lastSeen: \"3d ago\" },\n  { id: \"lp\", name: \"Lena Park\", role: \"Dispatcher\", lastSeen: \"Today\" },\n];\n\nconst DEFAULT_ACTIVITY: SnapshotEvent[] = [\n  { id: \"e1\", text: \"Added 4 seats\", who: \"Jonas Tiller\", when: \"Today\" },\n  {\n    id: \"e2\",\n    text: \"Ticket closed: export timeout\",\n    who: \"Support\",\n    when: \"Yesterday\",\n  },\n  { id: \"e3\", text: \"Invoice paid, $4,820\", who: \"Billing\", when: \"3 Nov\" },\n  {\n    id: \"e4\",\n    text: \"Quarterly review held\",\n    who: \"Mira Okafor\",\n    when: \"28 Oct\",\n  },\n  {\n    id: \"e5\",\n    text: \"Turned on route planning\",\n    who: \"Kai Varga\",\n    when: \"21 Oct\",\n  },\n];\n\nconst round = (v: number) => Math.round(v * 10) / 10;\n\nfunction useWidth<T extends HTMLElement>(fallback: number) {\n  const ref = React.useRef<T>(null);\n  const [width, setWidth] = React.useState(fallback);\n  React.useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const ro = new ResizeObserver(([entry]) => {\n      setWidth(Math.round(entry.contentRect.width));\n    });\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n  return [ref, width] as const;\n}\n\n/** Drawn as SVG, because a tiny border-radius circle turns lumpy on 1x screens. */\nfunction Dot({ size, color }: { size: number; color: string }) {\n  const r = size / 2;\n  return (\n    <svg\n      aria-hidden=\"true\"\n      width={size}\n      height={size}\n      viewBox={`0 0 ${size} ${size}`}\n      className=\"block shrink-0\"\n    >\n      <circle cx={r} cy={r} r={r} style={{ fill: color }} />\n    </svg>\n  );\n}\n\nfunction Initials({\n  name,\n  size,\n  color,\n  bg,\n}: {\n  name: string;\n  size: number;\n  color: string;\n  bg: string;\n}) {\n  const text = name\n    .split(/\\s+/)\n    .map((w) => w[0])\n    .join(\"\")\n    .slice(0, 2)\n    .toUpperCase();\n  return (\n    <svg\n      aria-hidden=\"true\"\n      width={size}\n      height={size}\n      viewBox={`0 0 ${size} ${size}`}\n      className=\"block shrink-0\"\n    >\n      <rect width={size} height={size} rx={size * 0.28} fill={bg} />\n      <text\n        x={size / 2}\n        y={size / 2}\n        dy=\"0.35em\"\n        textAnchor=\"middle\"\n        fontSize={size * 0.38}\n        fontWeight=\"590\"\n        fill={color}\n      >\n        {text}\n      </text>\n    </svg>\n  );\n}\n\nconst compact = (v: number) =>\n  v >= 10000\n    ? `${Math.round(v / 1000)}k`\n    : v >= 1000\n      ? `${(v / 1000).toFixed(1).replace(/\\.0$/, \"\")}k`\n      : String(v);\n\nconst niceMax = (v: number) => {\n  const p = 10 ** Math.floor(Math.log10(Math.max(v, 1)));\n  const n = v / p;\n  return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 5 ? 5 : 10) * p;\n};\n\nconst weekLabel = (end: string, back: number) =>\n  new Date(Date.parse(end) - back * 7 * DAY).toLocaleDateString(\"en-US\", {\n    timeZone: \"UTC\",\n    month: \"short\",\n    day: \"numeric\",\n  });\n\n/** A smooth line through the points that never swings above or below them. */\nconst smooth = (pts: [number, number][]) =>\n  pts.reduce((d, [x, y], i) => {\n    if (i === 0) return `M${x} ${y}`;\n    const [px, py] = pts[i - 1];\n    const mx = round((px + x) / 2);\n    return `${d} C${mx} ${py} ${mx} ${y} ${x} ${y}`;\n  }, \"\");\n\nconst TABS = [\"Contacts\", \"Activity\", \"Notes\"] as const;\ntype Tab = (typeof TABS)[number];\n\nexport function CustomerSnapshotPanel({\n  theme = \"dark\",\n  customer = DEFAULT_CUSTOMER,\n  metrics = DEFAULT_METRICS,\n  contacts = DEFAULT_CONTACTS,\n  activity = DEFAULT_ACTIVITY,\n  weekEnd = \"2026-11-02\",\n  today = \"2026-11-07\",\n  currency = \"$\",\n  onOpenProfile,\n  onLogCall,\n  onFlag,\n  onAddNote,\n  className,\n  style,\n  ...rest\n}: CustomerSnapshotPanelProps) {\n  const c = PALETTES[theme];\n  const uid = React.useId();\n  const [metricId, setMetricId] = React.useState(metrics[0]?.id);\n  const [hover, setHover] = React.useState<number | null>(null);\n  const [tab, setTab] = React.useState<Tab>(\"Contacts\");\n  const [events, setEvents] = React.useState(activity);\n  const [notes, setNotes] = React.useState<{ id: string; text: string }[]>([]);\n  const [draft, setDraft] = React.useState(\"\");\n  const [flagged, setFlagged] = React.useState(false);\n  const [wrapRef, width] = useWidth<HTMLDivElement>(460);\n  const count = React.useRef(0);\n\n  const metric = metrics.find((m) => m.id === metricId) ?? metrics[0];\n  const values = metric?.values ?? [];\n  const last = values.length - 1;\n  const at = hover ?? last;\n  const prev = values[at - 1];\n  const delta =\n    prev !== undefined && prev !== 0\n      ? Math.round(((values[at] - prev) / prev) * 100)\n      : 0;\n  const goodWhenDown = metric?.id === \"tickets\";\n  const deltaGood = goodWhenDown ? delta <= 0 : delta >= 0;\n\n  const max = niceMax(Math.max(...values, 1) * 1.08);\n  const span = Math.max(width - LEFT - RIGHT, 10);\n  const x = (i: number) => round(LEFT + (last ? (i / last) * span : 0));\n  const y = (v: number) => round(BASE - (v / max) * (BASE - TOP));\n  const pts = values.map((v, i) => [x(i), y(v)] as [number, number]);\n  const line = smooth(pts);\n  const area = pts.length\n    ? `${line} L${x(last)} ${BASE} L${x(0)} ${BASE} Z`\n    : \"\";\n\n  const renewalDays = Math.max(\n    0,\n    Math.round((Date.parse(customer.renewal) - Date.parse(today)) / DAY),\n  );\n  const renewalDate = new Date(Date.parse(customer.renewal)).toLocaleDateString(\n    \"en-US\",\n    { timeZone: \"UTC\", month: \"short\", day: \"numeric\" },\n  );\n  const healthColor = flagged\n    ? ORANGE\n    : customer.health >= 70\n      ? GREEN\n      : customer.health >= 45\n        ? ACCENT\n        : ORANGE;\n\n  const add = (text: string, who: string) => {\n    count.current += 1;\n    setEvents((list) => [\n      { id: `new-${count.current}`, text, who, when: \"Just now\" },\n      ...list,\n    ]);\n  };\n\n  const pointAt = (clientX: number, rect: DOMRect) => {\n    const rel = ((clientX - rect.left) / rect.width) * width;\n    return Math.max(\n      0,\n      Math.min(last, Math.round(((rel - LEFT) / span) * last)),\n    );\n  };\n\n  const saveNote = () => {\n    const text = draft.trim();\n    if (!text) return;\n    count.current += 1;\n    setNotes((list) => [{ id: `n-${count.current}`, text }, ...list]);\n    add(`Note: ${text}`, customer.owner);\n    setDraft(\"\");\n    onAddNote?.(text);\n  };\n\n  const stats = [\n    {\n      id: \"health\",\n      label: \"Health\",\n      value: flagged ? \"At risk\" : `${customer.health}`,\n      note: flagged ? \"Flagged\" : \"out of 100\",\n      bar: flagged ? 100 : customer.health,\n      color: healthColor,\n    },\n    {\n      id: \"seats\",\n      label: \"Seats\",\n      value: `${customer.seatsUsed}`,\n      note: `of ${customer.seats} in use`,\n      bar: (customer.seatsUsed / Math.max(customer.seats, 1)) * 100,\n      color: ACCENT,\n    },\n    {\n      id: \"tickets\",\n      label: \"Open tickets\",\n      value: `${customer.openTickets}`,\n      note: customer.openTickets ? \"Being handled\" : \"All clear\",\n      bar: null,\n      color: c.faint,\n    },\n    {\n      id: \"renewal\",\n      label: \"Renewal\",\n      value: `${renewalDays} days`,\n      note: renewalDate,\n      bar: null,\n      color: c.faint,\n    },\n  ];\n\n  const tipX = hover === null ? 0 : x(hover);\n  const tipText =\n    hover === null ? \"\" : `${values[hover].toLocaleString(\"en-US\")}`;\n  const tipW = tipText.length * 7 + 16;\n\n  return (\n    <section\n      aria-label={`${customer.name} snapshot`}\n      className={`@container w-full ${className ?? \"\"}`}\n      style={{ background: c.bg, color: c.text, fontFamily: FONT, ...style }}\n      {...rest}\n    >\n      <div className=\"flex items-start justify-between gap-4 p-5 pb-4 @3xl:px-8 @3xl:pt-7\">\n        <header className=\"flex min-w-0 items-center gap-3\">\n          <Initials\n            name={customer.name}\n            size={44}\n            color=\"#FFFFFF\"\n            bg={ACCENT}\n          />\n          <div className=\"min-w-0\">\n            <h2 className=\"m-0 truncate text-[22px] leading-[28px] font-[590] tracking-[-0.018em] @3xl:text-[24px] @3xl:leading-[30px]\">\n              {customer.name}\n            </h2>\n            <p\n              className=\"m-0 truncate text-[13px] leading-[20px] tracking-[-0.011em]\"\n              style={{ color: c.sub }}\n            >\n              {customer.industry}\n              <span className=\"hidden @md:inline\">\n                , customer since {customer.since}\n              </span>\n              <span className=\"hidden @2xl:inline\">\n                . Owner {customer.owner}\n              </span>\n            </p>\n          </div>\n        </header>\n        <div className=\"shrink-0 text-right\">\n          <p className=\"m-0 text-[28px] leading-[32px] font-[510] tracking-[-0.022em] tabular-nums @3xl:text-[32px]\">\n            {currency}\n            {customer.mrr.toLocaleString(\"en-US\")}\n          </p>\n          <p\n            className=\"m-0 mt-1 text-[13px] leading-[20px] whitespace-nowrap tabular-nums\"\n            style={{ color: c.sub }}\n          >\n            a month,{\" \"}\n            <span style={{ color: customer.mrrChange >= 0 ? GREEN : ORANGE }}>\n              {customer.mrrChange >= 0 ? \"+\" : \"\"}\n              {customer.mrrChange}%\n            </span>\n          </p>\n        </div>\n      </div>\n\n      <dl\n        className=\"m-0 grid grid-cols-2 gap-px border-y @2xl:grid-cols-4\"\n        style={{ background: c.border, borderColor: c.border }}\n      >\n        {stats.map((s) => (\n          <div\n            key={s.id}\n            data-stat={s.id}\n            className=\"min-w-0 px-5 py-3 @3xl:px-8\"\n            style={{ background: c.cell }}\n          >\n            <dt\n              className=\"text-[12px] leading-[16px] tracking-[-0.005em]\"\n              style={{ color: c.faint }}\n            >\n              {s.label}\n            </dt>\n            <dd className=\"m-0 mt-1 flex min-w-0 items-baseline gap-1.5\">\n              <span\n                className=\"shrink-0 text-[17px] whitespace-nowrap leading-[22px] font-[590] tracking-[-0.014em] tabular-nums\"\n                style={{\n                  color: s.id === \"health\" && flagged ? ORANGE : c.text,\n                }}\n              >\n                {s.value}\n              </span>\n              <span\n                className=\"min-w-0 truncate text-[12px] leading-[16px]\"\n                style={{ color: c.sub }}\n              >\n                {s.note}\n              </span>\n            </dd>\n            <svg\n              aria-hidden=\"true\"\n              width=\"100%\"\n              height=\"3\"\n              className=\"mt-2 block\"\n              style={{ opacity: s.bar === null ? 0 : 1 }}\n            >\n              <rect width=\"100%\" height=\"3\" rx=\"1.5\" fill={c.chip} />\n              <rect\n                width={`${s.bar ?? 0}%`}\n                height=\"3\"\n                rx=\"1.5\"\n                fill={s.color}\n                className=\"motion-safe:transition-[width,fill] motion-safe:duration-300\"\n              />\n            </svg>\n          </div>\n        ))}\n      </dl>\n\n      <div className=\"grid @3xl:grid-cols-[minmax(0,1.3fr)_minmax(0,1fr)]\">\n        <div\n          className=\"min-w-0 p-5 pb-3 @3xl:border-r @3xl:px-8\"\n          style={{ borderColor: c.border }}\n        >\n          <div className=\"flex flex-wrap items-center justify-between gap-2\">\n            <div\n              role=\"group\"\n              aria-label=\"Metric\"\n              className=\"flex gap-1 rounded-full p-0.5\"\n              style={{ background: c.chip }}\n            >\n              {metrics.map((m) => {\n                const on = m.id === metric?.id;\n                return (\n                  <button\n                    key={m.id}\n                    type=\"button\"\n                    data-metric={m.id}\n                    aria-pressed={on}\n                    onClick={() => {\n                      setMetricId(m.id);\n                      setHover(null);\n                    }}\n                    className={`h-7 cursor-pointer rounded-full border-0 px-2.5 text-[12.5px] leading-[18px] font-[510] tracking-[-0.008em] whitespace-nowrap motion-safe:transition-colors ${RING}`}\n                    style={{\n                      background: on ? c.picked : \"transparent\",\n                      color: on ? c.text : c.sub,\n                      boxShadow: on ? `inset 0 0 0 1px ${c.border}` : \"none\",\n                    }}\n                  >\n                    {m.label}\n                  </button>\n                );\n              })}\n            </div>\n            <p\n              aria-live=\"polite\"\n              className=\"m-0 text-[13px] leading-[20px] whitespace-nowrap tabular-nums\"\n              style={{ color: c.sub }}\n            >\n              <span style={{ color: c.text }} className=\"font-[510]\">\n                {values[at]?.toLocaleString(\"en-US\")}\n              </span>{\" \"}\n              {metric?.unit},{\" \"}\n              <span style={{ color: deltaGood ? GREEN : ORANGE }}>\n                {delta >= 0 ? \"+\" : \"\"}\n                {delta}%\n              </span>\n            </p>\n          </div>\n\n          <div ref={wrapRef} className=\"mt-3 w-full\" style={{ height: H }}>\n            <svg\n              data-chart=\"\"\n              role=\"img\"\n              tabIndex={0}\n              aria-label={`${metric?.label}, weekly. ${values.map((v, i) => `${weekLabel(weekEnd, last - i)}: ${v}`).join(\", \")}. Use the arrow keys to read each week.`}\n              width={width}\n              height={H}\n              className={`block touch-pan-y ${RING} rounded-md`}\n              onPointerMove={(e) =>\n                setHover(\n                  pointAt(e.clientX, e.currentTarget.getBoundingClientRect()),\n                )\n              }\n              onPointerLeave={() => setHover(null)}\n              onBlur={() => setHover(null)}\n              onKeyDown={(e) => {\n                if (e.key !== \"ArrowLeft\" && e.key !== \"ArrowRight\") return;\n                e.preventDefault();\n                const step = e.key === \"ArrowLeft\" ? -1 : 1;\n                setHover((h) =>\n                  Math.max(0, Math.min(last, (h ?? last) + step)),\n                );\n              }}\n            >\n              <defs>\n                <linearGradient id={uid} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n                  <stop stopColor={ACCENT} stopOpacity={c.fill} />\n                  <stop offset=\"1\" stopColor={ACCENT} stopOpacity=\"0\" />\n                </linearGradient>\n              </defs>\n              {[0, max / 2, max].map((t) => (\n                <g key={t}>\n                  <line\n                    x1={LEFT}\n                    x2={width - RIGHT}\n                    y1={y(t)}\n                    y2={y(t)}\n                    stroke={c.grid}\n                  />\n                  <text x={0} y={y(t) + 4} fontSize=\"11\" fill={c.faint}>\n                    {compact(t)}\n                  </text>\n                </g>\n              ))}\n              <path d={area} fill={`url(#${uid})`} />\n              <path\n                d={line}\n                fill=\"none\"\n                stroke={ACCENT}\n                strokeWidth=\"1.75\"\n                strokeLinejoin=\"round\"\n              />\n              {[0, Math.round(last / 2), last]\n                .filter((i) => hover === null || Math.abs(x(i) - tipX) > 48)\n                .map((i) => (\n                  <text\n                    key={i}\n                    x={x(i)}\n                    y={H - 5}\n                    textAnchor={\n                      i === 0 ? \"start\" : i === last ? \"end\" : \"middle\"\n                    }\n                    fontSize=\"11\"\n                    fill={c.faint}\n                  >\n                    {weekLabel(weekEnd, last - i)}\n                  </text>\n                ))}\n              {hover === null ? (\n                <circle\n                  cx={x(last)}\n                  cy={y(values[last] ?? 0)}\n                  r=\"3.5\"\n                  fill={ACCENT}\n                  stroke={c.bg}\n                  strokeWidth=\"2\"\n                />\n              ) : (\n                <g>\n                  <line\n                    x1={tipX}\n                    x2={tipX}\n                    y1={TOP}\n                    y2={BASE}\n                    stroke={c.faint}\n                    strokeDasharray=\"2 3\"\n                  />\n                  <circle\n                    cx={tipX}\n                    cy={y(values[hover])}\n                    r=\"4\"\n                    fill={ACCENT}\n                    stroke={c.bg}\n                    strokeWidth=\"2\"\n                  />\n                  <g\n                    transform={`translate(${round(Math.max(LEFT, Math.min(width - RIGHT - tipW, tipX - tipW / 2)))} 0)`}\n                  >\n                    <rect\n                      width={tipW}\n                      height=\"20\"\n                      rx=\"6\"\n                      fill={c.picked}\n                      stroke={c.border}\n                    />\n                    <text\n                      x={tipW / 2}\n                      y=\"14\"\n                      textAnchor=\"middle\"\n                      fontSize=\"11.5\"\n                      fontWeight=\"510\"\n                      fill={c.text}\n                    >\n                      {tipText}\n                    </text>\n                  </g>\n                  <text\n                    x={tipX}\n                    y={H - 5}\n                    textAnchor=\"middle\"\n                    fontSize=\"11\"\n                    fill={c.text}\n                    stroke={c.bg}\n                    strokeWidth=\"6\"\n                    paintOrder=\"stroke\"\n                  >\n                    {weekLabel(weekEnd, last - hover)}\n                  </text>\n                </g>\n              )}\n            </svg>\n          </div>\n        </div>\n\n        <div\n          className=\"min-w-0 border-t @3xl:border-t-0\"\n          style={{ borderColor: c.border }}\n        >\n          <div\n            role=\"tablist\"\n            aria-label=\"Details\"\n            className=\"flex border-b px-5 @3xl:px-6\"\n            style={{ borderColor: c.border }}\n          >\n            {TABS.map((t) => {\n              const on = t === tab;\n              return (\n                <button\n                  key={t}\n                  type=\"button\"\n                  role=\"tab\"\n                  id={`${uid}-tab-${t}`}\n                  aria-selected={on}\n                  aria-controls={`${uid}-panel-${t}`}\n                  data-tab={t}\n                  onClick={() => setTab(t)}\n                  onKeyDown={(e) => {\n                    if (e.key !== \"ArrowLeft\" && e.key !== \"ArrowRight\") return;\n                    const i = TABS.indexOf(t);\n                    const next =\n                      TABS[\n                        (i + (e.key === \"ArrowLeft\" ? -1 : 1) + TABS.length) %\n                          TABS.length\n                      ];\n                    setTab(next);\n                    document.getElementById(`${uid}-tab-${next}`)?.focus();\n                  }}\n                  tabIndex={on ? 0 : -1}\n                  className=\"relative -mb-px h-11 cursor-pointer border-0 bg-transparent px-2.5 text-[13px] leading-[20px] font-[510] tracking-[-0.011em] outline-none focus-visible:ring-2 focus-visible:ring-[#5E6AD2] focus-visible:ring-inset\"\n                  style={{\n                    color: on ? c.text : c.sub,\n                    boxShadow: on ? `inset 0 -1.5px 0 ${c.text}` : \"none\",\n                  }}\n                >\n                  {t}\n                  {t === \"Notes\" && notes.length > 0 && (\n                    <span\n                      className=\"ml-1.5 tabular-nums\"\n                      style={{ color: c.faint }}\n                    >\n                      {notes.length}\n                    </span>\n                  )}\n                </button>\n              );\n            })}\n          </div>\n\n          {/* The three panels share one cell, so switching tabs never changes the height. */}\n          <div\n            className=\"grid px-5 py-1 @3xl:px-6\"\n            style={{\n              gridTemplateColumns: \"minmax(0, 1fr)\",\n              minHeight: ROW * ROWS + 8,\n            }}\n          >\n            <ul\n              role=\"tabpanel\"\n              id={`${uid}-panel-Contacts`}\n              aria-labelledby={`${uid}-tab-Contacts`}\n              aria-hidden={tab !== \"Contacts\"}\n              className={`m-0 min-w-0 list-none p-0 [grid-area:1/1] ${tab === \"Contacts\" ? \"visible\" : \"invisible\"}`}\n            >\n              {contacts.slice(0, ROWS).map((p, i) => (\n                <li\n                  key={p.id}\n                  className=\"flex items-center gap-3\"\n                  style={{\n                    height: ROW,\n                    borderTop: i ? `1px solid ${c.border}` : \"none\",\n                  }}\n                >\n                  <Initials\n                    name={p.name}\n                    size={28}\n                    color={c.soft}\n                    bg={c.chip}\n                  />\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"flex items-center gap-1.5\">\n                      <span className=\"truncate text-[13px] leading-[18px] font-[510] tracking-[-0.011em]\">\n                        {p.name}\n                      </span>\n                      {p.champion && (\n                        <span\n                          className=\"shrink-0 rounded-full px-1.5 text-[11px] leading-[16px] font-[510]\"\n                          style={{\n                            background: \"rgba(94,106,210,0.16)\",\n                            color: theme === \"dark\" ? \"#828FFF\" : ACCENT,\n                          }}\n                        >\n                          Champion\n                        </span>\n                      )}\n                    </span>\n                    <span\n                      className=\"block truncate text-[12px] leading-[16px]\"\n                      style={{ color: c.sub }}\n                    >\n                      {p.role}\n                    </span>\n                  </span>\n                  <span\n                    className=\"shrink-0 text-[12px] leading-[16px] tabular-nums\"\n                    style={{ color: c.faint }}\n                  >\n                    {p.lastSeen}\n                  </span>\n                </li>\n              ))}\n            </ul>\n\n            <ul\n              role=\"tabpanel\"\n              id={`${uid}-panel-Activity`}\n              aria-labelledby={`${uid}-tab-Activity`}\n              aria-hidden={tab !== \"Activity\"}\n              className={`m-0 min-w-0 list-none p-0 [grid-area:1/1] ${tab === \"Activity\" ? \"visible\" : \"invisible\"}`}\n            >\n              {events.slice(0, ROWS).map((ev, i) => (\n                <li\n                  key={ev.id}\n                  data-event={ev.id}\n                  className=\"flex items-center gap-3\"\n                  style={{\n                    height: ROW,\n                    borderTop: i ? `1px solid ${c.border}` : \"none\",\n                  }}\n                >\n                  <Dot\n                    size={6}\n                    color={ev.when === \"Just now\" ? ACCENT : c.faint}\n                  />\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"block truncate text-[13px] leading-[18px] tracking-[-0.011em]\">\n                      {ev.text}\n                    </span>\n                    <span\n                      className=\"block truncate text-[12px] leading-[16px]\"\n                      style={{ color: c.sub }}\n                    >\n                      {ev.who}\n                    </span>\n                  </span>\n                  <span\n                    className=\"shrink-0 text-[12px] leading-[16px]\"\n                    style={{ color: ev.when === \"Just now\" ? c.text : c.faint }}\n                  >\n                    {ev.when}\n                  </span>\n                </li>\n              ))}\n            </ul>\n\n            <div\n              role=\"tabpanel\"\n              id={`${uid}-panel-Notes`}\n              aria-labelledby={`${uid}-tab-Notes`}\n              aria-hidden={tab !== \"Notes\"}\n              inert={tab !== \"Notes\"}\n              className={`min-w-0 pt-3 [grid-area:1/1] ${tab === \"Notes\" ? \"visible\" : \"invisible\"}`}\n            >\n              <form\n                onSubmit={(e) => {\n                  e.preventDefault();\n                  saveNote();\n                }}\n              >\n                <label htmlFor={`${uid}-note`} className=\"sr-only\">\n                  Note about {customer.name}\n                </label>\n                <textarea\n                  id={`${uid}-note`}\n                  data-note=\"\"\n                  value={draft}\n                  onChange={(e) => setDraft(e.target.value)}\n                  onKeyDown={(e) => {\n                    if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) {\n                      e.preventDefault();\n                      saveNote();\n                    }\n                  }}\n                  rows={3}\n                  placeholder=\"What should the team know?\"\n                  className=\"block w-full resize-none rounded-lg border px-3 py-2 text-[16px] leading-[22px] outline-none focus:border-[#5E6AD2] @3xl:text-[13px] @3xl:leading-[20px]\"\n                  style={{\n                    background: c.field,\n                    borderColor: c.border,\n                    color: c.text,\n                    fontFamily: \"inherit\",\n                    height: 76,\n                  }}\n                />\n                <div className=\"mt-2 flex items-center justify-between gap-2\">\n                  <span\n                    className=\"text-[12px] leading-[16px]\"\n                    style={{ color: c.faint }}\n                  >\n                    Shared with your team\n                  </span>\n                  <button\n                    type=\"submit\"\n                    data-save-note=\"\"\n                    disabled={!draft.trim()}\n                    className={`h-8 cursor-pointer rounded-full border-0 px-3.5 text-[13px] leading-[20px] font-[510] disabled:cursor-default ${RING}`}\n                    style={{\n                      background: draft.trim() ? c.btn : c.chip,\n                      color: draft.trim() ? c.btnText : c.faint,\n                    }}\n                  >\n                    Save note\n                  </button>\n                </div>\n              </form>\n              <ul className=\"m-0 mt-2 list-none p-0\">\n                {notes.length === 0 ? (\n                  <li\n                    className=\"text-[12.5px] leading-[18px]\"\n                    style={{ color: c.faint }}\n                  >\n                    No notes yet.\n                  </li>\n                ) : (\n                  notes.slice(0, 2).map((n) => (\n                    <li\n                      key={n.id}\n                      className=\"truncate border-t py-2 text-[12.5px] leading-[18px]\"\n                      style={{ borderColor: c.border, color: c.soft }}\n                    >\n                      {n.text}\n                    </li>\n                  ))\n                )}\n              </ul>\n            </div>\n          </div>\n        </div>\n      </div>\n\n      <footer\n        className=\"flex flex-wrap items-center justify-between gap-x-4 gap-y-3 border-t px-5 py-3.5 @3xl:px-8\"\n        style={{ borderColor: c.border }}\n      >\n        <ul className=\"m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0\">\n          {customer.tags.map((t) => (\n            <li\n              key={t}\n              className=\"rounded-full px-2.5 text-[12px] leading-[24px] font-[510] whitespace-nowrap\"\n              style={{ background: c.chip, color: c.soft }}\n            >\n              {t}\n            </li>\n          ))}\n        </ul>\n        <div className=\"flex w-full justify-end gap-2 @2xl:w-auto\">\n          <button\n            type=\"button\"\n            data-flag=\"\"\n            aria-pressed={flagged}\n            onClick={() => {\n              const next = !flagged;\n              setFlagged(next);\n              add(\n                next ? \"Flagged as at risk\" : \"Risk flag removed\",\n                customer.owner,\n              );\n              onFlag?.(next);\n            }}\n            className={`h-9 flex-1 cursor-pointer rounded-full border-0 px-3 text-[13px] leading-[20px] font-[510] tracking-[-0.011em] whitespace-nowrap @2xl:w-[112px] @2xl:flex-none ${RING}`}\n            style={{\n              background: flagged ? \"rgba(252,120,64,0.14)\" : c.chip,\n              color: flagged ? ORANGE : c.soft,\n            }}\n          >\n            {flagged ? \"Unflag\" : \"Flag at risk\"}\n          </button>\n          <button\n            type=\"button\"\n            data-call=\"\"\n            onClick={() => {\n              add(\"Call logged\", customer.owner);\n              setTab(\"Activity\");\n              onLogCall?.();\n            }}\n            className={`h-9 flex-1 cursor-pointer rounded-full border-0 px-3 text-[13px] leading-[20px] font-[510] tracking-[-0.011em] whitespace-nowrap @2xl:flex-none ${RING}`}\n            style={{ background: c.chip, color: c.soft }}\n          >\n            Log call\n          </button>\n          <button\n            type=\"button\"\n            data-open=\"\"\n            onClick={() => onOpenProfile?.()}\n            className={`h-9 flex-1 cursor-pointer rounded-full border-0 px-3.5 text-[13px] leading-[20px] font-[510] tracking-[-0.011em] whitespace-nowrap @2xl:flex-none ${RING}`}\n            style={{ background: c.btn, color: c.btnText }}\n          >\n            Open profile\n          </button>\n        </div>\n      </footer>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}