/* ui/base.css */
/*
  taste-skill UI fragment kit - shared base.
  Small pieces of real product UI, set on an effect ground inside a card's inset panel.
  The standard (references/cards.md): true product scale (13px text, 12px meta, never under 11px).
  A fragment is a picture of a product's screen, so the page's 13px floor (VI-05) does not apply
  inside .ui; every word the page itself says (titles, lines, labels, captions) keeps 13px or more.
  The rest:
  real-looking data, crisp 1px borders, radius 10-12, a soft layered shadow, one accent touch
  (the agent's mark is the ink, so the accent stays free for that one touch).

  Styled only by custom properties set by the page:
    --ui-font, --ui-mono, --ui-radius
    --fx-bg (the fragment's own surface), --fx-surface, --fx-ink, --fx-muted, --fx-accent, --fx-accent-ink
  Light or dark is read from --fx-bg itself (relative colour), so a fragment needs no theme class.
  Every size sits on a 4px grid. Loops stop under prefers-reduced-motion (the JS shows a still state).
*/
:where(.ui) {
  --u-bg: var(--fx-bg, #ffffff);
  --u-surface: var(--fx-surface, #f4f4f3);
  --u-ink: var(--fx-ink, #111111);
  --u-muted: var(--fx-muted, #6b6b6b);
  --u-accent: var(--fx-accent, #e8571f);
  --u-accent-ink: var(--fx-accent-ink, #ffffff);
  --u-r: var(--ui-radius, 12px);
  --u-r2: max(4px, calc(var(--u-r) - 4px));
  --u-r3: max(4px, calc(var(--u-r) - 6px));

  /* lines and fills, all mixed from the palette */
  --u-line: color-mix(in oklab, var(--u-ink) 9%, transparent);
  --u-line-2: color-mix(in oklab, var(--u-ink) 15%, transparent);
  --u-border: color-mix(in oklab, var(--u-ink) 12%, transparent);
  --u-fill: color-mix(in oklab, var(--u-ink) 3.5%, var(--u-bg));
  --u-fill-2: color-mix(in oklab, var(--u-ink) 7%, var(--u-bg));
  --u-fill-3: color-mix(in oklab, var(--u-ink) 11%, var(--u-bg));
  --u-text-2: color-mix(in oklab, var(--u-ink) 80%, var(--u-bg));
  --u-soft: color-mix(in oklab, var(--u-muted) 80%, var(--u-bg));
  --u-tint: color-mix(in oklab, var(--u-accent) 13%, var(--u-bg));
  --u-tint-2: color-mix(in oklab, var(--u-accent) 24%, var(--u-bg));
  --u-accent-text: color-mix(in oklab, var(--u-accent) 74%, var(--u-ink));
  --u-skel: color-mix(in oklab, var(--u-ink) 10%, var(--u-bg));
  /* a brand tile is light on every surface, so a logo keeps its own colours (references/icons.md) */
  --u-tile: #ffffff;
  --u-tile-edge: inset 0 0 0 1px rgb(0 0 0 / 0.09), 0 1px 2px rgb(0 0 0 / 0.12);

  /* depth: shadows grow and a top highlight appears as the fragment surface gets darker */
  --u-sh: rgb(0 0 0 / 0.14);
  --u-sh: oklch(from var(--u-bg) 0 0 0 / calc(0.5 - l * 0.38));
  --u-hi: transparent;
  --u-hi: oklch(from var(--u-bg) 1 0 0 / clamp(0, calc(0.11 - l * 0.11), 0.09));
  --u-shadow:
    inset 0 1px 0 var(--u-hi),
    0 1px 1px color-mix(in oklab, var(--u-sh) 40%, transparent),
    0 2px 4px -1px color-mix(in oklab, var(--u-sh) 45%, transparent),
    0 12px 24px -8px color-mix(in oklab, var(--u-sh) 80%, transparent),
    0 32px 64px -24px var(--u-sh);
  --u-shadow-sm:
    inset 0 1px 0 var(--u-hi),
    0 1px 2px color-mix(in oklab, var(--u-sh) 55%, transparent),
    0 6px 16px -6px color-mix(in oklab, var(--u-sh) 80%, transparent);
  --u-ease: var(--ease, cubic-bezier(.2, .8, .2, 1));   /* the page's one UI ease-out (system.css --ease) */
  /* the name is older than the rule: a strong ease-out that lands softly and never passes its mark (no overshoot, motion.md) */
  --u-spring: cubic-bezier(.22, 1, .36, 1);

  font-family: var(--ui-font, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--u-ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
  text-align: left;
  letter-spacing: -0.003em;
  box-sizing: border-box;
}
:where(.ui) *, :where(.ui) *::before, :where(.ui) *::after { box-sizing: border-box; }
/* a fragment never runs out of its panel on its own: on a narrow panel it narrows; a placement that
   crops it on purpose (cards.css, from 640px: every placement but .at-center) lifts this */
[data-ui] { max-width: 100%; }
/* fragments use div and span for text so page rules like `.card p` cannot reach them */
.ui :where(ul, ol, li, figure, blockquote, article, aside, nav) { margin: 0; padding: 0; list-style: none; }
.ui :where(mark) { background: none; color: inherit; }
:where(.ui) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: default; }
:where(.ui) svg { display: block; flex: none; }

/* ---------------------------------------------------------------- the window every fragment sits in */
.ui-panel {
  position: relative;
  background: var(--u-bg);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r);
  box-shadow: var(--u-shadow);
  max-width: 100%;
}
.ui-head {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--u-line);
}
.ui-title { font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.ui-meta { font-size: 13px; line-height: 16px; color: var(--u-muted); white-space: nowrap; }
.ui-spacer { flex: 1; }
.ui-sep { width: 1px; height: 16px; background: var(--u-line-2); flex: none; }

/* window chrome: three quiet dots and a centred title */
.ui-dots { display: flex; gap: 6px; flex: none; }
.ui-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--u-fill-3); box-shadow: inset 0 0 0 0.5px var(--u-line); }

/* ---------------------------------------------------------------- controls */
/* the primary button is the ink (as on figma.com and x.ai); the accent is kept for one touch */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  height: 28px; padding: 0 10px; border-radius: max(6px, var(--u-r3));
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--u-ink); color: var(--u-bg);
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--u-bg) 14%, transparent), 0 1px 2px color-mix(in oklab, var(--u-sh) 60%, transparent);
  transition: transform 160ms var(--u-ease), background-color 200ms var(--u-ease), color 200ms var(--u-ease);
}
.ui-btn--accent { background: var(--u-accent); color: var(--u-accent-ink); }
.ui-btn--ghost { background: var(--u-bg); color: var(--u-ink); box-shadow: inset 0 0 0 1px var(--u-line-2), 0 1px 2px color-mix(in oklab, var(--u-sh) 30%, transparent); }
.ui-btn--quiet { background: transparent; color: var(--u-muted); box-shadow: none; }
.ui-btn--sm { height: 24px; padding: 0 8px; font-size: 13px; }
.ui-btn .ui-icon { width: 14px; height: 14px; }
.ui-btn.is-pressed { transform: scale(0.96); }

