{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sidebar",
  "type": "registry:ui",
  "title": "Sidebar",
  "description": "The sidebar primitive.",
  "dependencies": [
    "lucide-react@^1.49.0"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/tooltip.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/sidebar.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/sidebar.tsx",
      "content": "/// <reference path=\"../css.d.ts\" />\nimport { createContext, useContext, useId, useLayoutEffect, useRef, type AnchorHTMLAttributes, type DetailsHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport { ArrowLeft, ChevronRight, Menu, X } from 'lucide-react';\nimport { cn } from '../lib/utils';\nimport { Tooltip } from './tooltip';\nimport { BlockPlacementContext } from '../lib/placement';\nimport './sidebar.css';\n\n// An app's side navigation, drawn from the app-shell-sidebar block. Everything works rendered on the server with no script:\n// groups are native <details>, and under 56rem of SidebarLayout the sidebar is a top bar with a menu button that opens the\n// navigation as a drawer from the right, the side of the button (one more <details>; sidebar.css). Felix 2026-10-22: \"mobile menu\n// should be a hamburger in the top bar\", then \"move to the right side of the top bar\". The backdrop belongs to the button, so tapping it closes the drawer with no script; with script, Escape and\n// following a link close it too.\n// Height comes from the parent (full height in SidebarLayout); no limit on groups or items.\n\nconst Ctx = createContext({ rail: false, inLayout: false });\nconst focus = 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-(--kh-focus)';\n\nexport interface SidebarLayoutProps extends HTMLAttributes<HTMLDivElement> {\n  /** The <Sidebar>: beside the content from 56rem of this layout's width (sticky, full height), above it when narrower. */\n  sidebar?: ReactNode;\n  children: ReactNode;\n  /** 'panels' (default; Felix 2026-10-22 14:4x \"we make it the default look for all our apps\"): from 64rem the sidebar and the\n   *  content are rounded panels floating on a soft canvas with an even gap (sidebar.css, --kh-shell-* variables). 'flush': the\n   *  sidebar column against the window edge with a line, as before. Phones keep the top bar and drawer either way. */\n  frame?: 'panels' | 'flush';\n  /** A focus page (a task, a board): no sidebar, the work gets the whole width. */\n  focus?: boolean;\n  /** A top bar over the content (a focus page's way back, title and actions): its own floating panel in the panels frame. */\n  bar?: ReactNode;\n  /** The bar is one element of the app's own that fills the bar's panel edge to edge (its own surface and padding): no padding or\n   *  line from the shell, its corners follow the panel's. */\n  barFlush?: boolean;\n  /** No content panel: the work sits on the canvas and draws its own panels (a board's columns). Panels frame only. */\n  bareContent?: boolean;\n  /** The bar on the canvas with no panel of its own (a board's title and zoom over its columns, Felix 28 Oct: \"the title on the\n   *  canvas with no panel, so the columns carry the eye\"). Panels frame only. */\n  barOpen?: boolean;\n  /** The page's address (a route or hash). In the panels frame from 64rem the content panel scrolls, not the window, so a host's\n   *  scrollTo(0, 0) on navigation misses it: when this changes, the content panel goes back to its top. */\n  scrollKey?: string;\n}\n\n/** The app shell: a sidebar column and the content. Responsive by its own width (a container), not the viewport. The content is\n *  one column (the bar, then the children in one panel), so a host can pass any number of children. */\nexport function SidebarLayout({ sidebar, children, frame = 'panels', focus = false, bar, barFlush = false, bareContent = false, barOpen = false, scrollKey, className, ...rest }: SidebarLayoutProps) {\n  const side = !focus && sidebar != null;\n  const content = useRef<HTMLDivElement>(null);\n  const seen = useRef(scrollKey);\n  // Before paint, so the new page never shows at the old one's scroll.\n  useLayoutEffect(() => {\n    if (seen.current === scrollKey) return;\n    seen.current = scrollKey;\n    content.current?.scrollTo?.(0, 0);\n  }, [scrollKey]);\n  return (\n    <div className={cn('kh-sidebar-layout', className)} data-frame={frame} data-focus={side ? undefined : ''} {...rest}>\n      <div className=\"kh-sidebar-grid\">\n        {side && (\n          <Ctx.Provider value={{ rail: false, inLayout: true }}>\n            <div className=\"kh-sidebar-slot\">{sidebar}</div>\n          </Ctx.Provider>\n        )}\n        <div className=\"kh-shell-main\" data-bare={bareContent ? '' : undefined}>\n          {bar != null && <div className=\"kh-shell-bar\" data-flush={barFlush ? '' : undefined} data-open={barOpen ? '' : undefined}>{bar}</div>}\n          <div ref={content} className=\"kh-shell-content\" data-bare={bareContent ? '' : undefined}>\n            {/* The content is an app panel: blocks in it drop their page band and column (InPanel), with no wrapper. */}\n            <BlockPlacementContext.Provider value=\"panel\">{children}</BlockPlacementContext.Provider>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n\nexport interface SidebarProps extends HTMLAttributes<HTMLElement> {\n  /** Always shown, also when the rest folds away (the brand row). */\n  header?: ReactNode;\n  /** Inside SidebarLayout: the menu button's name under 56rem (\"Menu\"); the button opens the navigation as a drawer.\n   *  Without it the sidebar stays above the content on a narrow screen. */\n  foldLabel?: ReactNode;\n  /** The same button's name while the drawer is open (it shows an X then). Default \"Close menu\". */\n  closeLabel?: ReactNode;\n  /** A narrow rail of icons: item and group names go to screen readers and tooltips. */\n  rail?: boolean;\n  children: ReactNode;\n}\n\nexport function Sidebar({ header, foldLabel, closeLabel = 'Close menu', rail = false, className, children, ...rest }: SidebarProps) {\n  const { inLayout } = useContext(Ctx);\n  const body = <div className=\"kh-sidebar-body flex min-h-0 flex-1 flex-col\">{children}</div>;\n  return (\n    <Ctx.Provider value={{ rail, inLayout: false }}>\n      <aside data-rail={rail || undefined} className={cn('kh-sidebar flex h-full min-h-0 flex-col bg-kh-surface', className)} {...rest}>\n        {inLayout && foldLabel ? (\n          <>\n            <div className=\"kh-sidebar-top\">{header}</div>\n            <details\n              className=\"kh-sidebar-fold flex min-h-0 flex-1 flex-col\"\n              onKeyDown={(e) => { if (e.key === 'Escape' && e.currentTarget.open) { e.currentTarget.open = false; e.currentTarget.querySelector('summary')?.focus(); } }}\n              onClick={(e) => { if ((e.target as HTMLElement).closest('a[href]')) e.currentTarget.open = false; }}\n            >\n              <summary className={cn('kh-sidebar-menu inline-flex size-11 cursor-pointer list-none items-center justify-center rounded-kh text-kh-ink hover:bg-kh-surface-2 [&::-webkit-details-marker]:hidden', focus)}>\n                {/* One button opens and closes: a menu icon and its name while closed, an X and closeLabel while open (sidebar.css). */}\n                <Menu aria-hidden className=\"kh-sidebar-open size-5\" />\n                <X aria-hidden className=\"kh-sidebar-close size-5\" />\n                <span className=\"kh-sidebar-open sr-only\">{foldLabel}</span>\n                <span className=\"kh-sidebar-close sr-only\">{closeLabel}</span>\n              </summary>\n              {body}\n            </details>\n          </>\n        ) : (\n          <>{header}{body}</>\n        )}\n      </aside>\n    </Ctx.Provider>\n  );\n}\n\n/** The brand row: a name or logo and an optional action (a rail toggle). */\nexport function SidebarHeader({ action, className, children, ...rest }: HTMLAttributes<HTMLDivElement> & { action?: ReactNode }) {\n  const { rail } = useContext(Ctx);\n  return (\n    <div className={cn('flex min-h-14 items-center gap-2 border-b border-kh-line px-3', rail ? 'justify-center' : 'justify-between pl-4', className)} {...rest}>\n      <div data-kh-rail-name={rail || undefined} className={cn('flex min-w-0 flex-1 flex-col justify-center gap-0.5 py-2', rail && 'sr-only')}>{children}</div>\n      {action}\n    </div>\n  );\n}\n\n/** A slot above the navigation, for a search form. */\nexport function SidebarSearch({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n  return <div className={cn('px-3 pt-3', className)} {...rest} />;\n}\n\nexport interface SidebarNavProps extends HTMLAttributes<HTMLElement> {\n  /** Names the navigation landmark. Not shown. (Or aria-labelledby.) */\n  label?: string;\n}\n\n/** The labelled, scrolling navigation: SidebarMenu and SidebarGroup inside. */\nexport function SidebarNav({ label, className, ...rest }: SidebarNavProps) {\n  return <nav aria-label={label} className={cn('flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2', className)} {...rest} />;\n}\n\n/** A list of SidebarItems outside a group. */\nexport function SidebarMenu({ className, inset, ...rest }: HTMLAttributes<HTMLUListElement> & { inset?: boolean }) {\n  return <ul className={cn('flex flex-col gap-0.5', inset && 'pl-4', className)} {...rest} />;\n}\n\nconst countClass = 'text-kh-caption tabular-nums text-kh-muted';\n\nexport interface SidebarItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n  href: string;\n  /** The page the person is on: aria-current, a soft fill and a heavier weight (never the fill alone); no bar at the side at any width (Felix 2026-10-21 16:2x). */\n  current?: boolean;\n  icon?: ReactNode;\n  /** An accent count that wants attention (\"3 to answer\"). */\n  badge?: ReactNode;\n  /** A quiet count or note at the end of the row. */\n  meta?: ReactNode;\n  /** The name in the rail's tooltip. Defaults to the children when they are a string. */\n  tooltip?: string;\n  children: ReactNode;\n}\n\nexport function SidebarItem({ href, current, icon, badge, meta, tooltip, className, children, ...rest }: SidebarItemProps) {\n  const { rail } = useContext(Ctx);\n  const link = (\n    <a\n      href={href}\n      aria-current={current ? 'page' : undefined}\n      data-kh-rail-item={rail || undefined}\n      className={cn(\n        'relative flex min-h-9 items-center gap-3 rounded-kh px-3 text-kh-small font-medium pointer-coarse:min-h-11',\n        current ? 'bg-(--kh-row-active) font-semibold text-kh-ink' : 'text-kh-ink-2 hover:bg-kh-surface-2 hover:text-kh-ink',\n        rail && 'justify-center px-0',\n        focus,\n        className,\n      )}\n      {...rest}\n    >\n      {icon}\n      <span data-kh-rail-name={rail || undefined} className={cn('min-w-0 flex-1 truncate', rail && 'sr-only')}>{children}</span>\n      {badge != null && badge !== '' && (\n        <span className={cn('rounded-kh-pill bg-kh-accent-soft px-2 text-kh-caption tabular-nums text-kh-accent-ink', rail && 'absolute right-0 top-0 min-w-4 px-1 text-center text-[0.625rem] leading-4')}>{badge}</span>\n      )}\n      {meta != null && meta !== '' && <span className={cn(countClass, rail && 'sr-only')}>{meta}</span>}\n    </a>\n  );\n  const name = tooltip ?? (typeof children === 'string' ? children : undefined);\n  return <li>{rail && name ? <Tooltip content={name} side=\"right\">{link}</Tooltip> : link}</li>;\n}\n\nexport interface SidebarGroupProps extends Omit<DetailsHTMLAttributes<HTMLElement>, 'open' | 'onToggle'> {\n  label: ReactNode;\n  /** false: a fixed heading, always open. */\n  collapsible?: boolean;\n  /** Whether a collapsible group starts open (a native <details>, no script needed). */\n  defaultOpen?: boolean;\n  /** Controlled instead: a button with aria-expanded, for an app that keeps the state itself. Needs onOpenChange. */\n  open?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  badge?: ReactNode;\n  meta?: ReactNode;\n  /** Indent the items under the heading (groups of plain text links, no icons). */\n  inset?: boolean;\n  children: ReactNode;\n}\n\nexport function SidebarGroup({ label, collapsible = true, defaultOpen, open, onOpenChange, badge, meta, inset, className, children, ...rest }: SidebarGroupProps) {\n  const id = useId();\n  const { rail } = useContext(Ctx);\n  const list = (hidden?: boolean) => <SidebarMenu id={`${id}-g`} inset={inset && !rail} hidden={hidden}>{children}</SidebarMenu>;\n  const counts = (\n    <span className=\"flex shrink-0 items-center gap-1.5\">\n      {badge != null && badge !== '' && <span className=\"rounded-kh-pill bg-kh-accent-soft px-2 text-kh-caption tabular-nums text-kh-accent-ink\">{badge}</span>}\n      {meta != null && meta !== '' && <span className={countClass}>{meta}</span>}\n    </span>\n  );\n  const head = cn('flex min-h-9 pointer-coarse:min-h-11 w-full items-center justify-between gap-2 rounded-kh px-3 text-kh-small text-kh-ink hover:bg-kh-surface-2', focus);\n  const title = (chevron: ReactNode) => <span className=\"flex min-w-0 items-center gap-1.5 truncate font-medium\">{chevron}{label}</span>;\n\n  if (rail || !collapsible) {\n    return (\n      <div className={cn('mb-3 flex flex-col', className)} {...(rest as HTMLAttributes<HTMLDivElement>)}>\n        <p className={cn('flex min-h-8 items-end px-3 pb-1 pt-3 text-kh-caption text-kh-muted', rail && 'sr-only')}>{label}</p>\n        {list()}\n      </div>\n    );\n  }\n  if (onOpenChange) {\n    const shown = !!open;\n    return (\n      <div className={cn('flex flex-col gap-0.5', className)} {...(rest as HTMLAttributes<HTMLDivElement>)}>\n        <button type=\"button\" aria-expanded={shown} aria-controls={`${id}-g`} onClick={() => onOpenChange(!shown)} className={head}>\n          {title(<ChevronRight aria-hidden className={cn('size-4 shrink-0 text-kh-muted transition-transform', shown && 'rotate-90')} />)}\n          {counts}\n        </button>\n        {list(!shown)}\n      </div>\n    );\n  }\n  return (\n    // The chevron turns with its own group only: a group-open variant would also match an open group around it, so nested groups\n    // inside an open one would all point down while closed.\n    <details open={defaultOpen} className={cn('flex flex-col gap-0.5 [&[open]>summary>span>svg:first-child]:rotate-90', className)} {...rest}>\n      <summary className={cn(head, 'cursor-pointer list-none [&::-webkit-details-marker]:hidden')}>\n        {title(<ChevronRight aria-hidden className=\"size-4 shrink-0 text-kh-muted transition-transform\" />)}\n        {counts}\n      </summary>\n      {list()}\n    </details>\n  );\n}\n\n/** The page's title for SidebarLayout's bar: the H1 (and a badge) at the start, actions at the end, as the bar's two children so\n *  the panels bar lays them out at the sidebar switcher's 60 px. /ws and the builder each had this copy. */\nexport function PageBar({ title, badge, actions }: { title: ReactNode; badge?: ReactNode; actions?: ReactNode }) {\n  return (\n    <>\n      <div className=\"flex min-h-11 min-w-0 flex-wrap items-center gap-3\"><h1 className=\"font-kh-display text-kh-heading font-semibold [overflow-wrap:anywhere]\">{title}</h1>{badge}</div>\n      {actions && <div className=\"flex flex-wrap items-center justify-end gap-2\">{actions}</div>}\n    </>\n  );\n}\n\n/** A focus page's bar (SidebarLayout focus, the sidebar hidden): the way back at the start, the title, actions at the end. A row on\n *  a phone; from 64rem the wrapper dissolves so its three parts are the panels bar's three columns and the title sits centred.\n *  Studio drew this and Klar Agent copied it (Felix 10-27 22:3x \"the back button appears in the top bar\"); both import this one. */\nexport function FocusBar({ back, backLabel = 'Back', title, actions }: { back: string; backLabel?: string; title: ReactNode; actions?: ReactNode }) {\n  return (\n    <div className=\"flex min-h-14 min-w-0 flex-1 items-center gap-3 px-3 @4xl:contents\">\n      <a href={back} aria-label={backLabel} className=\"inline-flex size-10 shrink-0 items-center justify-center rounded-[10px] border border-(--kh-card-line) text-kh-ink-2 hover:bg-(--kh-row-active) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus) pointer-coarse:size-11\"><ArrowLeft aria-hidden className=\"size-4\" /></a>\n      <h1 className=\"min-w-0 flex-1 truncate font-medium @4xl:text-center\">{title}</h1>\n      {/* The right column keeps a 44 px control's height even when empty, so every bar is the same height. */}\n      <div className=\"flex items-center justify-end gap-2 @4xl:min-h-11\">{actions}</div>\n    </div>\n  );\n}\n\n/** The foot: settings, the account, a theme toggle. */\nexport function SidebarFooter({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {\n  return <div className={cn('flex items-center justify-between gap-2 border-t border-kh-line px-2 py-2', className)} {...rest} />;\n}\n"
    },
    {
      "path": "src/ui/sidebar.css",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/sidebar.css",
      "content": "/* SidebarLayout: responsive by its own width. Narrow (with a foldLabel): a top bar with a menu button; the body opens as a drawer.\n   From 56rem: a sticky full-height column beside the content, the body always shown (the summary hidden, ::details-content shown,\n   as in collection-controls.css). */\n.kh-sidebar-layout { container: kh-shell / inline-size; }\n.kh-sidebar-grid { display: flex; flex-direction: column; min-height: 100dvh; }\n.kh-sidebar-slot > .kh-sidebar { border-bottom: 1px solid var(--kh-line); }\n@container kh-shell (min-width: 56rem) {\n  .kh-sidebar-grid { display: grid; grid-template-columns: var(--kh-sidebar-width, 17rem) minmax(0, 1fr); }\n  .kh-sidebar-slot { position: sticky; top: 0; height: 100dvh; }\n  .kh-sidebar-slot > .kh-sidebar { border-bottom: 0; border-right: 1px solid var(--kh-line); }\n  .kh-sidebar-fold > summary { display: none; }\n  .kh-sidebar-top { display: contents; }\n  .kh-sidebar-fold::details-content { display: contents; content-visibility: visible; }\n}\n/* Narrow: one top bar, the brand at its start and the menu button at its end (Felix 12:1x: \"move to the right side of the top bar\");\n   the navigation is a drawer from the same side as its button. */\n@container kh-shell (max-width: 55.99rem) {\n  .kh-sidebar-slot { position: sticky; top: 0; z-index: 40; }\n  .kh-sidebar-slot > .kh-sidebar:has(> .kh-sidebar-fold) { flex-direction: row; align-items: center; padding-inline-end: 0.5rem; }\n  .kh-sidebar-top { flex: 1; min-width: 0; order: 1; }\n  .kh-sidebar-top > * { border-bottom: 0; }\n  .kh-sidebar-fold { flex: none; order: 2; }\n  /* The drawer and its backdrop hang from the sticky bar (their containing block): top 100% is the bar's bottom and\n     calc(100dvh - 100%) the rest of the screen, whatever height the header gives the bar (Felix 12:36: a fixed 3.5rem top\n     overlapped a 60 px bar). */\n  .kh-sidebar-fold > .kh-sidebar-body {\n    position: absolute; inset-block-start: 100%; inset-inline-end: 0; z-index: 50; height: calc(100dvh - 100%);\n    width: min(20rem, 85vw); overflow-y: auto;\n    background: var(--kh-surface); border-inline-start: 1px solid var(--kh-line); box-shadow: var(--kh-shadow-3);\n    padding-block: 0.75rem; transition: transform var(--kh-dur) ease-out;\n  }\n  /* Closed, the drawer is not rendered at all: no links laid out off to the side, none in the tab order or read out (prototype 15:1x). */\n  .kh-sidebar-fold:not([open]) > .kh-sidebar-body { display: none; }\n  /* A rail folded into a phone's menu is a menu like any other: the brand and every place show their names, since a phone has\n     no hover to reach a tooltip (KB-426 walk: the rail's menu was two bare icons). */\n  .kh-sidebar-slot > .kh-sidebar[data-rail] { width: auto; }\n  .kh-sidebar[data-rail] [data-kh-rail-name].sr-only { position: static; width: auto; height: auto; margin: 0; padding: 0; overflow: hidden; clip-path: none; white-space: nowrap; }\n  .kh-sidebar[data-rail] .kh-sidebar-top > * { justify-content: flex-start; }\n  .kh-sidebar[data-rail] [data-kh-rail-item] { justify-content: flex-start; padding-inline: 0.75rem; }\n  @starting-style { .kh-sidebar-fold[open] > .kh-sidebar-body { transform: translateX(100%); } }\n  /* The drawer opens under the top bar, so its button stays in view and turns into the close button (an X; chatadmin 12:13).\n     The backdrop is part of that button: a tap anywhere outside the drawer closes it, with no script. It covers the page under\n     the bar only, so the whole bar, brand included, stays bright (Felix 12:36); the drawer sits above it. */\n  .kh-sidebar-fold[open] > summary::after {\n    content: ''; position: absolute; inset-block-start: 100%; inset-inline: 0; z-index: 45; height: calc(100dvh - 100%);\n    background: color-mix(in oklab, var(--kh-ink) 40%, transparent);\n  }\n}\n/* A phone: the drawer is the full width under the bar, a menu rather than a narrow panel (Felix 12:36 \"menu too short\"). */\n@container kh-shell (max-width: 39.99rem) {\n  .kh-sidebar-fold > .kh-sidebar-body { width: auto; inset-inline-start: 0; border-inline-start: 0; box-shadow: none; }\n}\n/* The menu button's two faces: closed, a menu icon and its name; open, an X and the close name. */\n.kh-sidebar-fold:not([open]) > summary .kh-sidebar-close, .kh-sidebar-fold[open] > summary .kh-sidebar-open { display: none; }\n\n/* ---------- The panels frame (the default; Felix 2026-10-22 14:4x, the Huddlekit brief): from 64rem the sidebar and the content\n   are rounded panels on a soft canvas, an even gap around and between them; separation by fill and space, not lines. The values\n   are theme variables (theme-base.css, --kh-shell-* / --kh-panel-*), the prototype seat's final ones. Phones keep the flush frame. */\n.kh-shell-main { display: flex; min-width: 0; flex-direction: column; }\n.kh-shell-content { display: flex; min-width: 0; flex: 1; flex-direction: column; }\n.kh-sidebar-layout[data-focus] > .kh-sidebar-grid { display: flex; flex-direction: column; }\n.kh-shell-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 3.5rem; padding: 8px 16px; border-bottom: 1px solid var(--kh-line); }\n/* barFlush: the app's own bar fills the top-bar panel edge to edge (its surface, its padding), rounded with the panel. */\n.kh-shell-bar[data-flush] { display: block; padding: 0; border-bottom: 0; }\n.kh-shell-bar[data-flush] > * { border-radius: inherit; }\n@container kh-shell (min-width: 64rem) {\n  /* The canvas on the grid: a container query cannot style the container (.kh-sidebar-layout) itself. */\n  [data-frame='panels'] > .kh-sidebar-grid { grid-template-columns: var(--kh-sidebar-width, 15rem) minmax(0, 1fr); gap: var(--kh-shell-gap); padding: var(--kh-shell-gap); background: var(--kh-shell-canvas); }\n  [data-frame='panels'] .kh-sidebar-slot { top: var(--kh-shell-gap); height: calc(100dvh - 2 * var(--kh-shell-gap)); }\n  [data-frame='panels'] .kh-sidebar-slot > .kh-sidebar,\n  [data-frame='panels'] .kh-shell-bar,\n  [data-frame='panels'] .kh-shell-content {\n    border: 0; border-radius: var(--kh-panel-radius); box-shadow: var(--kh-panel-shadow); background: var(--kh-panel-bg);\n    --kh-canvas: var(--kh-surface); /* a sticky strip inside that paints the canvas matches its panel */\n  }\n  [data-frame='panels'] .kh-shell-content[data-bare] { background: transparent; box-shadow: none; border-radius: 0; --kh-canvas: var(--kh-shell-canvas); }\n  [data-frame='panels'] .kh-sidebar-slot > .kh-sidebar { overflow: hidden; padding: 8px; }\n  /* Inside the sidebar panel, separation is by space: no header or footer lines. */\n  [data-frame='panels'] .kh-sidebar :is(.border-b, .border-t) { border-color: transparent; }\n  [data-frame='panels'] .kh-shell-main { gap: var(--kh-shell-gap); min-height: calc(100dvh - 2 * var(--kh-shell-gap)); }\n  /* The content panel is the scroller, not the document: with the page scrolling, the panel's rounded top slid under the sticky\n     bar and its corners went square (Felix 11-07 07:5x \"when I scroll down the border radius looks like it dissapears\"; dbview's\n     fix, lifted). Its corners clip what scrolls inside. A host that reset the page with scrollTo(0, 0) on navigation resets\n     .kh-shell-content instead. Bare content (a board's columns, which scroll themselves and cast shadows to the edge) and phones\n     keep the page scroll; print shows everything. */\n  [data-frame='panels'] .kh-shell-main:not([data-bare]) { height: calc(100dvh - 2 * var(--kh-shell-gap)); min-height: 0; }\n  [data-frame='panels'] .kh-shell-content:not([data-bare]) { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }\n  /* Its children keep their height so the panel scrolls rather than squeezing them: a child that scrolls itself (a table's\n     overflow-x wrapper) has a min-height of 0 and would shrink to fit. Zero specificity: a child's own shrink or flex-1 wins. */\n  :where([data-frame='panels'] .kh-shell-content:not([data-bare])) > * { flex-shrink: 0; }\n  /* Every top bar is its own panel, the shell gap below it like the gap between the other panels (Felix 16:43 \"top bars like this\n     should have a space below it to align with the gap style\"). 56 px, sticky at the gap; title at the start and actions at the end,\n     or with three children (a focus page: back | title | actions) the title centred. The gap above it is painted with the canvas,\n     so content that scrolls under the bar does not show through. */\n  [data-frame='panels'] .kh-shell-bar {\n    position: sticky; top: var(--kh-shell-gap); z-index: 30; min-height: 56px;\n    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 12px 8px 20px;\n  }\n  [data-frame='panels'] .kh-shell-bar[data-flush] { display: block; padding: 0; }\n  /* An open bar: the title and its controls on the canvas, no panel (a board's). */\n  [data-frame='panels'] .kh-shell-bar[data-open] { background: transparent; box-shadow: none; border: 0; border-radius: 0; }\n  [data-frame='panels'] .kh-shell-bar:not([data-flush]):has(> :nth-child(3)) { display: grid; grid-template-columns: 1fr auto 1fr; padding-inline: 8px; }\n  [data-frame='panels'] .kh-shell-bar::before,\n  [data-frame='panels'] .kh-shell-bar::after {\n    content: ''; position: absolute; inset-inline: 0; bottom: 100%; height: var(--kh-shell-gap); background: var(--kh-shell-canvas);\n  }\n  /* The gap under the bar too: at rest it is canvas anyway; scrolled, text passing under the bar does not show between it and the\n     content panel (Klar Agent painted this itself, critic 20:5x 10-22). */\n  [data-frame='panels'] .kh-shell-bar::after { bottom: auto; top: 100%; }\n  /* The current page and hovers: a soft fill, 6 px radius (brief 2; scaled with the panel radius, Felix 16:33). */\n  [data-frame='panels'] .kh-sidebar a { border-radius: 6px; }\n  [data-frame='panels'] .kh-sidebar a[aria-current='page'],\n  [data-frame='panels'] .kh-sidebar a:hover { background: var(--kh-row-active); }\n}\n@media print {\n  .kh-shell-main { height: auto !important; }\n  .kh-shell-content { overflow: visible !important; }\n}\n"
    }
  ]
}