/* status: a dot and a word; quiet by default, the accent only where something is happening */
.ui-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--u-fill); color: var(--u-muted); box-shadow: inset 0 0 0 1px var(--u-line);
}
.ui-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.55; flex: none; }
.ui-chip--plain::before { display: none; }
.ui-chip--accent { background: var(--u-tint); color: var(--u-accent-text); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--u-accent) 22%, transparent); }
.ui-chip--accent::before { background: var(--u-accent); opacity: 1; }
.ui-chip--ink { color: var(--u-ink); }
.ui-chip--ink::before { opacity: 1; }
.ui-chip--live::before { animation: ui-live 1.6s var(--u-ease) infinite; }
.ui-chip svg { width: 12px; height: 12px; margin: 0 -1px 0 -2px; }
.ui-chip:has(svg)::before { display: none; }
@keyframes ui-live { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.ui-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--u-accent); flex: none; }
.ui-kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px;
  font: 500 13px/1 var(--ui-font, inherit); color: var(--u-muted);
  background: var(--u-bg); box-shadow: inset 0 0 0 1px var(--u-line-2), inset 0 -1px 0 var(--u-line);
}
.ui-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* people: initials on a quiet tone, five tones that never reach violet */
.ui-avatar {
  --h: 60;
  display: grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: -0.02em;
  background: color-mix(in oklab, oklch(0.74 0.08 var(--h)) 34%, var(--u-bg));
  color: color-mix(in oklab, oklch(0.5 0.09 var(--h)) 70%, var(--u-ink));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, oklch(0.6 0.08 var(--h)) 22%, transparent);
}
.ui-avatar[data-tone="1"] { --h: 40; }
.ui-avatar[data-tone="2"] { --h: 85; }
.ui-avatar[data-tone="3"] { --h: 150; }
.ui-avatar[data-tone="4"] { --h: 220; }
.ui-avatar[data-tone="5"] { --h: 20; }
.ui-avatar--md { width: 32px; height: 32px; font-size: 13px; }
.ui-avatar--accent { background: var(--u-accent); color: var(--u-accent-ink); box-shadow: none; }

/* the product's own mark (an assistant, a bot): an ink disc with a four-point spark. It is the ink,
   not the accent, so a fragment's one accent touch stays free for its status */
.ui-agent {
  position: relative; display: block; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--u-ink);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--u-bg) 12%, transparent), inset 0 1px 0 color-mix(in oklab, #fff 16%, transparent);
}
.ui-agent::after {
  content: ""; position: absolute; inset: 26%; background: var(--u-bg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 .8c.5 4.3 2.9 6.7 7.2 7.2-4.3.5-6.7 2.9-7.2 7.2C7.5 10.9 5.1 8.5.8 8 5.1 7.5 7.5 5.1 8 .8z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 .8c.5 4.3 2.9 6.7 7.2 7.2-4.3.5-6.7 2.9-7.2 7.2C7.5 10.9 5.1 8.5.8 8 5.1 7.5 7.5 5.1 8 .8z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* skeleton lines for the parts of a window that are only context */
.ui-skel { display: block; height: 6px; border-radius: 3px; background: var(--u-skel); }

/* ---------------------------------------------------------------- brand marks */
/* Real brand icons are local files (icons/, written by scripts/icons.mjs fetch; icons-credits.json lists them): no page calls
   a CDN for an icon. A mark on a tile (.ui-logo, .ui-file__icon, .ui-field__tile, .ui-diff__tool, .ui-pipe__tool) is a colour
   file as <img src="icons/notion.svg" alt="">, the path as printed by fetch for the page that holds it. A small mark inline beside
   text stays in the ink: the one-colour inline <svg class="ui-brand" aria-hidden="true"> that fetch --mono prints. */
.ui-brand { display: block; flex: none; width: 18px; height: 18px; }
svg.ui-brand { fill: currentColor; color: var(--u-ink); }
.ui-brand--ink { color: var(--u-ink); }
/* a brand logo on a small tile: the tile is light on every surface and the logo in its own colours */
.ui-logo {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: var(--u-r2);
  background: var(--u-tile); box-shadow: var(--u-tile-edge);
}
.ui-logo img, .ui-file__icon img, .ui-field__tile img, .ui-diff__tool img, .ui-pipe__tool img { display: block; flex: none; object-fit: contain; }
.ui-logo :is(svg, img, .ui-brand) { width: 20px; height: 20px; }
.ui-logo--sm { width: 32px; height: 32px; border-radius: max(6px, var(--u-r3)); }
.ui-logo--sm :is(svg, img, .ui-brand) { width: 16px; height: 16px; }
.ui-logo--lg { width: 56px; height: 56px; border-radius: var(--u-r); }
.ui-logo--lg :is(svg, img, .ui-brand) { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- the pointer */
.ui-pointer {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: 20px; height: 20px; pointer-events: none;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.25)) drop-shadow(0 3px 6px rgb(0 0 0 / 0.2));
  will-change: transform;
}
.ui-pointer svg { width: 20px; height: 20px; }
/* a named pointer (a person or the agent working in the product) */
.ui-pointer__name {
  position: absolute; left: 14px; top: 18px; height: 20px; padding: 0 7px; border-radius: 6px 10px 10px 10px;
  font: 500 13px/20px var(--ui-font, inherit); white-space: nowrap;
  background: var(--u-accent); color: var(--u-accent-ink);
}
.ui-ring {
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%;
  border: 1.5px solid var(--u-accent); opacity: 0; pointer-events: none; z-index: 4;
}
.ui-ring.is-on { animation: ui-ring 520ms var(--u-ease) forwards; }
@keyframes ui-ring { from { opacity: 0.8; transform: var(--at) scale(0.4); } to { opacity: 0; transform: var(--at) scale(1.5); } }

@keyframes ui-spin { to { transform: rotate(360deg); } }
.ui-spin {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 1.5px solid color-mix(in oklab, currentColor 30%, transparent); border-top-color: currentColor;
  animation: ui-spin 700ms linear infinite;
}

/* ---------------------------------------------------------------- held, paused */
/* a fragment held on its finished picture (data-ui-still, its cycles done) shows nothing that moves:
   no caret, spinner or pulse runs on in a still picture */
.is-ui-held, .is-ui-held *, .is-ui-held *::before, .is-ui-held *::after { animation: none !important; }
.is-ui-paused, .is-ui-paused *, .is-ui-paused *::before, .is-ui-paused *::after { animation-play-state: paused !important; }

/* the pause button ui.loop puts by a looping fragment (and an object from assets/objects, as
   .loop-pause): a solid disc in the page colours (never a see-through blur), 32px in a 44px hit area,
   the same as components' .cx-pause and system.css. In a card it sits beside the title (ui.js sets its
   top and right; the title keeps 44px clear), in a panel outside a card 12px in from the bottom-right
   corner, and with no panel under the fragment, in 44px kept free below it. */
button.ui-pause.ui-pause, button.loop-pause {
  position: absolute; right: 12px; bottom: 12px; z-index: 6; display: grid; place-items: center;
  width: 32px; height: 32px; margin: 0; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid color-mix(in oklab, var(--ink, #111) 16%, transparent);
  background: var(--bg, #fff); color: var(--ink, #111);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 4px 12px -4px rgb(0 0 0 / 0.28);
  opacity: 0.88; transition: opacity 200ms ease, border-color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
button.ui-pause.ui-pause--title { bottom: auto; box-shadow: none; opacity: 1; }
button.ui-pause.ui-pause--below { right: 0; bottom: 6px; box-shadow: none; }
.ui-pause-beside { padding-right: 44px; }
button:is(.ui-pause, .loop-pause)::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
button:is(.ui-pause, .loop-pause):is(:hover, :focus-visible) { opacity: 1; border-color: color-mix(in oklab, var(--ink, #111) 32%, transparent); }
button:is(.ui-pause, .loop-pause):focus-visible { outline: 2px solid var(--ink, #111); outline-offset: 2px; }
button:is(.ui-pause, .loop-pause) svg { display: block; width: 14px; height: 14px; fill: currentColor; }
button:is(.ui-pause, .loop-pause).is-paused svg, button.loop-pause[aria-pressed="true"] svg { margin-left: 1px; }
@media (forced-colors: active) { button.ui-pause.ui-pause, button.loop-pause { border-color: ButtonText; } }

@media (prefers-reduced-motion: reduce) {
  :where(.ui) *, :where(.ui) *::before, :where(.ui) *::after { transition-duration: 0ms !important; animation: none !important; }
  button.ui-pause.ui-pause, button.loop-pause { display: none; }
}

/* ui/window/fragment.css */
/* window: a helpdesk queue (sidebar, list); the assistant works down the open rows */
.ui-win { width: 600px; overflow: hidden; }
.ui-win__bar { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--u-line); background: var(--u-fill); min-width: 0; }
/* the breadcrumb gives way first (an ellipsis), so the search box at the right is never pushed out or cut */
.ui-win__crumb { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; overflow: hidden; font-size: 13px; line-height: 16px; color: var(--u-muted); white-space: nowrap; }
.ui-win__crumb b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-win__crumb .ui-brand, .ui-win__crumb i { flex: none; }
.ui-win__crumb .ui-brand { width: 14px; height: 14px; }
.ui-win__crumb i { font-style: normal; color: var(--u-muted); }
.ui-win__crumb b { font-weight: 500; color: var(--u-ink); }
.ui-win__search { display: inline-flex; flex: none; align-items: center; gap: 8px; height: 28px; width: 168px; padding: 0 4px 0 8px; border-radius: 7px; background: var(--u-bg); box-shadow: inset 0 0 0 1px var(--u-line-2); font-size: 13px; color: var(--u-soft); }
.ui-win__search .ui-icon { width: 14px; height: 14px; color: var(--u-muted); }
.ui-win__search .ui-kbd { margin-left: auto; min-width: 20px; height: 20px; font-size: 13px; }
.ui-win__body { display: grid; grid-template-columns: 152px 1fr; min-height: 312px; }
.ui-win__side { display: grid; align-content: start; gap: 1px; padding: 8px; border-right: 1px solid var(--u-line); }
.ui-win__nav {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 6px;
  font-size: 13px; line-height: 16px; color: var(--u-muted);
}
.ui-win__nav .ui-icon { width: 14px; height: 14px; }
.ui-win__nav em { margin-left: auto; font-style: normal; font-size: 13px; color: var(--u-soft); }
.ui-win__nav.is-on { background: var(--u-fill-2); color: var(--u-ink); font-weight: 500; }
.ui-win__nav.is-on em { color: var(--u-muted); }
.ui-win__label { margin: 12px 8px 4px; font-size: 13px; line-height: 16px; color: var(--u-soft); }
.ui-win__hash { width: 14px; text-align: center; color: var(--u-soft); }
.ui-win__main { min-width: 0; }
.ui-win__cols, .ui-win__row { display: grid; grid-template-columns: 24px 92px minmax(0, 1fr) 96px 28px; align-items: center; gap: 0 12px; padding: 0 16px; }
.ui-win__cols { height: 32px; border-bottom: 1px solid var(--u-line); font-size: 13px; line-height: 16px; color: var(--u-soft); }
.ui-win__cols span:first-child { grid-column: 1 / 3; }
.ui-win__row { height: 44px; font-size: 13px; line-height: 16px; transition: background-color 260ms var(--u-ease); }
.ui-win__row + .ui-win__row { box-shadow: inset 0 1px 0 var(--u-line); }
.ui-win__row.is-sel { background: color-mix(in oklab, var(--u-ink) 4%, var(--u-bg)); }
.ui-win__row .ui-avatar { width: 24px; height: 24px; }
.ui-win__who { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-win__sub { color: var(--u-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-win__age { color: var(--u-soft); text-align: right; font-size: 13px; }
.ui-win__st {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--u-muted); box-shadow: inset 0 0 0 1px var(--u-line-2);
  transition: color 240ms var(--u-ease), background-color 240ms var(--u-ease), box-shadow 240ms var(--u-ease);
}
.ui-win__st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; flex: none; }
/* the row being worked on is the window's one accent touch */
.ui-win__st.is-work { color: var(--u-accent-text); background: var(--u-tint); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--u-accent) 22%, transparent); }
.ui-win__st.is-work::before { width: 8px; height: 8px; background: none; border: 1.5px solid color-mix(in oklab, currentColor 30%, transparent); border-top-color: currentColor; opacity: 1; animation: ui-spin 800ms linear infinite; }
.ui-win__st.is-done { color: var(--u-soft); box-shadow: inset 0 0 0 1px var(--u-line); }
.ui-win__st.is-you { color: var(--u-ink); box-shadow: inset 0 0 0 1px var(--u-line-2); background: var(--u-fill-2); }
.ui-win__st.is-you::before { background: var(--u-ink); opacity: 1; }
/* compact (opts.compact): a narrower window whose rows stack name over subject, for a card panel
   where the whole width must show; the status stays in view */
.ui-win--compact { width: 456px; }
.ui-win--compact .ui-win__body { grid-template-columns: 128px 1fr; }
.ui-win--compact .ui-win__search { width: 112px; }
.ui-win--compact .ui-win__cols { display: none; }
.ui-win--compact .ui-win__row { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-rows: 18px 16px; align-content: center; height: 56px; row-gap: 1px; padding: 0 14px; }
.ui-win--compact .ui-win__row .ui-avatar { grid-row: 1 / 3; }
.ui-win--compact .ui-win__who { grid-column: 2; grid-row: 1; line-height: 18px; }
.ui-win--compact .ui-win__sub { grid-column: 2; grid-row: 2; font-size: 13px; }
.ui-win--compact .ui-win__st { grid-column: 3; grid-row: 1 / 3; align-self: center; }
.ui-win--compact .ui-win__age { display: none; }
/* narrow: the window's own width decides its layout (a container query), so a .fit wrapper, a small
   card at 1024 or a phone panel never slices its columns:
   - under 540px the rows stack name over subject, the column heads and the age go (the compact rows);
   - under 420px the sidebar goes too and the search shrinks to its icon. */
.ui-win { container: ui-win / inline-size; }
@container ui-win (max-width: 539px) {
  .ui-win .ui-win__cols { display: none; }
  .ui-win .ui-win__row { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-rows: 18px 16px; align-content: center; height: 56px; row-gap: 1px; padding: 0 14px; }
  .ui-win .ui-win__row .ui-avatar { grid-row: 1 / 3; }
  .ui-win .ui-win__who { grid-column: 2; grid-row: 1; line-height: 18px; }
  .ui-win .ui-win__sub { grid-column: 2; grid-row: 2; font-size: 13px; }
  .ui-win .ui-win__st { grid-column: 3; grid-row: 1 / 3; align-self: center; }
  .ui-win .ui-win__age { display: none; }
  .ui-win .ui-win__body { grid-template-columns: 128px minmax(0, 1fr); }
  .ui-win .ui-win__search { width: 112px; }
}
@container ui-win (max-width: 419px) {
  .ui-win .ui-win__body { grid-template-columns: minmax(0, 1fr); }
  .ui-win .ui-win__side { display: none; }
  .ui-win .ui-win__search { width: 28px; padding: 0; justify-content: center; gap: 0; }
  .ui-win .ui-win__search :is(.ui-kbd, .ui-win__ph) { display: none; }
  .ui-win .ui-win__row { gap: 0 10px; padding: 0 12px; }
  .ui-win .ui-win__bar { gap: 10px; padding: 0 8px 0 12px; }
}
/* very narrow: the window dots go too, the crumb keeps its last word */
@container ui-win (max-width: 299px) {
  .ui-win .ui-dots { display: none; }
}
/* phone: the window takes the panel's width (cards.css); the queries above lay it out */
@media (max-width: 639px) {
  .ui-win, .ui-win--compact { width: 100%; }
}

/* ui/chat/fragment.css */
/* chat: a customer asks, the assistant answers word by word with the sources it used */
/* in a .to-edge wrapper the body grows to fill it, so the input always sits past the panel's edge */
.ui-chat { width: 400px; overflow: hidden; display: flex; flex-direction: column; }
.ui-chat > .ui-head, .ui-chat__input { flex: none; }
.ui-chat .ui-head .ui-agent { width: 20px; height: 20px; }
.ui-chat__online { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--u-muted); }
/* a quiet ink dot, as every status in the kit: no off-palette green */
.ui-chat__online::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.ui-chat__tool { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--u-muted); }
/* --chat-body sets the empty room above the input, so a placement can push the input past the panel's
   edge by a clear margin (cut on purpose) or keep it in view */
.ui-chat__body { flex: 1 0 auto; display: grid; gap: 12px; padding: 12px 16px 16px; min-height: var(--chat-body, 216px); align-content: start; }
.ui-chat__day { justify-self: center; font-size: 13px; line-height: 16px; color: var(--u-muted); }
.ui-msg { font-size: 13px; line-height: 20px; transition: opacity 260ms var(--u-ease), transform 360ms var(--u-ease); }
.ui-msg--me {
  justify-self: end; max-width: 280px; padding: 8px 12px; border-radius: 14px 14px 4px 14px;
  background: var(--u-fill-2); color: var(--u-ink); box-shadow: inset 0 0 0 1px var(--u-line);
}
.ui-msg--bot { display: flex; gap: 10px; align-items: flex-start; max-width: 340px; }
.ui-msg__av { width: 22px; height: 22px; margin-top: 1px; }
.ui-msg__col { display: grid; gap: 10px; min-width: 0; color: var(--u-text-2); }
.ui-msg--bot b { font-weight: 500; color: var(--u-ink); }
.ui-msg.is-hidden { opacity: 0; transform: translateY(6px); }
.ui-chat__srcs { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-chat__src {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 6px;
  border-radius: 6px; font-size: 13px; font-weight: 500; line-height: 16px; color: var(--u-muted);
  background: var(--u-bg); box-shadow: inset 0 0 0 1px var(--u-line-2);
}
.ui-chat__src :is(.ui-icon, .ui-brand) { width: 13px; height: 13px; }
/* the answer's last sentence is written again in place: its words never drop below 72% ink */
.ui-chat__w { transition: opacity 180ms var(--u-ease); }
.ui-chat__w.is-off { opacity: 0.72; }
.ui-chat__srcs.is-hidden { opacity: 0; }
.ui-chat__src { transition: opacity 240ms var(--u-ease, ease), transform 240ms var(--u-ease, ease); }
.ui-chat__src.is-wait { opacity: 0; transform: translateY(3px); }
/* the typing dots: under the answer where its sources sit, only while the next words are on their way */
.ui-msg__col { position: relative; }
.ui-chat__typing { position: absolute; left: 0; bottom: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity 160ms ease; pointer-events: none; }
.ui-chat__typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--u-muted, #6b6b6b); animation: ui-chat-dot 900ms ease-in-out infinite; }
.ui-chat__typing i:nth-child(2) { animation-delay: 150ms; } .ui-chat__typing i:nth-child(3) { animation-delay: 300ms; }
.ui-chat.is-typing .ui-chat__typing { opacity: 1; }
@keyframes ui-chat-dot { 0%, 60%, 100% { transform: none; opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ui-chat__typing { display: none; } }
.ui-chat__srcs { transition: opacity 320ms var(--u-ease); }
.ui-chat__input {
  display: flex; align-items: center; gap: 8px; height: 40px; margin: 0 12px 12px; padding: 0 4px 0 12px;
  border-radius: 10px; background: var(--u-fill); box-shadow: inset 0 0 0 1px var(--u-line-2);
  font-size: 13px; color: var(--u-soft);
}
.ui-chat__ph { flex: 1; }
.ui-chat__send { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--u-ink); color: var(--u-bg); }

/* ui/notify/fragment.css */
/* notify: a short stack of notifications; a new one slides in on top, the oldest leaves */
.ui-notify { width: 380px; }
.ui-notify__list { position: relative; display: grid; gap: 8px; }
.ui-note {
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 14px 0 12px;
  border-radius: var(--u-r); background: var(--u-bg); border: 1px solid var(--u-border);
  box-shadow: var(--u-shadow-sm);
  transition: transform 520ms var(--u-ease), opacity 360ms var(--u-ease);
}
.ui-note:first-child { box-shadow: var(--u-shadow); }
.ui-note__av { width: 32px; height: 32px; font-size: 13px; }
.ui-note__ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--u-fill-2); color: var(--u-muted); box-shadow: inset 0 0 0 1px var(--u-line); }
.ui-note__ico svg { width: 16px; height: 16px; }
.ui-note__text { display: grid; flex: 1; min-width: 0; }
.ui-note__title { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.ui-note__title time { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--u-soft); }
.ui-note__body { font-size: 13px; line-height: 16px; color: var(--u-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-note__btn { margin-left: 4px; }
.ui-note:has(.ui-note__btn) .ui-note__title time { display: none; }
.ui-note.is-enter { opacity: 0; transform: translateY(-14px) scale(0.98); }
.ui-note.is-leave { opacity: 0; transform: translateY(8px) scale(0.98); }
/* phone: the stack takes the panel's width (cards.css) and a long line wraps instead of being cut */
@media (max-width: 639px) {
  .ui-note { height: auto; min-height: 64px; padding: 12px 12px 12px 12px; align-items: flex-start; }
  .ui-note__av, .ui-note__ico { margin-top: 2px; }
  .ui-note__title, .ui-note__body { white-space: normal; text-wrap: pretty; }
  .ui-note__btn { align-self: center; }
}

