/* Auto-generated by scripts/emit-affectui-shell-css.mjs. Do not edit manually. */

/* Design tokens – same values as the affectUI library components */
.ui-as {
  --tray: #f4f4f4;
  --card: var(--aui-surface, #ffffff);
  /* Like the affectUI library: gray page, the main area is a rounded panel on it */
  --page: var(--aui-subtle, #f8f8f8);
  /* The double sidebar's chats: between the page and the panel */
  --side-tint: var(--aui-subtle, #fcfcfc);
  --panel: var(--aui-surface, #ffffff);
  --radius-panel: calc(var(--aui-radius-lg, 10px) + 2px);
  --frame-gap: 8px;
  /*
   * One head row for the whole shell: every screen's top bar, the work area's tabs and the header across the app are
   * this tall, and the corner icons (sidebar, work area) sit on its centerline. The heads start under the main panel's
   * top border (--as-head-edge, 0 in the flat layout), so the line is frame gap + edge + half the head from the top.
   */
  --as-head-h: 48px;
  --as-head-edge: 1px;
  /* Clean: hairlines drawn with shadows, text in stepped opacities of black, Inter in 400 and 500 */
  --line: var(--aui-border, rgba(0, 0, 0, 0.06));
  --line-soft: var(--aui-border, rgba(0, 0, 0, 0.04));
  --strong: var(--aui-ink, #000000);
  --ink: var(--aui-ink, rgba(0, 0, 0, 0.88));
  --text: var(--aui-muted, rgba(0, 0, 0, 0.61));
  --muted: var(--aui-muted, rgba(0, 0, 0, 0.45));
  --faint: var(--aui-placeholder, rgba(0, 0, 0, 0.27));
  --placeholder: var(--aui-placeholder, rgba(0, 0, 0, 0.27));
  --chip: var(--aui-subtle, rgba(0, 0, 0, 0.04));
  --chip-hover: rgba(0, 0, 0, 0.06);
  --hover: rgba(0, 0, 0, 0.03);
  --accent: var(--aui-info, #0070d6);
  --ui-as-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --button: var(--aui-primary, rgba(0, 0, 0, 0.88));
  --button-hover: rgba(0, 0, 0, 0.78);
  --accent-soft: rgba(0, 96, 226, 0.08);
  --shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  /* A card: a 0.5px hairline and a soft drop; the frame around previews is a faint gray with the same hairline */
  --card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(0, 0, 0, 0.06)), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05));
  --card-shadow-hover: 0 0 0 0.5px var(--aui-border-strong, rgba(0, 0, 0, 0.1)), 0 2px 6px -1px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --frame: rgba(0, 0, 0, 0.02);
  --line-strong: var(--aui-border-strong, rgba(0, 0, 0, 0.1));
  /* An edge you can drag, while the pointer is on it */
  --edge-active: var(--aui-border-strong, rgba(0, 0, 0, 0.14));
  --subtle: var(--aui-subtle, #fafafa);
  --disabled: #dcdcdc;
  --on-ink: #ffffff;
  --ink-hover: #3a3a3a;
  --select: rgba(0, 0, 0, 0.055);
  --toggle-off: #e2e2e2;
  --switch-on: #171717;
  --logo-bg: #ffffff;
  --ease: var(--aui-ease, cubic-bezier(0.22, 1, 0.36, 1));
  --font: var(--aui-font, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

/* Library components inside a screen are their clean versions – same scale and hairlines as the shell; approval
   actions stay at their natural width, at the end of the row */
.ui-as .ui-apc__foot .ui-apc__actions { flex: 0 0 auto; margin-left: auto; }

/* Dark mode: follows a .dark class or data-theme="dark" on any ancestor, e.g. <html>.
   Every screen draws from these tokens, and the library parts inside switch on their own. */
:where(.dark, [data-theme="dark"]) .ui-as {
  --tray: #1d1d20;
  --card: var(--aui-surface, #1b1b1e);
  --page: var(--aui-subtle, #0e0e10);
  --side-tint: var(--aui-subtle, #111113);
  --panel: var(--aui-surface, #141416);
  --line: var(--aui-border, rgba(255, 255, 255, 0.08));
  --line-soft: var(--aui-border, rgba(255, 255, 255, 0.05));
  --strong: var(--aui-ink, #ffffff);
  --ink: var(--aui-ink, rgba(255, 255, 255, 0.9));
  --text: var(--aui-muted, rgba(255, 255, 255, 0.62));
  --muted: var(--aui-muted, rgba(255, 255, 255, 0.45));
  --faint: var(--aui-placeholder, rgba(255, 255, 255, 0.28));
  --placeholder: var(--aui-placeholder, rgba(255, 255, 255, 0.28));
  --chip: var(--aui-subtle, rgba(255, 255, 255, 0.06));
  --chip-hover: rgba(255, 255, 255, 0.09);
  --hover: rgba(255, 255, 255, 0.05);
  --accent: var(--aui-info, #4fb0fe);
  --ui-as-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --button: var(--aui-primary, #f4f4f5);
  --button-hover: #ffffff;
  --accent-soft: color-mix(in srgb, var(--aui-blue, #4fb0fe) 16%, transparent);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(255, 255, 255, 0.1)), 0 1px 2px rgba(0, 0, 0, 0.4));
  --card-shadow-hover: 0 0 0 0.5px var(--aui-border-strong, rgba(255, 255, 255, 0.16)), 0 2px 6px rgba(0, 0, 0, 0.4);
  --frame: rgba(255, 255, 255, 0.03);
  --line-strong: var(--aui-border-strong, rgba(255, 255, 255, 0.14));
  --edge-active: var(--aui-border-strong, rgba(255, 255, 255, 0.18));
  --subtle: var(--aui-subtle, #18181b);
  --disabled: #3a3a3f;
  --on-ink: #111113;
  --ink-hover: #d4d4d8;
  --select: rgba(255, 255, 255, 0.08);
  --toggle-off: #3a3a3f;
  --switch-on: var(--aui-blue, #4fb0fe);
  --logo-bg: #2a2a2e;
  color-scheme: dark;
}

.ui-as, .ui-as *, .ui-as *::before, .ui-as *::after { box-sizing: border-box; }
.ui-as {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:where(.ui-as) button {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
:where(.ui-as) svg { display: block; flex: none; }
/* The shell's ring at the lowest weight that still beats a host page's bare :focus-visible – any screen rule
   (.ui-x:focus-visible) wins by design, not by the order of the style tags */
.ui-as :where(:focus-visible) { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; }
.ui-as textarea:focus-visible, .ui-as input:focus-visible { outline: none; }

/* App frame shared by all screens: sidebar on the gray page, main area as a rounded white panel */

.ui-as-app {
  /* The layout answers to the app's own width (container queries), not the window – see the end of this file */
  container: ui-as / inline-size;
  position: relative;
  display: grid;
  /* Sidebar · main area · work area on the right (0 when there is none or it's closed); widths come from the drag handles */
  --side-col: var(--side-w, 272px);
  --panel-col: 0px;
  grid-template-columns: var(--side-col) minmax(0, 1fr) var(--panel-col);
  height: 100%;
  min-height: 560px;
  background: var(--page);
  transition: grid-template-columns 420ms var(--ease);
}
.ui-as-app[data-panel="open"] { --panel-col: var(--panel-w, 360px); }
/* Dragging an edge: the columns follow the pointer at once */
.ui-as-app[data-resizing] { transition: none; cursor: col-resize; user-select: none; }
.ui-as-app[data-resizing] :is(.ui-as-main, .ui-as-side, .ui-as-panel) { transition: none; }

/* ---------- Sidebar ---------- */

.ui-as-side {
  display: flex;
  flex-direction: column;
  width: var(--side-w, 272px);
  min-height: 0;
  padding: 10px 8px 8px 10px;
  transition: opacity 260ms ease, translate 420ms var(--ease), visibility 0s;
}
/* The rail: the sidebar keeps its layout and is only cut to the icons – every row stays where it was,
   at its height, with its own fill. Words go; each row names itself on hover */
.ui-as-app[data-collapsed] { --side-col: 48px; }
.ui-as-app[data-collapsed] > .ui-as-side { width: 100%; overflow: hidden; }
.ui-as-app[data-collapsed] > .ui-as-side > * { flex-shrink: 0; width: calc(var(--side-w, 272px) - 20px); }
.ui-as-app[data-collapsed] :is(.ui-as-side__name, .ui-as-side__workspace > svg, .ui-as-side__text, .ui-as-side__count, .ui-as-user__name, .ui-as-user > svg, .ui-as-side__search > span, .ui-as-side__search > kbd) { display: none; }
.ui-as-app[data-collapsed] :is(.ui-as-side__item, .ui-as-side__search, .ui-as-side__workspace, .ui-as-user-menu > .ui-as-user) { flex: none; width: fit-content; }
.ui-as-app[data-collapsed] .ui-as-side__search { padding-right: 8px; }
/* Group titles keep their room; a short hairline stands in for the words */
.ui-as-app[data-collapsed] .ui-as-side__label { color: transparent; white-space: nowrap; overflow: hidden; background: linear-gradient(var(--line-strong), var(--line-strong)) 0 50% / 28px 0.5px no-repeat; }
.ui-as-app[data-collapsed] .ui-as-side__empty { visibility: hidden; }
.ui-as-app[data-collapsed] .ui-as-side__foot > :not(.ui-as-user-menu) { display: none; }
/* The toggle lies over the workspace logo and takes its place while the pointer is on the sidebar; a settings sidebar drops its way back and shows the toggle */
.ui-as-app[data-collapsed] :is(.ui-as-side__head, .ui-as-bar--side) { position: relative; }
.ui-as-app[data-collapsed] .ui-as-side__tools,
.ui-as-app[data-collapsed] > .ui-as-bar--side > .ui-as-icon-btn { position: absolute; top: 0; left: 0; opacity: 0; transition: opacity 140ms ease; }
.ui-as-app[data-collapsed] > .ui-as-bar--side > .ui-as-icon-btn { top: 10px; left: 10px; margin: 0; }
.ui-as-app[data-collapsed] :is(.ui-as-side__tools, .ui-as-bar--side) .ui-as-icon-btn { width: 30px; }
.ui-as-app[data-collapsed]:has(> :is(.ui-as-side, .ui-as-bar--side):hover, :is(.ui-as-side__head, .ui-as-bar--side) :focus-visible) :is(.ui-as-side__tools, .ui-as-bar--side > .ui-as-icon-btn),
.ui-as-app[data-collapsed] :is(.ui-as-side__head, .ui-as-bar--side):has(> .ui-as-side__back) :is(.ui-as-side__tools, .ui-as-icon-btn) { opacity: 1; }
.ui-as-app[data-collapsed]:has(> :is(.ui-as-side, .ui-as-bar--side):hover, :is(.ui-as-side__head, .ui-as-bar--side) :focus-visible) .ui-as-side__logo { opacity: 0; }
.ui-as-app[data-collapsed] .ui-as-side__logo { transition: opacity 140ms ease; }
.ui-as-app[data-collapsed] .ui-as-side__back { visibility: hidden; }

/* The icon to bring the sidebar back, in the top left corner of the main area */
.ui-as-side-open {
  position: fixed;
  z-index: 20;
  /* On the head row's centerline – the button is 28px tall */
  top: calc(var(--frame-gap) + var(--as-head-edge) + (var(--as-head-h) - 28px) / 2);
  left: calc(var(--frame-gap) + 9px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 200ms ease, visibility 0s 200ms;
}


.ui-as-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
}
/* The workspace's name takes what the tools leave and shortens with … – the full name on hover */
.ui-as-side__head { gap: 4px; }
.ui-as-side__head > .ui-as-anchor { display: flex; min-width: 0; }
.ui-as-side__workspace {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  height: 30px;
  padding: 0 6px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.ui-as-side__workspace svg { color: var(--faint); }
.ui-as-side__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-side__tools { flex: none; }
.ui-as-side__workspace:hover { background: var(--hover); }
/* Settings sidebar: "‹ Settings" in place of the workspace */
.ui-as-side__back { display: flex; align-items: center; gap: 6px; min-width: 0; height: 30px; padding: 0 8px 0 4px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 14px; font-weight: 500; color: var(--strong); }
.ui-as-side__back svg { color: var(--muted); transition: translate 200ms var(--ease); }
.ui-as-side__back:hover { background: var(--hover); }
.ui-as-side__back:hover svg { translate: -2px 0; }
.ui-as-user-menu { display: flex; }
.ui-as-user-menu > .ui-as-user { flex: 1; min-width: 0; }
.ui-as-user-menu .ui-as-menu { width: 100%; }
/* The account menu's head: picture, name and email */
.ui-as-account { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.ui-as-account img, .ui-as-account .ui-as-user__initials { flex: none; width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
.ui-as-account__text { display: grid; min-width: 0; }
.ui-as-account__text b { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-as-account__text small { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
/* The workspace menu runs as wide as the sidebar */
.ui-as-ws-menu .ui-as-menu { width: 240px; }
/* Workspace logo on a white tile with a small, tight shadow below */
.ui-as-side__logo {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 1px;
  border-radius: 5px;
  background: var(--logo-bg);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.12);
}
.ui-as-side__logo svg { width: 11px; height: auto; }
.ui-as-side__tools { display: flex; gap: 2px; }

.ui-as-icon-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  color: var(--muted);
  transition: background-color 140ms ease, color 140ms ease;
}
.ui-as-icon-btn:hover { background: var(--hover); color: var(--ink); }

.ui-as-side__nav {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 12px;
  /* A long list scrolls under the head, the cards at the bottom stay */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.ui-as-side__nav::-webkit-scrollbar { display: none; }
/* Rows keep their height – the list scrolls instead of squeezing them */
.ui-as-side__nav > *, .ui-as-side__nav .ui-as-side__group > * { flex-shrink: 0; }
.ui-as-side__foot { flex: none; }

/* Chats: no icon – loose ones start at the rows' left edge, the ones in a folder line up with its name;
   ⋯ and the pin show on hover */
.ui-as-side { position: relative; }
.ui-as-chats, .ui-as-chat-pinned { margin-top: 6px; }
.ui-as-chats-skel .ui-as-side__label { display: flex; align-items: center; height: 16px; }
.ui-as-chat-folder-row { position: relative; display: flex; flex: none; }
.ui-as-chat-folder-row:is(:hover, :has(:focus-visible), [data-menu]) > .ui-as-chat-folder { padding-right: 56px; background: var(--hover); color: var(--ink); }
.ui-as-chat-folder-row:is(:hover, :has(:focus-visible), [data-menu]) .ui-as-chat-row__tools { opacity: 1; }
.ui-as-chat-folder__rename { padding-left: 29px; }
.ui-as-chat-folder-row[draggable="true"] { cursor: grab; }
.ui-as-chat-folder > .ui-as-side__text { flex: 0 1 auto; }
.ui-as-chat-folder__arrow { display: grid; flex: none; place-items: center; margin-left: -4px; color: var(--faint); opacity: 0; transition: opacity 120ms ease, transform 200ms var(--ease); }
.ui-as-chat-folder[aria-expanded="true"] .ui-as-chat-folder__arrow { transform: rotate(90deg); }
.ui-as-chat-folder-row:is(:hover, :has(:focus-visible)) .ui-as-chat-folder__arrow { opacity: 1; }
.ui-as-chat-folder-row[data-dragging] { opacity: 0.4; }
.ui-as-chat-folder-row[data-drop]::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 1px; background: var(--accent); pointer-events: none; }
.ui-as-chat-folder-row[data-drop="before"]::after { top: -1px; }
.ui-as-chat-folder-row[data-drop="after"]::after { bottom: -1px; }
.ui-as-chat-row { position: relative; display: flex; flex: none; }
.ui-as-chat-row > .ui-as-chat-row__link { padding-left: 6px; }
.ui-as-chat-row[data-indent] > .ui-as-chat-row__link { padding-left: 30px; }
.ui-as-chat-folder__chats { display: flex; flex-direction: column; }
.ui-as-chat-folder__empty { padding-left: 30px; }
/* A chat dragged over a folder: the folder lights up */
.ui-as-chat-folder[data-drop] { background: var(--hover); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }
.ui-as-chat-row__link .ui-as-side__text { flex: 1; }
.ui-as-chat-row:is(:hover, :has(:focus-visible), [data-menu]) .ui-as-chat-row__link { padding-right: 56px; background: var(--hover); color: var(--ink); }
/* The open chat: only the soft hover fill behind it, no heavier type */
.ui-as-chat-row > .ui-as-chat-row__link[aria-current="page"] { background: var(--hover); font-weight: 400; color: var(--ink); }
.ui-as-chat-row__dot { flex: none; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); }
.ui-as-chat-row__tools { position: absolute; top: 3px; right: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity 120ms ease; }
.ui-as-chat-row:is(:hover, :has(:focus-visible), [data-menu]) .ui-as-chat-row__tools { opacity: 1; }
.ui-as-chat-row__tool { display: grid; place-items: center; width: 24px; height: 24px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 120ms ease, color 120ms ease; }
.ui-as-chat-row__tool:hover, .ui-as-chat-row__tool[aria-expanded="true"] { background: var(--chip); color: var(--ink); }
.ui-as-chat-row__rename { width: 100%; height: 30px; padding: 0 8px 0 5px; border: 0; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); outline: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong); font: inherit; font-size: 13px; color: var(--ink); }
/* Dragging: the row fades, a line shows where it lands */
.ui-as-chat-row[data-indent] .ui-as-chat-row__rename { padding-left: 29px; }
.ui-as-chat-row[draggable="true"] { cursor: grab; }
.ui-as-chat-row[data-dragging] { opacity: 0.4; }
.ui-as-chat-row[data-drop]::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 1px; background: var(--accent); pointer-events: none; }
.ui-as-chat-row[data-drop="before"]::after { top: -1px; }
.ui-as-chat-row[data-drop="after"]::after { bottom: -1px; }
.ui-as-chat-menu { position: absolute; z-index: 30; width: 232px; animation: ui-as-popover-up 160ms var(--ease) both; }
.ui-as-chat-menu .ui-as-menu__subpanel { min-width: 180px; }
/* The rail has no room for names */
.ui-as-app[data-collapsed] :is(.ui-as-chats, .ui-as-chat-folder__chats, .ui-as-chat-row, .ui-as-chat-row__tools) { display: none; }
.ui-as-app[data-collapsed] .ui-as-chat-pinned:not(:has(.ui-as-chat-folder)) { display: none; }
.ui-as-app[data-collapsed] .ui-as-chat-folder__arrow { display: none; }
/* Search opens the Command Menu over the app, near the top, on a soft scrim */
.ui-as-cmd {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: min(12vh, 96px) 16px 16px;
  background: rgba(0, 0, 0, 0.12);
  animation: ui-as-cmd-fade 200ms ease both;
}
.ui-as-cmd > * { width: 100%; max-width: 560px; animation: ui-as-cmd-in 260ms var(--ease) both; }
@keyframes ui-as-cmd-fade { from { opacity: 0; } }
@keyframes ui-as-cmd-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
:where(.dark, [data-theme="dark"]) .ui-as-cmd { background: rgba(0, 0, 0, 0.45); }

/* The search field under the workspace */
.ui-as-side__search {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  margin-top: 12px;
  padding: 0 6px 0 8px;
  border-radius: calc(var(--aui-radius, 7px) + 1px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  transition: box-shadow 140ms ease, color 140ms ease;
}
.ui-as-side__search svg { color: var(--faint); }
.ui-as-side__search:hover { box-shadow: var(--card-shadow-hover); color: var(--text); }
.ui-as-side__search kbd { margin-left: auto; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font: inherit; font-size: 11px; line-height: 18px; color: var(--faint); }
.ui-as-side__group { display: flex; flex-direction: column; }
.ui-as-side__group + .ui-as-side__group { margin-top: 10px; }
.ui-as-side__group + .ui-as-side__group > .ui-as-side__label:first-child { margin-top: 6px; }
.ui-as-side__count { flex: none; margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-as-side__empty { padding: 4px 6px; font-size: 13px; color: var(--faint); }
.ui-as-side__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 6px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}
.ui-as-side__item svg { flex: none; color: var(--muted); }
/* One line per row – long names shorten with …, the full name on hover */
.ui-as-side__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-side__item:hover { background: var(--hover); color: var(--ink); }
.ui-as-side__item[aria-current="page"] { background: var(--select); color: var(--ink); font-weight: 500; }
.ui-as-side__item[aria-current="page"] svg { color: var(--ink); }
a.ui-as-side__item { text-decoration: none; cursor: pointer; }
.ui-as-side__label {
  margin: 16px 0 4px;
  padding: 0 6px;
  font-size: 12.5px;
  line-height: 16px;
  color: var(--faint);
}

.ui-as-side__foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

/* "What's new" – two cards stacked, the second one peeks out above */
.ui-as-news { position: relative; padding-top: 30px; }
.ui-as-news__card {
  position: relative;
  z-index: 1;
  padding: 10px 10px 0;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as-news__card--back {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 10px;
  right: 10px;
  height: 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 9px 9px 0;
  background: var(--card);
  color: var(--faint);
}
.ui-as-news[data-count="1"] { padding-top: 0; }
.ui-as-news[data-count="1"] .ui-as-news__card--back { display: none; }
.ui-as-news__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ui-as-news__kicker { min-width: 0; overflow: hidden; font-size: 11.5px; line-height: 15px; font-weight: 500; color: var(--accent); white-space: nowrap; text-overflow: ellipsis; }
.ui-as-news__card--back svg, .ui-as-news__close { flex: none; }
.ui-as-news__close {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: -2px -2px 0 0;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  color: var(--faint);
}
.ui-as-news__close:hover { background: var(--hover); color: var(--ink); }
.ui-as-news__title { display: block; margin-top: 4px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.ui-as-news__more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% + 20px);
  height: 34px;
  margin: 10px -10px 0;
  padding: 0 10px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 calc(var(--aui-radius-lg, 10px) + 2px) calc(var(--aui-radius-lg, 10px) + 2px);
  font-size: 12.5px;
  color: var(--muted);
}
.ui-as-news__more:hover { background: var(--subtle); color: var(--ink); }

/* Onboarding progress */
/* Getting started: one card that morphs between the short summary and the full Setup Guide */
.ui-as-guide-slot { position: relative; flex: none; }
.ui-as-guide {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  transition: height 480ms var(--ease), border-radius 480ms var(--ease), box-shadow 200ms ease;
}
.ui-as-guide:not([data-open]):hover { box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(0, 0, 0, 0.05); }
.ui-as-guide[data-open] { border-radius: calc(var(--aui-radius-lg, 10px) + 2px); box-shadow: 0 0 0 0.5px var(--line-strong), 0 8px 24px -10px rgba(0, 0, 0, 0.14); }
.ui-as-guide__content { animation: ui-as-guide-in 360ms var(--ease) both; }
/* Closing: the guide fades out while the card shrinks back to the summary's height */
.ui-as-guide[data-state="closing"] .ui-as-guide__content { animation: ui-as-guide-out 260ms ease both; }
.ui-as-guide[data-state="closing"] { border-radius: calc(var(--aui-radius-lg, 10px) + 2px); box-shadow: var(--card-shadow); }
@keyframes ui-as-guide-out { to { opacity: 0; } }
@keyframes ui-as-guide-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ui-as-steps {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 10px 9px;
  text-align: left;
}
/* The library's Setup Guide inside the card: its own frame drops away, the card is the frame */
/* Opening and closing belong to the card, so the guide's own minimize button is left out */
.ui-as-guide .ui-sgdc__icon-btn[aria-expanded] { display: none; }
.ui-as-guide .ui-sgdc { zoom: 0.86; max-width: none; padding: 12px 4px 4px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.ui-as-steps__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink);
}
.ui-as-steps__title svg { color: var(--faint); }
.ui-as-steps__sub { font-size: 12.5px; line-height: 17px; color: var(--muted); }
.ui-as-steps__cheer { color: var(--accent); }
.ui-as-steps__bar {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--tray);
}
.ui-as-steps__bar i { display: block; min-width: 6px; height: 100%; border-radius: inherit; background: var(--accent); transition: width 600ms var(--ease); }

.ui-as-user {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 6px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.ui-as-user__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-user > :is(img, .ui-as-user__initials) { flex: none; }
.ui-as-user img { width: 21px; height: 21px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06); }
.ui-as-user svg { margin-left: auto; color: var(--faint); }
.ui-as-user:hover { background: var(--hover); }

/* ---------- Main ---------- */

/* Main area as a rounded panel, like the affectUI library */
.ui-as-main {
  /* Screens reflow their content by the width of this panel */
  container: ui-as-main / inline-size;
  position: relative;
  min-width: 0;
  margin: var(--frame-gap) var(--frame-gap) var(--frame-gap) 0;
  overflow-y: auto;
  /* No rubber-band bounce at the ends – sticky headers stay put */
  overscroll-behavior: none;
  transition: margin-left 420ms var(--ease);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
}


/* Shared page parts: headings, toolbars, tabs, search, empty states – affectUI tokens */

.ui-as-page {
  padding: 46px 32px 56px;
}
.ui-as-page-title {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 500;
  letter-spacing: -0.24px;
  color: var(--strong);
}
.ui-as-page-sub {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--text);
}
.ui-as-page-sub a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.ui-as-page-sub a:hover { color: var(--ink); text-decoration-color: currentColor; }

.ui-as-section-head { margin-top: 36px; }
/* Without tabs the tools sit on the same line as the title */
.ui-as-section-head[data-inline] { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ui-as-section-head[data-inline] .ui-as-toolbar { margin-top: 0; }
/* A section's title: a small uppercase label */
.ui-as-section-head__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.ui-as-section-head__count { font-variant-numeric: tabular-nums; color: var(--faint); }
.ui-as-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}
.ui-as-toolbar__left, .ui-as-toolbar__right { display: flex; align-items: center; gap: 6px; }

/* Tabs: small outlined buttons, the active one gets a soft gray fill */
.ui-as-tabs { position: relative; display: flex; gap: 8px; }
/* The gray pill glides under the active tab */
.ui-as-tabs__pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 28px;
  border-radius: calc(var(--aui-radius, 7px) - 1px);
  background: var(--select);
  transition: transform 340ms var(--ease), width 340ms var(--ease);
}
.ui-as-tabs__tab {
  position: relative;
  height: 28px;
  padding: 0 10px;
  border-radius: calc(var(--aui-radius, 7px) - 1px);
  font-size: 13px;
  color: var(--text);
  box-shadow: inset 0 0 0 0.5px var(--line);
  transition: background-color 140ms ease, color 140ms ease;
}
.ui-as-tabs__tab:hover { color: var(--ink); }
.ui-as-tabs__tab[aria-selected="true"] { color: var(--ink); }

/* Small outlined tools */
.ui-as-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 28px;
  height: 28px;
  border-radius: calc(var(--aui-radius, 7px) - 1px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  color: var(--text);
  transition: box-shadow 140ms ease, color 140ms ease;
}
.ui-as-tool svg { color: var(--muted); }
.ui-as-tool:hover { box-shadow: var(--card-shadow-hover); color: var(--ink); }
.ui-as-tool--label { padding: 0 10px; font-size: 13px; }

.ui-as-view {
  position: relative;
  display: flex;
  gap: 2px;
  height: 28px;
  padding: 2px;
  border-radius: calc(var(--aui-radius, 7px) - 1px);
  background: var(--chip);
}
.ui-as-view__btn {
  display: grid;
  place-items: center;
  width: 28px;
  border-radius: calc(var(--aui-radius, 7px) - 3px);
  color: var(--faint);
}
.ui-as-view__btn:hover { color: var(--ink); }
.ui-as-view__btn { position: relative; transition: color 160ms ease; }
.ui-as-view__btn[aria-checked="true"] { color: var(--ink); }
/* White pill that slides between grid and list */
.ui-as-view__pill {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: 28px;
  border-radius: calc(var(--aui-radius, 7px) - 3px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  transition: transform 320ms var(--ease);
}
.ui-as-view[data-view="list"] .ui-as-view__pill { transform: translateX(30px); }

/* Search in a toolbar: the library's Text Field at the toolbar's width */
.ui-as-search { display: block; min-width: 0; }

/* Sort: the arrows turn half a circle for Z–A */
.ui-as-sort svg { transition: transform 360ms var(--ease); }
.ui-as-sort[data-dir="desc"] svg { transform: rotate(180deg); }
.ui-as-tool[data-active] { box-shadow: var(--card-shadow-hover); color: var(--ink); }
.ui-as-tool__count {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  font-size: 11px;
  font-weight: 500;
  color: var(--on-ink);
  animation: ui-as-pop 220ms var(--ease);
}

/* Popovers: attached to their trigger, they fade and scale in from that side */
.ui-as-anchor { position: relative; display: inline-flex; }
/* The Filter Menu at its own size – 13px rows like every other menu, no shrinking */
.ui-as-popover--filter .ui-fmc { width: 300px; }
.ui-as-popover--filter .ui-fmc__title { font-size: 13px; line-height: 20px; }

.ui-as-menu {
  min-width: 168px;
  padding: 4px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--aui-overlay, var(--card));
  box-shadow: var(--aui-shadow-popover, 0 0 0 0.5px var(--line-strong), 0 12px 32px -8px rgba(0, 0, 0, 0.16));
}
.ui-as-menu__title { display: block; padding: 6px 10px 4px; font-size: 12px; font-weight: 500; color: var(--faint); }
.ui-as-menu__list { display: grid; gap: 1px; }
.ui-as-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 13px;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}
.ui-as-menu__item[data-rich] { min-height: 44px; padding: 6px 10px; }
.ui-as-menu__item > svg { flex: none; color: var(--muted); }
.ui-as-menu__logo { display: grid; flex: none; place-items: center; width: 16px; height: 16px; }
.ui-as-menu__logo > svg { width: 14px; height: 14px; }
/* A flag: a small rounded rectangle with a hairline, so white stripes don't melt into the menu */
.ui-as-flag, .ui-as-menu__logo > .ui-as-flag { flex: none; width: 16px; height: 11px; overflow: hidden; border-radius: 2.5px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.14); }
/* In the library's Dropdown Menu, whose logo slot draws marks square: a flag keeps its 16 × 11 */
.ui-dmc__icon[data-logo] > svg.ui-as-flag { width: 16px; height: 11px; }
.ui-as-menu__item > svg:last-child:not(:first-child) { margin-left: auto; color: var(--ink); }
.ui-as-menu__label { display: grid; flex: 1; gap: 1px; min-width: 0; }
.ui-as-menu__label small { font-size: 12px; line-height: 16px; color: var(--faint); }
/* Long names in menus stay on one line – the full name on hover */
.ui-as-menu__text, .ui-as-menu__label small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-menu__item > svg { flex: none; }
.ui-as-menu__empty { display: block; padding: 6px 8px; font-size: 13px; color: var(--faint); }
.ui-as-menu__item:hover { background: var(--hover); color: var(--ink); }
.ui-as-menu__item[aria-checked="true"] { color: var(--ink); font-weight: 500; }
.ui-as-menu__item[aria-checked="true"] small { font-weight: 400; }
.ui-as-menu__item[data-danger] { color: var(--aui-red, #f04438); }
/* Shortcuts, dividers and menus that open to the side */
.ui-as-menu__kbd { flex: none; margin-left: auto; padding-left: 16px; font: inherit; font-size: 12px; letter-spacing: 0.04em; color: var(--faint); }
.ui-as-menu__item > .ui-as-menu__kbd + svg { margin-left: 8px; }
.ui-as-menu__sep { display: block; height: 1px; margin: 4px 6px; background: var(--line); }
.ui-as-menu__sub { position: relative; display: block; }
.ui-as-menu__item > svg:last-child:not(:first-child):is(.ui-as-menu__sub svg) { color: var(--faint); }
.ui-as-menu__subpanel {
  position: absolute;
  z-index: 1;
  top: -4px;
  left: calc(100% + 4px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 120ms ease, visibility 0s 120ms;
}
/* A bridge over the gap, so moving the pointer across doesn't close it */
.ui-as-menu__subpanel::before { content: ""; position: absolute; top: 0; bottom: 0; left: -8px; width: 8px; }
.ui-as-menu__sub:is(:hover, :focus-within, [data-open]) > .ui-as-menu__subpanel { visibility: visible; opacity: 1; transition: opacity 120ms ease; }
.ui-as-menu__sub:is(:hover, :focus-within, [data-open]) > .ui-as-menu__item { background: var(--hover); color: var(--ink); }
.ui-as-menu__item[data-danger] > svg { color: var(--aui-red, #f04438); }

.ui-as-toast {
  max-width: calc(100% - 32px);
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  background: var(--ink);
  font-size: 13px;
  color: var(--on-ink);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.35);
  translate: -50% 0;
  animation: ui-as-toast 2200ms var(--ease) both;
}

/* Shared motion: content that changes (tabs, filters, new messages) rises in; --i staggers a list */
.ui-as-rise { animation: ui-as-rise 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
/* The rise makes each row a layer of its own – a row with an open menu lifts above the rows after it */
.ui-as-rise:has(.ui-as-popover) { position: relative; z-index: 10; }
@keyframes ui-as-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ui-as-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes ui-as-toast {
  0% { opacity: 0; transform: translateY(12px) scale(0.96); }
  12%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(6px); }
}
@media (prefers-reduced-motion: reduce) {
  /* One 1ms run – a looping pulse (a live dot, a listening mic) doesn't turn into a flicker */
  .ui-as *, .ui-as *::before, .ui-as *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
/* Rows in scrolling lists and menus: the focus ring sits inside the row, so the list's edge doesn't cut it off */
.ui-as :is(.ui-as-side__nav, .ui-as-menu, .ui-as-panel__body) :is(button, [href], [tabindex]):focus-visible { outline-offset: -2px; }
/* Keyboard focus on a menu item shows like the pointer's hover */
.ui-as-menu__item:focus-visible { background: var(--hover); color: var(--ink); }

/* Touch screens: no hover – the row tools stay in view (just ⋯; pinning is in its menu), and targets grow to a finger's size */
@media (hover: none) {
  .ui-as-chat-row__tools, .ui-as-chat-folder-row .ui-as-chat-row__tools { opacity: 1; }
  .ui-as-chat-row__pin { display: none; }
  .ui-as-chat-row .ui-as-chat-row__link, .ui-as-chat-folder-row > .ui-as-chat-folder { padding-right: 34px; }
  .ui-as-chat-row:is(:hover, :has(:focus-visible), [data-menu]) .ui-as-chat-row__link,
  .ui-as-chat-folder-row:is(:hover, :has(:focus-visible), [data-menu]) > .ui-as-chat-folder { padding-right: 34px; }
  .ui-as-chat-row__tool { color: var(--faint); }
}
@media (pointer: coarse) {
  /* Rows grow to a finger's height; small icon buttons keep their look and get an invisible ring that takes the tap */
  .ui-as-side__item, .ui-as-side__search, .ui-as-side__workspace, .ui-as-side__back, .ui-as-chat-row__rename { height: 36px; }
  .ui-as-chat-row__tools { top: 6px; }
  .ui-as-user { height: 40px; }
  .ui-as-menu__item { min-height: 40px; }
  :is(.ui-as-chat-row__tool, .ui-as-news__close, .ui-as-tool, .ui-asw__more, .ui-as-bar__pick) { position: relative; }
  .ui-as-icon-btn:not(.ui-as-side-open, .ui-as-panel-open) { position: relative; }
  :is(.ui-as-icon-btn, .ui-as-chat-row__tool, .ui-as-tool, .ui-as-view__btn, .ui-as-tabs__tab, .ui-asw__more)::after { content: ""; position: absolute; inset: -4px; }
  .ui-as-news__close::after { content: ""; position: absolute; inset: -7px; }
}

/* Empty state in a dashed drop area */

/* The library's Empty State, Skeleton and Spinner in the shell's own colors */
.ui-as .ui-as-empty {
  --ui-estc-title: var(--strong);
  --ui-estc-text: var(--muted);
  --ui-estc-icon: var(--muted);
  --ui-estc-tile: var(--chip);
  --ui-estc-frame: var(--frame);
  --ui-estc-line: var(--line);
}
/* div. – above the item (which has no margin), below a screen's own rule (e.g. margin-top: 0 in a grid) */
div.ui-as-empty { margin-top: 16px; }
div.ui-as-empty:where([data-bare]) { margin-top: 0; }
.ui-as .ui-as-skel { --ui-sklc-fill: var(--chip-hover); }
.ui-as-art-skel { display: flex; flex-direction: column; gap: 20px; padding: 14px 16px; }
.ui-as-art-skel__head { display: flex; align-items: center; gap: 10px; }
.ui-as-art-skel__name { display: flex; flex-direction: column; gap: 6px; }
.ui-as-art-skel__body { display: flex; flex-direction: column; gap: 12px; }
.ui-as-art-skel__gap { height: 4px; }

/* Glass Folder from the library at icon size; hovering the whole card or row opens it like hovering the folder itself */
.ui-as-folder-card__icon, .ui-as-folder-head__icon {
  position: relative;
  flex: none;
  width: 30px;
  height: 25px;
}
.ui-as-folder-card__icon .ui-fd, .ui-as-folder-head__icon .ui-fd {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 75px;
  translate: -50% -50%;
}
:is(.ui-as-folder-card, .ui-as-folder-head):hover .ui-fd-icon { transform: translate(-50%, -48%) scale(1.03); }
:is(.ui-as-folder-card, .ui-as-folder-head):hover .ui-fd-doc--left { transform: translate(32px, 70px) rotate(9deg); }
:is(.ui-as-folder-card, .ui-as-folder-head):hover .ui-fd-doc--right { transform: translate(286px, 76px) rotate(5deg); }
:is(.ui-as-folder-card, .ui-as-folder-head):hover .ui-fd-doc--middle { transform: translate(166px, 52px) rotate(-7deg); }
:is(.ui-as-folder-card, .ui-as-folder-head):hover .ui-fd-front {
  top: 24.8%;
  border-radius: 3cqw 3cqw 6.333cqw 6.333cqw;
  transform: translateZ(2.33cqw) rotateX(-9deg);
}

.ui-as-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-as-meta svg { color: var(--faint); }
.ui-as-toast > svg { flex: none; }
.ui-as-toast__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }


/* File card – used for templates and for the files inside a folder */
.ui-as-template { display: grid; grid-template-columns: minmax(0, 1fr); width: 239px; text-align: left; }
.ui-as-template__preview {
  display: block;
  height: 152px;
  padding: 3px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--frame);
  box-shadow: inset 0 0 0 0.5px var(--line);
  transition: box-shadow 160ms ease;
}
.ui-as-template__preview .ui-as-doc { box-shadow: var(--card-shadow); }
.ui-as-template:hover .ui-as-template__preview { box-shadow: inset 0 0 0 0.5px var(--line-strong); }
/* One line at every width – the full name on hover */
.ui-as-template__name { margin-top: 8px; overflow: hidden; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); white-space: nowrap; text-overflow: ellipsis; }
.ui-as-template .ui-as-meta { margin-top: 0; }

/* File illustration: a small white page with hairline rows, a colored type tag over its lower left corner */
.ui-as-doc {
  --doc-tag: var(--aui-blue, #4fb0fe);
  --doc-tag-shade: 30, 64, 175;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--card);
}
.ui-as-doc[data-color="rose"] { --doc-tag: var(--aui-red, #f04438); --doc-tag-shade: 159, 18, 57; }
.ui-as-doc[data-color="emerald"] { --doc-tag: var(--aui-teal, #13b3a0); --doc-tag-shade: 6, 95, 70; }
/* Moved right by what the tag adds on the left, so the drawing sits in the middle */
.ui-as-doc__art { position: relative; display: block; width: 52px; translate: 4px 0; }

/* The page: white with a hairline ring and a soft shadow; the top right corner is cut (rounded where cuts aren't supported) */
.ui-as-doc__page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* The lower room the closing stroke had stays, so the page keeps its height */
  padding: 10px 10px 22px;
  border-radius: 5px 9px 5px 5px;
  corner-top-right-shape: bevel;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line-strong), 0 4px 8px -2px rgba(0, 0, 0, 0.065), 0 2px 3px -2px rgba(0, 0, 0, 0.065);
  transition: transform 420ms var(--ease);
}
.ui-as-doc__rows { display: flex; flex-direction: column; gap: 5px; }
.ui-as-doc__row { display: flex; gap: 3px; }
.ui-as-doc__row i { display: block; height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
/* A spreadsheet's first row is its header */
.ui-as-doc__page[data-type="XLS"] .ui-as-doc__row:first-child i { background: color-mix(in srgb, var(--ink) 22%, transparent); }
.ui-as-doc__image { display: block; height: 14px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
/* The type tag overlaps the page's lower left corner; the box is trimmed to the capitals, so they sit in its
   exact middle (a slightly deeper top padding stands in where trimming isn't supported) */
.ui-as-doc__type {
  position: absolute;
  left: -8px;
  bottom: 11px;
  z-index: 2;
  display: block;
  padding: 3.5px 4px 2.5px;
  border-radius: 3px;
  background: var(--doc-tag);
  box-shadow: 0 4px 8px -3px rgba(var(--doc-tag-shade), 0.3);
  font-size: 9px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  transition: transform 420ms var(--ease);
}
@supports (text-box: trim-both cap alphabetic) {
  .ui-as-doc__type { padding: 3.5px 4px; text-box: trim-both cap alphabetic; }
}
.ui-as-template:hover .ui-as-doc__page { transform: translateY(-2px); }
.ui-as-template:hover .ui-as-doc__type { transform: translate(-1px, -3px); }

/* Workspace initial and user initials */
.ui-as-side__logo { font-size: 10.5px; font-weight: 500; color: var(--ink); }
.ui-as-user__initials {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--accent);
}

/* Scrim behind the drawer – only used on narrow screens */
.ui-as-scrim { display: none; }

/* ---------- Resizing ---------- */

/* A 12px strip centred on the main area's edge; on hover a darker line runs along the page's edge, fading to nothing
   at both ends – so it meets the rounded corners of the inset panel softly */
.ui-as-resizer {
  position: absolute;
  z-index: 15;
  top: calc(var(--bar-h, 0px) + var(--frame-gap));
  bottom: var(--frame-gap);
  width: 12px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.ui-as-resizer[data-edge="left"] { left: calc(var(--side-w, 272px) - 6px); }
/* Centred on the work area's left edge – inset it sits half a gap off the page, flat it touches it */
.ui-as-resizer[data-edge="right"] { right: calc(var(--panel-w, 360px) - var(--frame-gap) / 2 - 6px); }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-resizer[data-edge="right"] { right: calc(var(--panel-w, 360px) - 6px); }
.ui-as-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--edge-active) 22%, var(--edge-active) 78%, transparent);
  opacity: 0;
  transition: opacity 180ms ease;
}
/* Exactly on a border: the page's left edge on the left, the work area's left edge on the right */
.ui-as-resizer[data-edge="left"]::after { left: 6px; }
.ui-as-resizer[data-edge="right"]::after { left: 6px; }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-resizer[data-edge="right"]::after { left: 5px; }
.ui-as-resizer:hover::after { opacity: 1; transition-delay: 100ms; }
.ui-as-resizer:focus-visible::after, .ui-as-resizer[data-dragging]::after { opacity: 1; transition-delay: 0ms; }

/* ---------- Work area on the right ---------- */

/* Sits on the gray page like the sidebar, mirrored; the main area gives up its right gap to it */
.ui-as-app[data-panel] > .ui-as-main { grid-column: 2; }
.ui-as-app[data-panel="open"] > .ui-as-main { margin-right: 0; }
/* Inset: the work area is a rounded white panel of its own, like the main area */
.ui-as-panel {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  /* Half the gap towards the main area, the full one to the window's edges */
  width: calc(var(--panel-w, 360px) - 1.5 * var(--frame-gap));
  min-height: 0;
  margin: var(--frame-gap) var(--frame-gap) var(--frame-gap) calc(var(--frame-gap) / 2);
  padding: 10px 10px 10px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  transition: opacity 260ms ease, translate 420ms var(--ease), visibility 0s;
}
.ui-as-app[data-panel="closed"] > .ui-as-panel {
  visibility: hidden;
  opacity: 0;
  translate: 16px 0;
  transition: opacity 200ms ease, translate 420ms var(--ease), visibility 0s 420ms;
}
.ui-as-panel__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding-left: 6px;
}
.ui-as-panel__title { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
/* A plain text heading needs a block box for its … */
.ui-as-panel__title:not(:has(> *)) { display: block; }
.ui-as-panel__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -2px; padding: 12px 2px 4px; }

/* Its icon waits in the top right corner of the main area while it's closed */
.ui-as-panel-open {
  position: fixed;
  z-index: 20;
  top: calc(var(--frame-gap) + var(--as-head-edge) + (var(--as-head-h) - 28px) / 2);
  right: calc(var(--frame-gap) + 9px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 200ms ease, visibility 0s 200ms;
}
.ui-as-app[data-panel="closed"] > .ui-as-panel-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 260ms ease 160ms, visibility 0s;
}

/* ---------- Header across the app ---------- */

/* One bar over everything: a row of its own on top, split into the sidebar's, the page's and the work area's part */
.ui-as-app[data-header] { --bar-h: var(--as-head-h); grid-template-rows: var(--bar-h) minmax(0, 1fr); }
.ui-as-app[data-header] > .ui-as-bar--side { grid-area: 1 / 1; }
.ui-as-app[data-header] > .ui-as-bar--main { grid-area: 1 / 2; }
.ui-as-app[data-header] > .ui-as-bar--panel { grid-area: 1 / 3; }
.ui-as-app[data-header] > .ui-as-side { grid-area: 2 / 1; }
.ui-as-app[data-header] > .ui-as-main { grid-area: 2 / 2; margin-top: 0; }
.ui-as-app[data-header] > .ui-as-panel { grid-area: 2 / 3; }
.ui-as-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: var(--bar-h);
  overflow: hidden;
  transition: padding 420ms var(--ease), opacity 260ms ease;
}
.ui-as-bar--side { padding: 0 10px; }
.ui-as-bar--side > :last-child { margin-left: auto; }
.ui-as-bar--side > .ui-as-anchor { display: flex; min-width: 0; }
.ui-as-app[data-header] > .ui-as-side > .ui-as-side__search { margin-top: 0; }
.ui-as-bar--main { justify-content: space-between; gap: 12px; padding: 0 12px 0 18px; }
.ui-as-bar--panel { justify-content: space-between; padding: 0 10px 0 16px; }
.ui-as-bar__title { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.ui-as-bar__title > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-as-bar__actions { display: flex; flex: none; align-items: center; gap: 2px; }
.ui-as-bar__pick { display: flex; align-items: center; gap: 6px; min-width: 0; height: 30px; margin-left: -8px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); color: var(--ink); }
.ui-as-bar__pick > span { overflow: hidden; text-overflow: ellipsis; }
.ui-as-bar__pick svg { color: var(--faint); }
.ui-as-bar__pick:hover { background: var(--hover); }
/* The sidebar's head – workspace and collapse – moves into the bar; the search field leads the sidebar */
.ui-as-app[data-header] > .ui-as-side > .ui-as-side__head,
.ui-as-app[data-header] > .ui-as-panel > .ui-as-panel__head { display: none; }
.ui-as-app[data-header] > .ui-as-panel > .ui-as-panel__body { padding-top: 2px; }
/* Folded away: the work area's part of the bar goes with it */
.ui-as-app[data-header][data-panel="closed"] > .ui-as-bar--panel { opacity: 0; }
.ui-as-app[data-header][data-panel="closed"] > .ui-as-bar--main { padding-right: 50px; }
.ui-as-app[data-header] > :is(.ui-as-side-open, .ui-as-panel-open) { top: calc((var(--bar-h) - 28px) / 2); }

/* A page that is just one centred block, e.g. an empty state */
.ui-as-center { display: grid; place-items: center; min-height: 100%; padding: 48px 32px; }

/* ---------- Double sidebar (rail), like Codex and ChatGPT ---------- */
/* A column of icons on the gray page, and the chats in a light gray column inside the main area, split by a line */
.ui-as-app[data-rail] { --rail-w: 52px; --side-col: calc(var(--rail-w) + var(--side-w, 272px)); }
.ui-as-app[data-rail] > .ui-as-side { flex-direction: row; width: 100%; padding: 0; overflow: hidden; }
.ui-as-app[data-rail] > .ui-as-resizer[data-edge="left"] { left: calc(var(--rail-w) + var(--side-w, 272px) - 6px); }
.ui-as-rail { display: flex; flex: none; flex-direction: column; align-items: center; gap: 2px; width: var(--rail-w); min-height: 0; padding: calc(var(--frame-gap) + 4px) 0 calc(var(--frame-gap) + 2px); overflow-y: auto; scrollbar-width: none; }
/* Many icons in a short window: the column scrolls, the account stays reachable at its end */
.ui-as-rail::-webkit-scrollbar { display: none; }
.ui-as-rail > .ui-as-anchor { display: flex; }
.ui-as-rail__logo { display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 4px; border-radius: 9px; background: var(--panel); box-shadow: 0 0 0 0.5px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.05); font-size: 12px; font-weight: 600; color: var(--ink); transition: box-shadow 140ms ease; }
.ui-as-rail__logo:hover { box-shadow: 0 0 0 0.5px var(--line-strong), 0 2px 6px -2px rgba(0, 0, 0, 0.14); }
.ui-as-rail__item { position: relative; display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: calc(var(--aui-radius-sm, 5px) + 4px); color: var(--muted); transition: background-color 120ms ease, color 120ms ease; }
.ui-as-rail__item:hover { background: var(--hover); color: var(--ink); }
.ui-as-rail__item[aria-current="page"] { background: var(--select); color: var(--ink); }
.ui-as-rail__dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--page); }
.ui-as-rail__line { flex: none; width: 18px; height: 1px; margin: 6px 0; background: var(--line); }
.ui-as-rail__spacer { flex: 1; }
.ui-as-rail .ui-as-rail__account > .ui-as-user { flex: none; justify-content: center; width: 34px; height: 34px; padding: 0; }
.ui-as-rail .ui-as-rail__account > .ui-as-user > svg, .ui-as-rail .ui-as-rail__account .ui-as-user__name { display: none; }
.ui-as-rail .ui-as-rail__account > .ui-as-user > :is(img, .ui-as-user__initials) { width: 24px; height: 24px; }
.ui-as-user-menu.ui-as-rail__account .ui-as-menu { width: 244px; }
/* The chats: the main area's left part – between the gray page and the white page in tone, a line on their right */
.ui-as-side__col {
  display: flex;
  flex: none;
  flex-direction: column;
  width: var(--side-w, 272px);
  min-height: 0;
  margin: var(--frame-gap) 0;
  padding: 10px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel) 0 0 var(--radius-panel);
  background: var(--side-tint);
}
.ui-as-app[data-rail] > .ui-as-main { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ui-as-side__col > .ui-as-side__nav { margin-top: 12px; }
.ui-as-project-menu .ui-as-menu { min-width: 220px; }

/* ---------- Narrow: tablet and phone ---------- */
/* Container queries on the app itself, so a scaled 1440 px preview keeps the desktop layout */

@container ui-as (max-width: 900px) {
  /* The main panel takes the whole width; the sidebar slides in over it as a drawer */
  .ui-as-app > .ui-as-main { grid-row: 1; grid-column: 1 / -1; margin-left: var(--frame-gap); }
  .ui-as-app > .ui-as-side {
    position: absolute;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(264px, calc(100% - 56px));
    padding: 10px 10px 10px 12px;
    border-radius: 0 calc(var(--aui-radius-lg, 10px) + 8px) calc(var(--aui-radius-lg, 10px) + 8px) 0;
    background: var(--page);
    box-shadow: 0 0 0 0.5px var(--line-strong), 0 24px 48px -12px rgba(0, 0, 0, 0.28);
  }
  .ui-as-app:not([data-drawer]) > .ui-as-side {
    visibility: hidden;
    translate: calc(-100% - 24px) 0;
    transition: translate 380ms var(--ease), visibility 0s 380ms;
  }
  .ui-as-app[data-drawer] > .ui-as-side {
    visibility: visible;
    opacity: 1;
    translate: 0 0;
    transition: translate 420ms var(--ease), visibility 0s;
  }
  /* The work area on the right becomes a drawer too, sliding in from the right */
  .ui-as-app[data-panel] { --panel-col: 0px; }
  .ui-as-app[data-panel] > .ui-as-main { grid-column: 1 / -1; margin-right: var(--frame-gap); }
  .ui-as-app > .ui-as-panel {
    /* Out of the grid: absolutely placed against the whole app, not the zero-width column it sits in on wide screens */
    grid-area: auto;
    position: absolute;
    z-index: 50;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, calc(100% - 56px));
    margin: 0;
    padding: 10px 12px 10px 12px;
    border: 0;
    border-radius: calc(var(--aui-radius-lg, 10px) + 8px) 0 0 calc(var(--aui-radius-lg, 10px) + 8px);
    background: var(--panel);
    box-shadow: 0 0 0 0.5px var(--line-strong), 0 24px 48px -12px rgba(0, 0, 0, 0.28);
  }
  .ui-as-app[data-panel="closed"] > .ui-as-panel {
    translate: calc(100% + 24px) 0;
    transition: translate 380ms var(--ease), visibility 0s 380ms;
  }
  .ui-as-app[data-panel="open"] > .ui-as-panel { visibility: visible; opacity: 1; translate: 0 0; transition: translate 420ms var(--ease), visibility 0s; }
  .ui-as-app[data-panel="open"] > .ui-as-scrim { visibility: visible; opacity: 1; transition: opacity 300ms ease, visibility 0s; }
  .ui-as-app > .ui-as-panel-open { right: calc(var(--frame-gap) + 9px); background: var(--panel); }
  .ui-as-app > .ui-as-panel-open:hover { background: var(--chip); }
  /* With the header: the page's part spans the bar; the sidebar's and work area's parts go into their drawers */
  .ui-as-app[data-header] > .ui-as-main { grid-area: 2 / 1 / 3 / -1; }
  .ui-as-app[data-header] > .ui-as-bar--main { grid-area: 1 / 1 / 2 / -1; padding-left: 50px; }
  .ui-as-app[data-header][data-panel] > .ui-as-bar--main { padding-right: 50px; }
  .ui-as-app[data-header] > :is(.ui-as-bar--side, .ui-as-bar--panel) { display: none; }
  /* The drawers cover the full height, over the bar too – not just their grid row */
  .ui-as-app[data-header] > :is(.ui-as-side, .ui-as-panel) { grid-area: auto; }
  .ui-as-app[data-header] > .ui-as-side > .ui-as-side__head { display: flex; }
  .ui-as-app[data-header] > .ui-as-side > .ui-as-side__search { margin-top: 12px; }
  .ui-as-app[data-header] > .ui-as-panel > .ui-as-panel__head { display: flex; }
  .ui-as-app[data-header] > .ui-as-panel > .ui-as-panel__body { padding-top: 12px; }
  .ui-as-app > .ui-as-scrim {
    display: block;
    position: absolute;
    z-index: 45;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    visibility: hidden;
    opacity: 0;
    transition: opacity 300ms ease, visibility 0s 300ms;
  }
  .ui-as-app[data-drawer] > .ui-as-scrim { visibility: visible; opacity: 1; transition: opacity 300ms ease, visibility 0s; }
  :where(.dark, [data-theme="dark"]) .ui-as-app > .ui-as-scrim { background: rgba(0, 0, 0, 0.55); }
  /* The icon to open it always waits in the top left corner of the panel */
  .ui-as-app:not([data-drawer]) > .ui-as-side-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 260ms ease 160ms, visibility 0s;
  }
  /* It stays put while the panel scrolls, so it gets the panel's color behind it */
  .ui-as-app > .ui-as-side-open { left: calc(var(--frame-gap) + 9px); background: var(--panel); }
  .ui-as-app > .ui-as-side-open:hover { background: var(--chip); }

  /* Page parts: less padding, toolbars wrap */
  .ui-as-page { padding: 46px 24px 48px; }
  /* File cards fill the cells of the grids the screens switch to */
  .ui-as-main .ui-as-file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .ui-as-main .ui-as-file-grid .ui-as-template { width: 100%; }
  .ui-as-main .ui-as-file-grid .ui-as-template__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .ui-as-main .ui-as-file-grid .ui-as-meta { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .ui-as-main .ui-as-file-grid .ui-as-meta svg { display: inline-block; vertical-align: -2px; }
  .ui-as-toolbar { flex-wrap: wrap; row-gap: 10px; }
  .ui-as-toolbar__right { flex-wrap: wrap; }
  .ui-as-section-head[data-inline] { flex-wrap: wrap; row-gap: 12px; }
}

@container ui-as (max-width: 600px) {
  .ui-as-app > * { --frame-gap: 6px; }
  /* No room for a submenu beside its menu on a phone: it opens in place, under its item */
  .ui-as-menu__subpanel { position: static; display: none; min-width: 0 !important; margin: 2px 0 4px; padding: 0 0 0 14px; border-radius: 0; background: none; box-shadow: none; }
  .ui-as-menu__subpanel::before { display: none; }
  .ui-as-menu__sub:is(:focus-within, [data-open]) > .ui-as-menu__subpanel { display: block; }
  .ui-as-menu__sub:is(:focus-within, [data-open]) > .ui-as-menu__item > svg:last-child { transform: rotate(90deg); }
  /* A short screen keeps the sidebar for its lists: What's new waits for a wider one */
  .ui-as-news { display: none; }
  .ui-as-app > .ui-as-main { border-radius: calc(var(--aui-radius-lg, 10px) + 1px); }
  .ui-as-page { padding: 52px 16px 40px; }
  .ui-as-page-title { font-size: 20px; line-height: 26px; }
  .ui-as-section-head { margin-top: 32px; }
  /* Toolbars: tabs on their own line, the tools below; search takes what is left */
  .ui-as-toolbar__left, .ui-as-toolbar__right { width: 100%; }
  .ui-as-toolbar__right .ui-as-search { order: 9; flex: 1 1 100%; width: auto !important; }
  .ui-as-toolbar__right > .ui-buttonc:last-child { margin-left: auto; }
  .ui-as-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .ui-as-tabs__tab { flex: none; }
  /* div. – above the item's own padding, below a screen's own rule (e.g. Folder's) */
  div.ui-as-empty { padding: 36px 18px 40px; }
  .ui-as-popover--filter .ui-fmc { width: 300px; }
  .ui-as-main .ui-as-file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
  .ui-as-main .ui-as-file-grid .ui-as-template__preview { height: 128px; }
}

/* ----- Flat: no panel – the page runs edge to edge next to the sidebar, split by a hairline ----- */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) { --frame-gap: 0px; --as-head-edge: 0px; }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > * { --frame-gap: 0px; --as-head-edge: 0px; }

/* Main area: no panel – it fills the rest of the app, a hairline on its left is the only edge */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-main {
  margin: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}
/* Sidebar collapsed: nothing is left to divide */


/* Work area on the right: flat too – a hairline on the main area's right is its edge */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-panel="open"] > .ui-as-main { border-right: 1px solid var(--line); }
/* …and the same white as the main area – no frame of its own */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-panel { width: var(--panel-w, 360px); margin: 0; padding: 10px 10px 10px 10px; border: 0; border-radius: 0; background: var(--panel); }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-panel-open { right: 12px; }

/* Header across the app: the page's and the work area's parts are white like the page, the sidebar's stays gray; no line under it –
   only the page's side lines run on up through the bar */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-header] > .ui-as-bar--main { background: var(--panel); border-left: 1px solid var(--line); transition: padding 420ms var(--ease), border-color 260ms ease; }

.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-header][data-panel="open"] > .ui-as-bar--main { border-right: 1px solid var(--line); }
/* The work area's part of the bar is white like the page's – only the sidebar's part stays gray */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-header] > .ui-as-bar--panel { background: var(--panel); }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-header] > .ui-as-side { padding-top: 2px; }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-header] > .ui-as-panel { padding-top: 12px; }

/* The sidebar's rows line up with a page's 46px title on top */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-side { padding: 10px 10px 10px 10px; }

/* The icon that brings the sidebar back sits where the collapse icon was */
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-side-open { left: 12px; }

@container ui-as (max-width: 900px) {
  /* Narrow: the main area is the whole app; the drawer slides in flat with a hairline edge */
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-main { margin: 0; border-left: 0; }
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-side {
    border-radius: 0;
    box-shadow: 1px 0 0 var(--line), 0 24px 48px -12px rgba(0, 0, 0, 0.22);
  }
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-side-open { left: 12px; }
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-panel] > .ui-as-main { margin: 0; border-right: 0; }
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-panel {
    border-radius: 0;
    box-shadow: -1px 0 0 var(--line), 0 24px 48px -12px rgba(0, 0, 0, 0.22);
  }
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-panel-open { right: 12px; }
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"]))[data-header] > .ui-as-bar--main { border-left: 0; border-right: 0; }
}
@container ui-as (max-width: 600px) {
  .ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-main { border-radius: 0; }
}

/* ----- Work area with tabs, like Codex: a white work area extended upward in light gray – the tabs sit on the gray,
   the active one a white pill, and the white sheet below runs to the panel's edges with only its top corners rounded ----- */
.ui-as-app > .ui-as-panel[data-ws] {
  --asw-tray: linear-gradient(rgba(0, 0, 0, 0.012), rgba(0, 0, 0, 0.012)), var(--panel);
  padding: 0;
  background: var(--asw-tray);
}
:where(.dark, [data-theme="dark"]) .ui-as-app > .ui-as-panel[data-ws] { --asw-tray: linear-gradient(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.12)), var(--panel); }
.ui-as-app:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-panel[data-ws] { padding: 0; background: var(--asw-tray); }
.ui-as-app > .ui-as-panel[data-ws] > .ui-as-panel__head { display: flex; height: var(--as-head-h); padding: 0 6px 0 4px; }
/* The white sheet runs to the panel's edges – only its top corners round off under the tabs; it scrolls up and down
   only – wide content like a sheet scrolls sideways inside itself */
.ui-as-app > .ui-as-panel[data-ws] > .ui-as-panel__body { overflow-x: hidden; overscroll-behavior: none; margin: 0; padding: 16px 14px 14px; border-radius: var(--aui-radius-lg, 10px) var(--aui-radius-lg, 10px) 0 0; background: var(--card); box-shadow: 0 -0.5px 0 var(--line), 0 -1px 2px rgba(0, 0, 0, 0.03); }
/* With the header across the app the tabs stand in the bar's row, at the work area's top */
@container ui-as (min-width: 901px) {
  .ui-as-app[data-header] > .ui-as-panel[data-ws] { grid-area: 1 / 3 / 3 / 4; }
}
.ui-asw-bar { display: flex; flex: 0 1 auto; align-items: center; gap: 2px; min-width: 0; }
.ui-asw-ptabs { display: flex; align-items: center; gap: 2px; min-width: 0; padding: 2px; overflow-x: auto; overscroll-behavior: none; scrollbar-width: none; font-weight: 400; }
/* More tabs behind the end: it fades out */
.ui-asw-ptabs[data-more] { mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); }
.ui-asw-ptabs::-webkit-scrollbar { display: none; }
.ui-asw-ptab-wrap { position: relative; display: flex; flex: 0 1 auto; min-width: 92px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); transition: background-color 140ms ease; }
.ui-asw-ptab { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 6px; width: 100%; min-width: 0; max-width: 156px; height: 28px; padding: 0 26px 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-asw-ptab > svg { flex: none; color: var(--muted); }
.ui-asw-ptab-wrap:hover > .ui-asw-ptab { color: var(--ink); }
.ui-asw-ptab-wrap:not([data-on]):hover { background: var(--hover); }
/* The active tab: a white pill on the gray */
.ui-asw-ptab-wrap[data-on] { background: var(--card); box-shadow: var(--card-shadow); }
.ui-asw-ptab-wrap[data-on] > .ui-asw-ptab { color: var(--ink); }
/* A faint vertical line between tabs, like Codex – it steps aside next to the active or hovered tab */
.ui-asw-ptab-wrap + .ui-asw-ptab-wrap::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: -1.5px; width: 1px; background: var(--line-strong); pointer-events: none; transition: opacity 140ms ease; }
.ui-asw-ptab-wrap:is([data-on], :hover)::before, .ui-asw-ptab-wrap:is([data-on], :hover) + .ui-asw-ptab-wrap::before { opacity: 0; }
.ui-asw-ptab:focus-visible { outline-offset: -2px; }
/* A name that doesn't fit fades out at its end instead of an … – the fade sits in its right padding, so a name that
   fits shows whole; the × has 28px of its own on the right, the name and its fade end before it */
.ui-asw-ptab__name { min-width: 0; padding-right: 8px; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, #000 calc(100% - 12px), transparent); }
.ui-asw-ptab__name > * { display: inline; }
.ui-asw-ptab__count { flex: none; margin-left: -6px; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-asw-ptab__close { position: absolute; top: 6px; right: 5px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); color: var(--muted); opacity: 0; transition: opacity 120ms ease, background-color 120ms ease; }
.ui-asw-ptab-wrap:is(:hover, [data-on], :focus-within) > .ui-asw-ptab__close { opacity: 1; }
.ui-asw-ptab__close:hover { background: var(--hover); color: var(--ink); }
/* + at the end: a New tab */
.ui-asw-ptab-new { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-asw-ptab-new:hover { background: var(--hover); color: var(--ink); }
.ui-asw-ptab-new:focus-visible { outline-offset: -2px; }
@media (pointer: coarse) {
  .ui-asw-ptab__close { opacity: 1; }
  .ui-asw-ptab-new { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-asw-ptab-wrap, .ui-asw-ptab, .ui-asw-ptab__close, .ui-asw-ptab-new { transition: none; }
}

/* Narrow: the icons and the chats slide in together as one drawer; the page is a whole panel again */
@container ui-as (max-width: 900px) {
  .ui-as-app[data-rail] > .ui-as-side { width: min(320px, calc(100% - 40px)); padding: 0; }
  .ui-as-app[data-rail] .ui-as-side__col { flex: 1; width: auto; min-width: 0; margin: 0; padding: 10px 10px 10px 4px; border: 0; border-radius: 0; background: none; }
  .ui-as-app[data-rail] > .ui-as-main { border-left: 1px solid var(--line); border-radius: var(--radius-panel); }
}


/* Workspace artifacts: the shared viewers in the work area's tabs – document, sheet, folder, code, image, menus */
.ui-as {
  --asw-out: cubic-bezier(0.23, 1, 0.32, 1);
  --asw-wire-ink: rgba(0, 0, 0, 0.42);
  --asw-wire-mid: rgba(0, 0, 0, 0.16);
  --asw-wire-soft: rgba(0, 0, 0, 0.07);
  --asw-grid: rgba(0, 0, 0, 0.08);
  --asw-rim: rgba(0, 0, 0, 0.025);
  /* Selection in a sheet or a folder – the only place the accent tints anything */
  --asw-sel-bg: rgba(0, 96, 226, 0.07);
  --asw-sel-head: rgba(0, 96, 226, 0.1);
  --asw-err: var(--aui-danger, #c4320a);
  /* File glyphs by type: documents blue, sheets green, code orange, folders amber, images pink */
  --asw-file-doc: var(--aui-blue, #0190fe);
  --asw-file-sheet: var(--aui-green, #5fc88a);
  --asw-file-code: var(--aui-orange, #f28a2e);
  --asw-file-folder: var(--aui-amber, #e8b000);
  --asw-file-image: var(--aui-pink, #ee3e9e);
}
:where(.dark, [data-theme="dark"]) .ui-as {
  --asw-wire-ink: rgba(255, 255, 255, 0.5);
  --asw-wire-mid: rgba(255, 255, 255, 0.2);
  --asw-wire-soft: rgba(255, 255, 255, 0.08);
  --asw-grid: rgba(255, 255, 255, 0.09);
  --asw-rim: rgba(255, 255, 255, 0.03);
  --asw-sel-bg: color-mix(in srgb, var(--aui-blue, #4fb0fe) 13%, transparent);
  --asw-sel-head: color-mix(in srgb, var(--aui-blue, #4fb0fe) 20%, transparent);
  --asw-err: var(--aui-red, #ff6b5f);
  --asw-file-doc: var(--aui-blue, #4fb0fe);
  --asw-file-sheet: var(--aui-green, #7dcf9f);
  --asw-file-code: var(--aui-orange, #f2a15c);
  --asw-file-folder: var(--aui-amber, #e6c24d);
  --asw-file-image: var(--aui-pink, #f06db5);
}
.ui-asw-glyph[data-type] { color: var(--asw-file-doc); }
.ui-asw-glyph[data-type="sheet"] { color: var(--asw-file-sheet); }
.ui-asw-glyph[data-type="code"] { color: var(--asw-file-code); }
.ui-asw-glyph[data-type="folder"] { color: var(--asw-file-folder); }
.ui-asw-glyph[data-type="image"] { color: var(--asw-file-image); }
.ui-asw-num { font-variant-numeric: tabular-nums; }
.ui-asw-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* A tab's content: it fills the white sheet, and nothing in it widens the work area */
.ui-asw-pane { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100%; }
.ui-asw-pane[hidden] { display: none; }
/* Small buttons in the viewers, e.g. the link field's */
.ui-asw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-asw-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-asw-btn--quiet { background: none; box-shadow: none; color: var(--text); }
.ui-asw-btn--quiet:hover { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-asw-btn:active { transform: scale(0.97); }
/* Images as gray blocks */
.ui-asw-wire { display: block; width: 100%; height: auto; }
.ui-asw-wire__frame { fill: var(--card); stroke: none; }
.ui-asw-wire__block[data-tone="ink"] { fill: var(--asw-wire-ink); }
.ui-asw-wire__block[data-tone="mid"] { fill: var(--asw-wire-mid); }
.ui-asw-wire__block[data-tone="soft"] { fill: var(--asw-wire-soft); }
/* Artifacts: soft gray file chips */
.ui-asw-files { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-asw-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 9px 0 7px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 12px; color: var(--ink); transition: background-color 140ms ease; }
.ui-asw-file:hover { background: linear-gradient(var(--hover), var(--hover)), var(--chip); }
.ui-asw-file > svg { flex: none; color: var(--muted); }
.ui-asw-file__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* An opened artifact */
.ui-asw-art { display: flex; flex-direction: column; gap: 16px; padding: 2px 4px 16px; }
.ui-asw-art__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ui-asw-art__glyph { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--chip); color: var(--muted); }
.ui-asw-art__glyph svg { width: 14px; height: 14px; }
.ui-asw-art__title { display: grid; min-width: 0; }
.ui-asw-art__title b { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-asw-art__title span { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-asw-art__title i { font-style: normal; color: var(--faint); }
/* Content sits right on the white sheet – a document as plain text, a sheet edge to edge */
.ui-asw-art__doc { font-size: 13px; line-height: 20px; color: var(--text); }
.ui-asw-art__doc h3 { margin: 0 0 8px; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); }
.ui-asw-art__doc p { margin: 0 0 10px; }
.ui-asw-art__doc ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ui-asw-art__doc li { position: relative; padding-left: 16px; }
.ui-asw-art__doc li::before { content: ""; position: absolute; top: 9px; left: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.ui-asw-art__code { margin: 0; padding: 14px 16px; border-radius: var(--aui-radius-lg, 10px); background: var(--chip); font-family: var(--aui-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; line-height: 19px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.ui-asw-art__image { padding: 16px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-asw-art__image .ui-asw-wire { display: block; width: 100%; height: auto; }
.ui-asw-art__files { display: grid; margin: 0; padding: 0; list-style: none; }
.ui-asw-art__files li { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 13px; color: var(--ink); }
.ui-asw-art__files li + li { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-asw-art__files svg { flex: none; color: var(--muted); }
.ui-asw-art__files span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-asw-art__none { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Artifact toolbars – compact gray tools, groups apart, a hairline under them edge to edge ---------- */
.ui-asw-tb { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 -18px; padding: 0 12px 8px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-asw-tb__group { display: inline-flex; flex: none; align-items: center; gap: 2px; }
.ui-asw-tool-anchor { flex: none; }
.ui-asw-tool { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 4px; min-width: 28px; height: 28px; padding: 0; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 120ms ease, color 120ms ease; }
.ui-asw-tool--menu { gap: 2px; padding: 0 4px 0 6px; }
.ui-asw-tool--menu > svg:last-child { color: var(--faint); }
.ui-asw-tool:hover { background: var(--hover); color: var(--ink); }
.ui-asw-tool:is([aria-pressed="true"], [aria-expanded="true"]) { background: var(--chip); color: var(--ink); }
.ui-asw-tool[aria-disabled] { opacity: 0.35; cursor: default; }
.ui-asw-tool[aria-disabled]:hover { background: none; color: var(--muted); }
.ui-asw-tool:active:not([aria-disabled]) { transform: scale(0.96); }
.ui-asw-tool__text { padding: 0 2px 0 4px; font-size: 13px; color: var(--text); white-space: nowrap; }
/* The tip under a tool: dark, small, kept inside the toolbar's width */
.ui-asw-tip { position: absolute; z-index: 40; left: 0; display: flex; gap: 6px; padding: 3px 7px; border-radius: 6px; background: var(--ink); font-size: 12px; line-height: 16px; color: var(--card); white-space: nowrap; pointer-events: none; animation: ui-asw-fade 120ms ease both; }
.ui-asw-tip kbd { font: inherit; opacity: 0.6; }

/* ---------- Document ---------- */
.ui-asw-dc { display: flex; flex-direction: column; min-width: 0; }
/* The tools stay at the top while the page scrolls under them */
.ui-asw-dc__tools { position: sticky; top: -16px; z-index: 4; padding-top: 4px; margin-top: -4px; background: var(--card); }
.ui-asw-doc { min-height: 220px; padding: 16px 0 12px; font-size: 13px; line-height: 20px; color: var(--text); outline: none; overflow-wrap: anywhere; cursor: text; }
.ui-as .ui-asw-doc:focus-visible { outline: none; }
.ui-asw-doc > :first-child { margin-top: 0; }
.ui-asw-doc :is(h1, h2, h3) { color: var(--ink); font-weight: 500; }
.ui-asw-doc h1 { margin: 0 0 8px; font-size: 18px; line-height: 26px; letter-spacing: -0.15px; }
.ui-asw-doc h2 { margin: 18px 0 6px; font-size: 15px; line-height: 22px; }
.ui-asw-doc h3 { margin: 14px 0 4px; font-size: 13px; line-height: 20px; }
.ui-asw-doc p { margin: 0 0 10px; }
.ui-asw-doc blockquote { margin: 0 0 10px; padding-left: 12px; box-shadow: inset 2px 0 0 var(--line-strong); color: var(--muted); }
/* Bold in the text is 600: the browser's own bold commands read the weight, so 500 wouldn't toggle off */
.ui-asw-doc :is(b, strong) { font-weight: 600; color: var(--ink); }
.ui-asw-doc a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.ui-asw-doc code { padding: 1px 4px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-family: var(--aui-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; color: var(--ink); }
.ui-asw-doc :is(ul, ol) { margin: 0 0 10px; padding-left: 20px; }
.ui-asw-doc :is(ul, ol) :is(ul, ol) { margin: 2px 0 0; }
.ui-asw-doc li { margin: 2px 0; padding-left: 2px; }
.ui-asw-doc li::marker { color: var(--faint); }
/* A checklist: a box in front of each item – click it, or ⌘ Enter; done items go gray */
.ui-asw-doc ul[data-check] { padding-left: 0; list-style: none; }
.ui-asw-doc ul[data-check] > li { position: relative; padding-left: 24px; }
.ui-asw-doc ul[data-check] > li::before { content: ""; position: absolute; top: 3px; left: 1px; width: 14px; height: 14px; border-radius: 4px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong), 0 0.5px 1px rgba(0, 0, 0, 0.06); cursor: pointer; transition: background-color 120ms ease, box-shadow 120ms ease; }
.ui-asw-doc ul[data-check] > li[data-done]::before { background: var(--ink); box-shadow: none; }
.ui-asw-doc ul[data-check] > li[data-done]::after { content: ""; position: absolute; top: 6px; left: 6px; width: 3.5px; height: 6.5px; border: solid var(--card); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
.ui-asw-doc ul[data-check] > li[data-done] { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.ui-asw-doc--still { min-height: 0; padding: 0; cursor: auto; }
.ui-asw-dc__foot { margin: 0 -18px; padding: 8px 18px 0; font-size: 12px; line-height: 16px; color: var(--faint); box-shadow: inset 0 0.5px 0 var(--line); }
.ui-asw-dc__foot i { font-style: normal; }
/* The link field */
.ui-asw-linkpop { width: min(280px, 80vw); padding: 6px; border-radius: var(--aui-radius-lg, 10px); background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, 0 0 0 0.5px var(--line-strong), 0 12px 32px -8px rgba(0, 0, 0, 0.16)); }
.ui-asw-linkpop form { display: flex; align-items: center; gap: 6px; }
.ui-asw-linkpop input { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 0; border-radius: calc(var(--aui-radius, 7px) - 1px); background: none; box-shadow: inset 0 0 0 0.5px var(--line-strong); font: inherit; font-size: 13px; color: var(--ink); outline: none; }
.ui-asw-linkpop input::placeholder { color: var(--placeholder); }
/* Typing in a field: no ring – the caret shows where you are, the edge only firms up a little */
.ui-asw-linkpop input:is(:focus, :focus-visible) { outline: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.ui-asw-linkpop .ui-asw-btn { flex: none; }

/* ---------- Sheet ---------- */
.ui-asw-sh { display: flex; flex-direction: column; min-width: 0; }
/* The name box, fx and the formula bar – one hairline field */
.ui-asw-sh__bar { display: grid; grid-template-columns: 64px 22px minmax(0, 1fr); align-items: center; height: 28px; margin: 10px 0; border-radius: calc(var(--aui-radius, 7px) - 1px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 12px; transition: box-shadow 120ms ease; }
.ui-asw-sh__bar:focus-within { box-shadow: inset 0 0 0 1px var(--line-strong); }
.ui-asw-sh__bar input { min-width: 0; height: 100%; padding: 0 8px; border: 0; background: none; font: inherit; color: var(--ink); outline: none; }
.ui-asw-sh__ref { box-shadow: inset -0.5px 0 0 var(--line-strong); text-align: center; }
.ui-asw-sh__fx { font-size: 12px; font-style: italic; text-align: center; color: var(--faint); }
.ui-asw-sh__formula { padding-left: 2px !important; }
/* The grid edge to edge – it scrolls sideways inside itself, never the panel */
.ui-asw-sh__wrap { position: relative; margin: 0 -18px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: none; background: var(--card); scrollbar-width: thin; }
.ui-asw-sh__grid { table-layout: fixed; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; outline: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ui-as .ui-asw-sh__grid:focus-visible { outline: none; }
.ui-asw-sh__grid :is(th, td) { box-sizing: border-box; height: 26px; padding: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: clip; text-align: left; box-shadow: inset -0.5px -0.5px 0 var(--asw-grid); }
.ui-asw-sh__cell { position: relative; color: var(--ink); cursor: cell; }
.ui-asw-sh__cell[data-num] { text-align: right; }
.ui-asw-sh__cell[data-bold] { font-weight: 500; }
.ui-asw-sh__cell[data-err] { color: var(--asw-err); text-align: center; }
.ui-asw-sh__cell[data-sel] { background: var(--asw-sel-bg); }
/* Letters and numbers: a faint gray rim, centered – the selected ones tint */
.ui-asw-sh__grid :is(.ui-asw-sh__corner, .ui-asw-sh__col, .ui-asw-sh__row) { padding: 0; background: var(--asw-rim); font-size: 11px; font-weight: 400; text-align: center; color: var(--faint); cursor: default; transition: background-color 80ms ease, color 80ms ease; }
.ui-asw-sh__grid :is(.ui-asw-sh__col, .ui-asw-sh__corner) { position: relative; height: 22px; overflow: visible; box-shadow: inset -0.5px -0.5px 0 var(--asw-grid), inset 0 0.5px 0 var(--asw-grid); }
.ui-asw-sh__grid :is(.ui-asw-sh__row, .ui-asw-sh__corner) { position: sticky; left: 0; z-index: 2; background: linear-gradient(var(--asw-rim), var(--asw-rim)), var(--card); }
.ui-asw-sh__grid .ui-asw-sh__col[data-on] { background: var(--asw-sel-head); color: var(--ink); }
.ui-asw-sh__grid .ui-asw-sh__row[data-on] { background: linear-gradient(var(--asw-sel-head), var(--asw-sel-head)), var(--card); color: var(--ink); }
.ui-asw-sh__grid .ui-asw-sh__pad { padding: 0; box-shadow: inset 0 -0.5px 0 var(--asw-grid); }
.ui-asw-sh__grid thead .ui-asw-sh__pad { background: var(--asw-rim); box-shadow: inset 0 -0.5px 0 var(--asw-grid), inset 0 0.5px 0 var(--asw-grid); }
/* A column's right edge: drag it, or double-click to fit */
.ui-asw-sh__resize { position: absolute; top: 0; right: -4px; z-index: 3; width: 8px; height: 100%; cursor: col-resize; touch-action: none; }
.ui-asw-sh__resize::after { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3.25px; width: 1.5px; border-radius: 1px; background: var(--accent); opacity: 0; transition: opacity 120ms ease; }
.ui-asw-sh__resize:hover::after { opacity: 1; }
/* The selection's ring with the fill handle – gray while the sheet doesn't have the focus */
.ui-asw-sh__ring { position: absolute; z-index: 1; box-sizing: border-box; box-shadow: inset 0 0 0 2px var(--muted); pointer-events: none; }
.ui-asw-sh:focus-within .ui-asw-sh__ring { box-shadow: inset 0 0 0 2px var(--accent); }
/* A range: a thin ring around it all, the first cell keeps the strong one */
.ui-asw-sh__ring[data-range], .ui-asw-sh:focus-within .ui-asw-sh__ring[data-range] { box-shadow: inset 0 0 0 1px var(--muted); }
.ui-asw-sh:focus-within .ui-asw-sh__ring[data-range] { box-shadow: inset 0 0 0 1px var(--accent); }
.ui-asw-sh__handle { position: absolute; right: -3px; bottom: -3px; width: 6px; height: 6px; background: var(--muted); box-shadow: 0 0 0 1px var(--card); pointer-events: auto; cursor: crosshair; touch-action: none; }
.ui-asw-sh:focus-within .ui-asw-sh__handle { background: var(--accent); }
.ui-asw-sh__fill { position: absolute; z-index: 1; outline: 1px dashed var(--muted); outline-offset: -1px; pointer-events: none; }
/* Writing in a cell: the field sits on it and grows with what you type */
.ui-asw-sh__input { position: absolute; z-index: 3; top: 0; left: 0; box-sizing: border-box; height: 100%; padding: 0 7px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--accent), 0 4px 12px -4px rgba(0, 0, 0, 0.16); font: inherit; color: var(--ink); text-align: left; outline: none; }
/* Sum · Average · Count of the selection, like Excel's status bar */
.ui-asw-sh__status { display: flex; justify-content: flex-end; align-items: center; gap: 14px; height: 28px; margin: 0 -18px; padding: 0 18px; overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; box-shadow: inset 0 0.5px 0 var(--asw-grid); }
.ui-asw-sh__status b { font-weight: 500; color: var(--ink); }

/* ---------- Folder ---------- */
.ui-asw-fd { display: flex; flex-direction: column; min-width: 0; }
.ui-asw-fd__tools { flex-wrap: nowrap; }
.ui-asw-fd__crumbs { display: flex; flex: 1 1 0; align-items: center; min-width: 0; overflow: hidden; }
.ui-asw-fd__crumb { flex: 0 1 auto; min-width: 24px; max-width: 100%; height: 28px; padding: 0 6px; overflow: hidden; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; transition: background-color 120ms ease, color 120ms ease; }
.ui-asw-fd__crumb:not([aria-current]):hover { background: var(--hover); color: var(--ink); }
.ui-asw-fd__crumb[aria-current] { flex-shrink: 0.2; font-weight: 500; color: var(--ink); cursor: default; }
.ui-asw-fd__sep { display: grid; flex: none; place-items: center; color: var(--faint); }
.ui-asw-fd__search { display: flex; align-items: center; gap: 6px; height: 28px; margin: 10px 0 6px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); box-shadow: inset 0 0 0 0.5px var(--line-strong); color: var(--faint); transition: box-shadow 120ms ease; }
.ui-asw-fd__search:focus-within { box-shadow: inset 0 0 0 1px var(--line-strong); }
.ui-asw-fd__search > svg { flex: none; }
.ui-asw-fd__search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; }
.ui-asw-fd__search input::placeholder { color: var(--placeholder); }
/* The list: Name, Size, Modified – fixed rows, hairlines between them */
.ui-asw-fd__head, .ui-asw-fd__row { display: grid; grid-template-columns: minmax(0, 1fr) 64px; column-gap: 10px; align-items: center; padding: 0 8px; }
.ui-asw-fd__head[data-date], .ui-asw-fd__row[data-date] { grid-template-columns: minmax(0, 1fr) 58px 72px; }
@container (min-width: 420px) { .ui-asw-fd__head[data-date], .ui-asw-fd__row[data-date] { grid-template-columns: minmax(0, 1fr) 64px 112px; } }
.ui-asw-fd { container-type: inline-size; }
.ui-asw-fd__head { height: 26px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-asw-fd__sort { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 4px; margin: 0 -4px; border-radius: var(--aui-radius-sm, 5px); font-size: 12px; color: var(--muted); justify-self: start; transition: background-color 120ms ease, color 120ms ease; }
.ui-asw-fd__sort:hover { background: var(--hover); color: var(--ink); }
.ui-asw-fd__sort[data-on] { color: var(--ink); }
.ui-asw-fd__head > .ui-asw-fd__sort:nth-child(2) { justify-self: end; }
/* Free space under the items, like Finder's – a right-click there is about the folder, not an item */
.ui-asw-fd__body { position: relative; min-height: 236px; padding-bottom: 28px; }
.ui-asw-fd__list, .ui-asw-fd__grid { outline: none; }
.ui-as .ui-asw-fd__body [role="listbox"]:focus-visible { outline: none; }
.ui-asw-fd__row { height: 30px; font-size: 13px; color: var(--ink); cursor: default; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-asw-fd__name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-asw-fd__name > svg { flex: none; width: 14px; height: 14px; color: var(--muted); }
.ui-asw-fd__name > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-asw-fd__meta { overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ui-asw-fd__row > .ui-asw-fd__meta:nth-child(2) { text-align: right; }
.ui-asw-fd__row > .ui-asw-fd__meta:nth-child(3), .ui-asw-fd__head > .ui-asw-fd__sort:nth-child(3) { justify-self: end; text-align: right; }
.ui-asw-fd__row[aria-selected="true"], .ui-asw-fd__tile[aria-selected="true"] { background: var(--asw-sel-bg); }
/* The keyboard's place in the list: an inset ring, only while the list has the keyboard focus */
.ui-asw-fd__body [role="listbox"]:focus-visible [data-cur] { outline: 2px solid var(--ui-as-focus); outline-offset: -2px; }
.ui-as .ui-asw-fd__body [role="listbox"]:focus-visible:not(:has([data-cur])) { outline: 2px solid var(--ui-as-focus); outline-offset: -2px; }
/* Icons: tiles with the glyph and the name under it */
.ui-asw-fd__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 4px; padding: 8px 0 4px; }
.ui-asw-fd__tile { display: flex; flex-direction: column; align-items: center; height: 88px; padding: 10px 4px 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); cursor: default; }
.ui-asw-fd__tile .ui-asw-fd__name { flex-direction: column; gap: 6px; width: 100%; }
.ui-asw-fd__tile .ui-asw-fd__name > svg { width: 36px; height: 36px; }
.ui-asw-fd__tile .ui-asw-fd__name > span { display: -webkit-box; max-width: 100%; font-size: 12px; line-height: 16px; text-align: center; white-space: normal; overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink); }
.ui-asw-fd__empty { margin: 0; padding: 24px 8px; font-size: 13px; text-align: center; color: var(--muted); }
.ui-asw-fd__foot { margin: 8px -18px 0; padding: 8px 18px 0; font-size: 12px; line-height: 16px; text-align: center; color: var(--faint); box-shadow: inset 0 0.5px 0 var(--line); }
/* Quick Look: a card over the list */
.ui-asw-ql { position: absolute; z-index: 5; top: 6px; left: -6px; right: -6px; display: flex; flex-direction: column; max-height: 380px; overflow: hidden; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, 0 0 0 0.5px var(--line-strong), 0 18px 44px -12px rgba(0, 0, 0, 0.26)); animation: ui-asw-ql 200ms var(--asw-out) both; }
.ui-asw-ql__head { display: flex; flex: none; align-items: center; gap: 10px; min-width: 0; height: 48px; padding: 0 8px 0 12px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-asw-ql__head .ui-asw-art__title { flex: 1; }
.ui-asw-ql__close { display: grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 120ms ease; }
.ui-asw-ql__close:hover { background: var(--hover); color: var(--ink); }
.ui-asw-ql__body { flex: 1; min-height: 0; overflow: auto; padding: 14px 14px 16px; }
.ui-asw-ql__body .ui-asw-wire { display: block; width: 100%; height: auto; }
.ui-asw-ql__none { margin: 0; padding: 28px 0; font-size: 13px; text-align: center; color: var(--muted); }
.ui-asw-ql__sheet { overflow-x: auto; }
.ui-asw-ql__sheet table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.ui-asw-ql__sheet td { height: 24px; padding: 0 8px; white-space: nowrap; color: var(--ink); box-shadow: inset -0.5px -0.5px 0 var(--asw-grid); }
.ui-asw-ql__sheet td[data-num] { text-align: right; }
.ui-asw-ql__sheet tr[data-head] td { font-weight: 500; }
.ui-asw-fd__rename { flex: 1; min-width: 0; height: 22px; margin: 0 -4px; padding: 0 4px; border: 0; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong); font: inherit; font-size: inherit; color: var(--ink); outline: none; }
.ui-asw-fd__tile .ui-asw-fd__rename { flex: none; width: 100%; margin: 0; text-align: center; font-size: 12px; }
@keyframes ui-asw-ql { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }

/* ---------- Context menus – the shell's menu (.ui-as-menu), placed at the pointer ---------- */
.ui-asw-ctx { position: fixed; z-index: 80; min-width: 200px; max-width: min(300px, calc(100vw - 12px)); animation: ui-asw-ctx 120ms ease both; }
.ui-asw-ctx__row { position: relative; display: block; }
.ui-asw-ctx .ui-as-menu__item[aria-disabled] { opacity: 0.4; cursor: default; }
.ui-asw-ctx .ui-as-menu__item[aria-disabled]:is(:hover, :focus-visible) { background: none; }
.ui-asw-ctx .ui-as-menu__item:focus { outline: none; background: var(--hover); color: var(--ink); }
.ui-asw-ctx .ui-as-menu__item[data-open] { background: var(--hover); color: var(--ink); }
.ui-asw-ctx .ui-as-menu__item[aria-haspopup] > svg:last-child { color: var(--faint); }
.ui-asw-ctx .ui-as-menu__item[data-danger]:is(:hover, :focus) { background: color-mix(in srgb, var(--aui-red, #f04438) 8%, transparent); }
.ui-asw-ctx__sub { position: absolute; z-index: 1; top: -4px; left: calc(100% + 4px); min-width: 224px; }
.ui-asw-ctx__sub[data-flip] { right: calc(100% + 4px); left: auto; }
/* A bridge over the gap, so the pointer can cross to the submenu */
.ui-asw-ctx__sub::before { content: ""; position: absolute; top: 0; bottom: 0; left: -8px; width: 8px; }
.ui-asw-ctx__sub[data-flip]::before { right: -8px; left: auto; }
@keyframes ui-asw-ctx { from { opacity: 0; transform: scale(0.98); } }

@keyframes ui-asw-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-asw-ql, .ui-asw-tip, .ui-asw-ctx { animation: none !important; }
  .ui-asw-tool:active:not([aria-disabled]), .ui-asw-btn:active { transform: none; }
}

/* Touch: every control at least 36px */
@media (pointer: coarse) {
  .ui-asw-btn { min-height: 36px; }
  .ui-asw-tool, .ui-asw-fd__crumb { min-width: 36px; height: 36px; }
  .ui-asw-fd__row { height: 40px; }
}

`;

const workspaceCss = /* css */ `
.ui-asw { display: flex; flex-direction: column; gap: 22px; padding: 0 2px; }

/* Address field: a white pill with a hairline, like the search fields in the screens */
.ui-asw__address {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: calc(var(--aui-radius, 7px) + 3px);
  background: var(--card);
  box-shadow: inset 0 0 0 0.5px var(--line-strong), var(--shadow);
  color: var(--faint);
  cursor: text;
}
.ui-asw__address:focus-within { box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); }
.ui-asw__address input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}
.ui-asw__address input::placeholder { color: var(--placeholder); }

.ui-asw__section { display: flex; flex-direction: column; gap: 8px; }
.ui-asw__label { margin: 0; padding: 0 4px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }

/* Rows sit on one white card, split by hairlines – the same card style as the screens */
.ui-asw__list {
  display: flex;
  flex-direction: column;
  padding: 4px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: inset 0 0 0 0.5px var(--line-strong), var(--shadow);
}
.ui-asw__row { position: relative; display: flex; align-items: center; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); transition: background-color 140ms ease; }
.ui-asw__row + .ui-asw__row::before {
  content: "";
  position: absolute;
  top: -0.5px;
  left: 44px;
  right: 8px;
  height: 1px;
  background: var(--line-soft);
}
.ui-asw__open {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  text-align: left;
  transition: background-color 140ms ease;
}
/* The hover fills the whole row, the ⋯ button at its end included */
.ui-asw__row:hover { background: var(--hover); }
.ui-asw__source { height: 48px; flex: none; }

.ui-asw__tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--chip);
  color: var(--text);
}
.ui-asw__tile--mark { font-size: 11.5px; font-weight: 500; color: var(--muted); }

.ui-asw__text { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.ui-asw__name { overflow: hidden; font-size: 13px; line-height: 18px; font-weight: 450; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-asw__open > .ui-asw__name { flex: 1; }
.ui-asw__meta { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-asw__empty { margin: 0; padding: 0 4px; font-size: 13px; line-height: 18px; color: var(--faint); }

.ui-asw__kbd {
  flex: none;
  padding: 1px 6px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  background: var(--chip);
  font: inherit;
  font-size: 11px;
  line-height: 18px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: opacity 140ms ease;
}
/* The shortcut sits flush right; on hover the ⋯ button takes its place */
.ui-asw__more {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 2px);
  color: var(--faint);
  opacity: 0;
  translate: 0 -50%;
  transition: opacity 140ms ease, background-color 140ms ease;
}
.ui-asw__row:is(:hover, :focus-within) .ui-asw__more { opacity: 1; }
.ui-asw__row:is(:hover, :focus-within) .ui-asw__kbd { opacity: 0; }
.ui-asw__more:hover { background: var(--hover); color: var(--text); }
.ui-asw__go { flex: none; color: var(--faint); opacity: 0; translate: -2px 0; transition: opacity 140ms ease, translate 200ms var(--ease); }
.ui-asw__source:hover .ui-asw__go { opacity: 1; translate: 0 0; }


/* Exact AffectUI Pro App Shell Inset tokens & viewport-pinned inset frame for prokhor.me and /fapp */
html:has(.ui-as-web),
html:has(.ui-as-web) body,
.prokhor-root:has(.ui-as-web) {
  background: #f8f8f8;
}
html:is(.dark, [data-theme="dark"]):has(.ui-as-web),
html:is(.dark, [data-theme="dark"]):has(.ui-as-web) body,
:is(.dark, [data-theme="dark"]) .prokhor-root:has(.ui-as-web) {
  background: #0e0e10;
}
.ui-as-web.ui-as {
  --tray: #f4f4f4;
  --card: #ffffff;
  --page: #f8f8f8;
  --side-tint: #fcfcfc;
  --panel: #ffffff;
  --radius-panel: 12px;
  --frame-gap: 8px;
  --as-head-h: 48px;
  --as-head-edge: 1px;
  --line: rgba(0, 0, 0, 0.06);
  --line-soft: rgba(0, 0, 0, 0.04);
  --line-strong: rgba(0, 0, 0, 0.1);
  --edge-active: rgba(0, 0, 0, 0.14);
  --chip: rgba(0, 0, 0, 0.04);
  --chip-hover: rgba(0, 0, 0, 0.06);
  --hover: rgba(0, 0, 0, 0.03);
  --select: rgba(0, 0, 0, 0.055);
  --subtle: #fafafa;
  --shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --card-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 2px 6px -1px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
:where(.dark, [data-theme="dark"]) .ui-as-web.ui-as {
  --tray: #1d1d20;
  --card: #1b1b1e;
  --page: #0e0e10;
  --side-tint: #111113;
  --panel: #141416;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.14);
  --edge-active: rgba(255, 255, 255, 0.18);
  --chip: rgba(255, 255, 255, 0.06);
  --chip-hover: rgba(255, 255, 255, 0.09);
  --hover: rgba(255, 255, 255, 0.05);
  --select: rgba(255, 255, 255, 0.08);
  --subtle: #18181b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --card-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.4);
  --card-shadow-hover: 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 2px 6px rgba(0, 0, 0, 0.4);
  --aui-border: rgba(255, 255, 255, 0.08);
  --aui-border-strong: rgba(255, 255, 255, 0.14);
  --aui-shadow-card: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.ui-as-web.ui-as-app {
  min-height: 100dvh;
  height: auto;
  align-items: start;
}
.ui-as-web > .ui-as-side {
  position: sticky;
  top: 0;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 30;
}
.ui-as-web > .ui-as-resizer[data-edge="left"] {
  position: fixed;
  top: var(--frame-gap);
  bottom: var(--frame-gap);
  left: calc(var(--side-col) - 6px);
  width: 12px;
  height: auto;
  z-index: 31;
}
/* Viewport-pinned inset panel frame: keeps AffectUI's 8px --page frame, all four 12px rounded corners
   and the 1px --line border permanently visible around the viewport while the document scrolls. */
.ui-as-web > .ui-as-inset-frame {
  position: fixed;
  top: var(--frame-gap);
  right: var(--frame-gap);
  bottom: var(--frame-gap);
  left: var(--side-col);
  z-index: 28;
  pointer-events: none;
  border-radius: var(--radius-panel);
  box-shadow:
    0 0 0 100vmax var(--page),
    inset 0 0 0 1px var(--line);
  transition: left 420ms var(--ease);
}
.ui-as-web[data-resizing] > .ui-as-inset-frame {
  transition: none;
}
.ui-as-web:is([data-layout="flat"], [data-shell="flat"] :not([data-layout="inset"])) > .ui-as-inset-frame {
  display: none;
}
.ui-as-web > .ui-as-main {
  min-height: calc(100dvh - calc(var(--frame-gap) * 2));
  height: auto;
  overflow-y: visible;
  overflow-x: clip;
}
.ui-as-web:not([data-layout="flat"]) > .ui-as-main {
  border-color: transparent;
}
.ui-as-web:not([data-layout="flat"]) .ui-as-main :is(.ui-as-bar, .ui-as-rev__head, .ui-ev__head, .ui-onb-bar) {
  top: calc(var(--frame-gap) + var(--as-head-edge));
}
.ui-as-side__label-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 14px 0 3px;
  padding: 2px 6px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--faint);
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}
.ui-as-side__label-btn:hover { color: var(--muted); background: var(--hover); }
.ui-as-side__label-btn svg { transition: transform 180ms var(--ease); color: var(--faint); }
.ui-as-side__label-btn[aria-expanded="false"] svg { transform: rotate(-90deg); }
.ui-as-app[data-collapsed] .ui-as-side__label-btn {
  color: transparent;
  white-space: nowrap;
  overflow: hidden;
  background: linear-gradient(var(--line-strong), var(--line-strong)) 6px 50% / 24px 0.5px no-repeat;
  pointer-events: none;
}
.ui-as-app[data-collapsed] .ui-as-side__label-btn > * { visibility: hidden; }
.ui-as-side__sub {
  display: flex;
  flex-direction: column;
  padding-left: 14px;
}
.ui-as-app[data-collapsed] .ui-as-side__sub { padding-left: 0; }
.ui-as-side__toc {
  display: flex;
  flex-direction: column;
  margin: 2px 0 4px 13px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  list-style: none;
}
.ui-as-app[data-collapsed] .ui-as-side__toc { display: none; }
.ui-as-side__toc-link {
  display: flex;
  align-items: center;
  min-height: 25px;
  padding: 2px 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 2px);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease, background-color 120ms ease;
}
.ui-as-side__toc-link:hover { color: var(--ink); background: var(--hover); }
.ui-as-side__toc-link[aria-current="true"] { color: var(--ink); font-weight: 500; background: var(--select); }
.ui-as-side__toc-sub {
  display: flex;
  flex-direction: column;
  padding-left: 10px;
  list-style: none;
  margin: 0;
}
.ui-as-side__mcp {
  margin: 4px 2px 6px 24px;
  padding: 8px 10px;
  border-radius: calc(var(--aui-radius, 7px) + 1px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ui-as-app[data-collapsed] .ui-as-side__mcp { display: none; }
.ui-as-side__mcp code {
  font-size: 11.5px;
  color: var(--ink);
  word-break: break-all;
}
.ui-as-side__mcp-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.ui-as-side__mcp-acts button, .ui-as-side__mcp-acts a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.ui-as-side__mcp-acts button:hover, .ui-as-side__mcp-acts a:hover {
  text-decoration: underline;
}
.ui-as-cmd { position: fixed; }
@container ui-as (max-width: 900px) {
  .ui-as-web > .ui-as-side {
    position: fixed;
    height: 100dvh;
    z-index: 50;
  }
  .ui-as-web > .ui-as-scrim {
    position: fixed;
    z-index: 45;
  }
  .ui-as-web > .ui-as-side-open {
    position: fixed;
    z-index: 32;
    box-shadow: var(--card-shadow);
  }
  .ui-as-web > .ui-as-inset-frame {
    left: var(--frame-gap);
  }
}
@container ui-as (max-width: 600px) {
  .ui-as-web > .ui-as-inset-frame {
    --frame-gap: 6px;
    border-radius: 11px;
  }
}
@media print {
  .ui-as-web > .ui-as-inset-frame,
  .ui-as-web > .ui-as-side,
  .ui-as-web > .ui-as-side-open,
  .ui-as-web > .ui-as-resizer {
    display: none !important;
  }
  .ui-as-web > .ui-as-main {
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
}
.ui-as-start--hero {
  min-height: min(760px, calc(100dvh - 32px));
  padding: 56px 0 48px;
}
.ui-as-start--hero[data-phase="chat"] {
  min-height: 620px;
  height: auto;
  padding: 36px 0 32px;
}
.ui-as-start--hero .ui-as-start__thread {
  max-height: 460px;
  padding: 16px 24px 20px;
}
.ui-as-hero-wrap {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}


/* ==========================================================================
   1. Integrations / Agent Skills Directory (/tools)
   ========================================================================== */

.ui-as-integrations {
  width: min(960px, calc(100% - 64px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.ui-as-integrations__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin: 14px -16px 0;
  padding: 20px 16px 12px;
  background: var(--panel);
}
.ui-as-integrations__bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 28px;
  background: linear-gradient(to bottom, var(--panel), transparent);
  pointer-events: none;
}

.ui-as-integrations__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ui-as-integrations__tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.ui-as-int-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: calc(var(--aui-radius, 7px) - 1px);
  font-size: 13px;
  color: var(--text);
  box-shadow: inset 0 0 0 0.5px var(--line);
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.ui-as-int-tab:hover {
  background: var(--hover);
  color: var(--ink);
}
.ui-as-int-tab[aria-selected="true"] {
  background: var(--select);
  box-shadow: inset 0 0 0 0.5px var(--line-strong);
  font-weight: 500;
  color: var(--ink);
}
.ui-as-int-tab__count {
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.ui-as-int-tab[aria-selected="true"] .ui-as-int-tab__count {
  color: var(--muted);
}

.ui-as-integrations__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.ui-as-integrations__count {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ui-as-integrations__count strong {
  font-weight: 500;
  color: var(--ink);
}

.ui-as-integrations__search {
  width: 240px;
}

.ui-as-int-section {
  margin-top: 34px;
}
.ui-as-int-section + .ui-as-int-section {
  margin-top: 40px;
}
.ui-as-int-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.ui-as-int-section__title {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}
.ui-as-int-section__count {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.ui-as-int-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.ui-as-int-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 150ms ease, background-color 150ms ease, transform 150ms var(--ease);
}
.ui-as-int-card:hover {
  box-shadow: var(--card-shadow-hover);
  background: var(--card);
}
.ui-as-int-card:hover .ui-as-int-add {
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow);
  color: var(--ink);
}

.ui-as-int-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.ui-as-int-logo[data-pale="true"] {
  background: #1b1b1e;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
}
.ui-as-int-logo img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.ui-as-int-logo__letter {
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  color: var(--text);
  text-transform: uppercase;
}

.ui-as-int-row__text {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.ui-as-int-row__name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13.5px;
  line-height: 19px;
  font-weight: 500;
  color: var(--ink);
}
.ui-as-int-row__label {
  overflow: clip;
  overflow-clip-margin: 2px;
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ui-as-int-row__desc {
  overflow: hidden;
  font-size: 12.5px;
  line-height: 17px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ui-as-int-add {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  color: var(--muted);
  transition: box-shadow 140ms ease, background-color 160ms ease, color 160ms ease;
}

.ui-as-int-foot {
  margin-top: 40px;
  padding-top: 16px;
  box-shadow: inset 0 0.5px 0 var(--line);
  font-size: 12.5px;
  line-height: 19px;
  color: var(--muted);
  max-width: 640px;
}

@container ui-as-main (max-width: 760px) {
  .ui-as-int-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui-as-integrations__search {
    width: 100%;
  }
}
@container ui-as (max-width: 900px) {
  .ui-as-integrations {
    width: calc(100% - 40px);
    padding-top: 52px;
  }
}
@container ui-as (max-width: 600px) {
  .ui-as-integrations {
    width: calc(100% - 28px);
    padding: 52px 0 48px;
  }
  .ui-as-integrations__bar {
    margin: 8px -12px 0;
    padding: 16px 12px 10px;
  }
}

/* ==========================================================================
   2. Analytics & Agent Usage (/analytics)
   ========================================================================== */

.ui-as-rev {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.ui-as-rev__head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--as-head-h, 48px);
  padding: 8px 16px 8px 20px;
  background: var(--panel);
  box-shadow: inset 0 -0.5px 0 var(--line);
  transition: padding-left 420ms var(--ease);
}
.ui-as-rev__path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}
.ui-as-rev__path i {
  font-style: normal;
  color: var(--faint);
}
.ui-as-rev__path b {
  font-weight: 500;
  color: var(--ink);
}
.ui-as-rev__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ui-as-rev__updated {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ui-as-rev__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.ui-as-rev__intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 4px 4px;
}

.ui-as-rev__card {
  padding: 14px 16px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as-rev__cap {
  align-self: flex-start;
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 500;
  color: var(--muted);
}

.ui-as-rev__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.ui-as-rev__stat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ui-as-rev__stat-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.ui-as-rev__stat strong {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ui-as-rev__stat em {
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--aui-success, #1e8a4f);
  white-space: nowrap;
}
.ui-as-rev__stat em[data-tone="bad"] {
  color: var(--aui-red, #f04438);
}
.ui-as-rev__stat em[data-tone="flat"] {
  color: var(--muted);
}
.ui-as-rev__minibars {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}
.ui-as-rev__minibars i {
  width: 5px;
  border-radius: 2px;
  background: var(--line);
}
.ui-as-rev__minibars i:last-child {
  background: var(--aui-blue, #4fb0fe);
}

.ui-as-rev__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  align-items: stretch;
}
.ui-as-rev__row--3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.ui-as-rev .ui-as-rev__chart.ui-kpic {
  --ui-kpic-shadow: var(--card-shadow);
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
}
.ui-as-rev .ui-as-rev__chart .ui-kpic__title {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 18px;
  color: var(--muted);
}
.ui-as-rev .ui-as-rev__chart .ui-kpic__value {
  margin-top: 10px;
  font-size: 20px;
  line-height: 28px;
}
.ui-as-rev .ui-as-rev__chart .ui-kpic__footer {
  font-size: 12px;
}
.ui-as-rev .ui-as-rev__chart--tall.ui-kpic {
  display: flex;
  flex-direction: column;
}
.ui-as-rev .ui-as-rev__chart--tall .ui-kpic__chart {
  flex: 1;
  grid-template-rows: minmax(180px, 1fr) 20px;
}

.ui-as-rev__breakdown {
  display: flex;
  flex-direction: column;
}
.ui-as-rev__breakdown ul {
  display: flex;
  flex-direction: column;
  margin: 12px -6px 0;
  padding: 0;
  list-style: none;
}
.ui-as-rev__breakdown li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 13px;
}
.ui-as-rev__breakdown li:nth-child(even) {
  background: var(--hover);
}
.ui-as-rev__breakdown li span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
}
.ui-as-rev__breakdown li b {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ui-as-rev__spark {
  width: 40px;
  height: 14px;
  overflow: visible;
}
.ui-as-rev__spark polyline {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.ui-as-rev__spark[data-tone="up"] polyline {
  stroke: var(--aui-success, #1e8a4f);
}
.ui-as-rev__spark[data-tone="down"] polyline {
  stroke: var(--aui-red, #f04438);
}
.ui-as-rev__spark[data-tone="flat"] polyline {
  stroke: var(--faint);
}

.ui-as-rev__products {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ui-as-rev__product {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ui-as-rev__product > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}
.ui-as-rev__product-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ui-as-rev__product b {
  flex: none;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ui-as-rev__product-track {
  height: 6px;
  border-radius: 3px;
  background: var(--chip);
  overflow: hidden;
}
.ui-as-rev__product-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--aui-blue, #4fb0fe);
}

/* Hourly bars card */
.ui-as-rev__hours {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 112px;
  margin-top: 14px;
}
.ui-as-rev__hour {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  gap: 6px;
}
.ui-as-rev__hour-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px;
  background: var(--aui-blue, #4fb0fe);
  transition: height 180ms var(--ease), opacity 140ms ease;
}
.ui-as-rev__hour-bar[data-off="true"] {
  opacity: 0.25;
}
.ui-as-rev__hour-lbl {
  font-size: 10.5px;
  line-height: 1;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* AffectUI filter pills & controls inside Analytics */
.ui-as-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 2px);
  background: var(--chip);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.ui-as-pill:hover {
  background: var(--chip-hover);
  color: var(--ink);
}
.ui-as-pill[data-on="true"] {
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 500;
}
.ui-as-pill[data-danger="true"][data-on="true"] {
  background: var(--aui-red, #f04438);
  color: #ffffff;
}
.ui-as-pill__count {
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.ui-as-rev__filters {
  display: grid;
  gap: 10px;
}
.ui-as-rev__frow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ui-as-rev__flabel {
  min-width: 68px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.ui-as-rev__fnote {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 18px;
  color: var(--muted);
}

.ui-as-select,
.ui-as-date {
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--aui-radius, 7px) - 1px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}
.ui-as-select:focus-visible,
.ui-as-date:focus-visible {
  outline: 2px solid var(--ui-as-focus);
  outline-offset: 1px;
}

.ui-as-rev__facets {
  max-height: 240px;
  margin-top: 8px;
  overflow-y: auto;
  border-radius: calc(var(--aui-radius, 7px) + 1px);
  box-shadow: inset 0 0 0 0.5px var(--line);
}
.ui-as-rev__facet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 12.5px;
}
.ui-as-rev__facet-row + .ui-as-rev__facet-row {
  box-shadow: inset 0 0.5px 0 var(--line);
}
.ui-as-rev__facet-row[data-hidden="true"] {
  opacity: 0.45;
}
.ui-as-rev__facet-key {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.ui-as-rev__facet-n {
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* People accordion in Analytics */
.ui-as-rev__person {
  padding: 8px 0;
}
.ui-as-rev__person + .ui-as-rev__person {
  box-shadow: inset 0 0.5px 0 var(--line);
}
.ui-as-rev__person-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ui-as-rev__person-btn {
  flex: 1;
  min-width: 200px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.ui-as-rev__person-btn span {
  font-weight: 400;
  color: var(--muted);
}
.ui-as-rev__person-body {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--aui-radius, 7px);
  background: var(--frame);
  display: grid;
  gap: 8px;
}
.ui-as-rev__journey {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 19px;
  color: var(--text);
}
.ui-as-rev__journey time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* Gate card when /analytics requires auth key */
.ui-as-rev__gate {
  max-width: 400px;
  width: 100%;
  margin: 64px auto;
  display: grid;
  gap: 12px;
  padding: 24px;
}
.ui-as-rev__gate h1 {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  color: var(--strong);
}
.ui-as-rev__gate p {
  margin: 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--muted);
}
.ui-as-rev__err {
  margin: 0;
  font-size: 12.5px;
  color: var(--aui-red, #f04438);
}

/* Seamless AffectUI harmonization for shared Goals & Heatmap (.an-card) inside .ui-as-rev */
.ui-as-rev .an-card {
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as-rev .an-label {
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 10px;
}
.ui-as-rev .an-meta {
  font-size: 12px;
  color: var(--muted);
}
.ui-as-rev .an-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--chip);
}
.ui-as-rev .an-bar-fill {
  border-radius: 3px;
  background: var(--aui-blue, #4fb0fe);
}

@container ui-as-main (max-width: 920px) {
  .ui-as-rev__row {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui-as-rev__row--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container ui-as-main (max-width: 820px) {
  .ui-as-rev__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container ui-as-main (max-width: 560px) {
  .ui-as-rev__row--3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui-as-rev__stats {
    gap: 8px;
  }
  .ui-as-rev__minibars,
  .ui-as-rev__hour-lbl {
    display: none;
  }
}
@container ui-as (max-width: 900px) {
  .ui-as-rev__head {
    padding-left: 52px;
  }
}

/* ==========================================================================
   3. Evals / Screen Duel (/duel and /duel/[id])
   ========================================================================== */

.ui-ev {
  --ev-pass: var(--aui-success, #1e8a4f);
  --ev-pass-soft: color-mix(in srgb, var(--aui-success, #1e8a4f) 11%, transparent);
  --ev-partial: var(--aui-amber, #a36a00);
  --ev-partial-soft: color-mix(in srgb, var(--aui-amber, #e8b000) 13%, transparent);
  --ev-fail: var(--aui-red, #f04438);
  --ev-fail-soft: color-mix(in srgb, var(--aui-red, #f04438) 10%, transparent);
  --ev-run: var(--aui-blue, #4fb0fe);
  --ev-run-soft: color-mix(in srgb, var(--aui-blue, #0190fe) 10%, transparent);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
:where(.dark, [data-theme="dark"]) .ui-ev {
  --ev-pass: var(--aui-green, #5fc88a);
  --ev-pass-soft: color-mix(in srgb, var(--aui-green, #7dcf9f) 12%, transparent);
  --ev-partial: var(--aui-amber, #e6c24d);
  --ev-partial-soft: color-mix(in srgb, var(--aui-amber, #e6c24d) 13%, transparent);
  --ev-fail: var(--aui-red, #ff6b5f);
  --ev-fail-soft: color-mix(in srgb, var(--aui-red, #ff6b5f) 13%, transparent);
}

.ui-ev__head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--as-head-h, 48px);
  padding: 8px 16px 8px 20px;
  background: var(--panel);
  box-shadow: inset 0 -0.5px 0 var(--line);
  transition: padding-left 420ms var(--ease);
}
.ui-ev__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.ui-ev__path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 4px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}
.ui-ev__path a {
  color: var(--muted);
  text-decoration: none;
}
.ui-ev__path a:hover {
  color: var(--ink);
}
.ui-ev__path i {
  font-style: normal;
  color: var(--faint);
}
.ui-ev__path b {
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  color: var(--ink);
}
.ui-ev__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 2px);
  background: var(--chip);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.ui-ev__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.ui-ev__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  overflow: hidden;
  background: var(--line);
  opacity: 0;
  transition: opacity 240ms ease;
}
.ui-ev__progress[data-on="true"] {
  opacity: 1;
}
.ui-ev__progress i {
  display: block;
  height: 100%;
  background: var(--ev-run);
  transition: width 240ms var(--ease);
}

.ui-ev__body {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ui-ev__hero {
  display: grid;
  gap: 6px;
  max-width: 680px;
}

.ui-ev__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.ui-ev__card {
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-ev__stat {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  row-gap: 8px;
  padding: 14px 16px;
}
.ui-ev__cap {
  grid-column: 1 / -1;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--muted);
}
.ui-ev__stat strong {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ui-ev__stat small {
  margin-left: 3px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--faint);
}
.ui-ev__delta {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ui-ev__delta[data-good="true"] {
  color: var(--ev-pass);
}

/* Duel Demo interactive card */
.ui-ev__demo {
  padding: 18px 20px 20px;
  display: grid;
  gap: 18px;
}
.ui-ev__demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ui-ev__demo-title {
  display: grid;
  gap: 2px;
}
.ui-ev__demo-title h2 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
}
.ui-ev__demo-title p {
  margin: 0;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--muted);
}
.ui-ev__demo-stage {
  display: grid;
  grid-template-columns: minmax(0, 304px) auto minmax(0, 304px);
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 20px 16px;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--frame);
  box-shadow: inset 0 0 0 0.5px var(--line);
}
.ui-ev__vs {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--card-shadow);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ui-ev__phone {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}
.ui-ev__phone-label {
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
  color: var(--text);
}

/* Modes 2-col cards */
.ui-ev__section {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.ui-ev__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ui-ev__section-head h2 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
}
.ui-ev__section-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.ui-ev__modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ui-ev__mode {
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.ui-ev__mode-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ui-ev__mode h3 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
}
.ui-ev__mode dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
.ui-ev__mode dt {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}
.ui-ev__mode dd {
  margin: 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--ink);
}

/* Evals table (shared by Duel steps, Open studies, and Analytics events) */
.ui-ev__table-wrap {
  overflow-x: auto;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-ev__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.ui-ev__table th {
  height: 38px;
  padding: 0 14px;
  background: var(--card);
  box-shadow: inset 0 -0.5px 0 var(--line);
  font-weight: 500;
  font-size: 12px;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}
.ui-ev__table td {
  min-height: 46px;
  padding: 11px 14px;
  background: var(--card);
  color: var(--ink);
  vertical-align: top;
  line-height: 19px;
}
.ui-ev__table tbody tr + tr td {
  box-shadow: inset 0 0.5px 0 var(--line);
}
.ui-ev__table tbody tr:hover td {
  background: color-mix(in srgb, var(--card), var(--ink) 2%);
}
.ui-ev__id {
  font-family: var(--aui-font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.ui-ev__soft {
  color: var(--muted);
}

.ui-ev__pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.ui-ev__pill > i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.ui-ev__pill[data-v="pass"] {
  background: var(--ev-pass-soft);
  color: var(--ev-pass);
}
.ui-ev__pill[data-v="partial"] {
  background: var(--ev-partial-soft);
  color: var(--ev-partial);
}
.ui-ev__pill[data-v="run"] {
  background: var(--ev-run-soft);
  color: var(--ev-run);
}
.ui-ev__pill[data-v="neutral"] {
  background: var(--chip);
  color: var(--muted);
}

/* Open studies grid on /duel */
.ui-ev__open-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.ui-ev__open-card {
  display: grid;
  gap: 8px;
  align-content: space-between;
  padding: 16px 18px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 150ms ease;
}
.ui-ev__open-card:hover {
  box-shadow: var(--card-shadow-hover);
}
.ui-ev__open-card b {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
}
.ui-ev__open-card p {
  margin: 0;
  font-size: 13px;
  line-height: 19px;
  color: var(--muted);
}
.ui-ev__open-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  box-shadow: inset 0 0.5px 0 var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* Duel Run (/duel/[id]) stages */
.ui-ev-run {
  width: min(640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
  display: grid;
  gap: 16px;
}
.ui-ev-run--wide {
  width: min(980px, calc(100% - 32px));
}
.ui-ev-run__card {
  padding: 24px;
  display: grid;
  gap: 18px;
}
.ui-ev-run__banner {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--aui-radius, 7px);
  background: var(--ev-run-soft);
  color: var(--ev-run);
  font-size: 12.5px;
  line-height: 18px;
}
.ui-ev-run__kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.ui-ev-run__title {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--strong);
}
.ui-ev-run__lead {
  margin: 0;
  font-size: 13.5px;
  line-height: 21px;
  color: var(--text);
}
.ui-ev-run__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ui-ev-run__note {
  margin: 0;
  font-size: 12.5px;
  line-height: 19px;
  color: var(--muted);
}
.ui-ev-run__err {
  margin: 0;
  font-size: 12.5px;
  color: var(--ev-fail);
}
.ui-ev-run__q {
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--frame);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.ui-ev-run__q-label {
  font-size: 13.5px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}
.ui-ev-run__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.ui-ev-run__task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 336px);
  align-items: start;
  gap: 24px;
}
.ui-ev-run__task-side {
  position: sticky;
  top: 64px;
}
.ui-ev-run__answer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ui-ev-run__answer-field {
  flex: 1;
  min-width: 200px;
}
.ui-ev-run__compare-switch {
  display: none;
  justify-content: center;
}
.ui-ev-run__compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 320px));
  justify-content: center;
  gap: 28px;
}
.ui-ev-run__compare-col {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-ev-run__compare-col[data-chosen="true"] {
  box-shadow: 0 0 0 1.5px var(--ink), var(--shadow);
}
.ui-ev-run__finish {
  justify-items: center;
  text-align: center;
  padding: 36px 24px;
}
.ui-ev-run__finish-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--ev-pass-soft);
  color: var(--ev-pass);
}

@container ui-as-main (max-width: 820px) {
  .ui-ev__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ui-ev__demo-stage {
    grid-template-columns: minmax(0, 300px);
    gap: 16px;
  }
  .ui-ev__vs {
    margin: 0 auto;
  }
  .ui-ev__modes {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui-ev-run__task {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui-ev-run__task-side {
    position: static;
  }
  .ui-ev-run__compare-switch {
    display: flex;
  }
  .ui-ev-run__compare-grid {
    grid-template-columns: minmax(0, 320px);
  }
  .ui-ev-run__compare-col[data-active="false"] {
    display: none;
  }
}
@container ui-as (max-width: 900px) {
  .ui-ev__head {
    padding-left: 52px;
  }
}

/* ==========================================================================
   4. Settings General / Preferences for Admin (/admin)
   ========================================================================== */

.ui-sg {
  max-width: 780px;
  margin: 0 auto;
}

.ui-sg-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.ui-sg-top__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ui-sg-status {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 2px);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

.ui-sg-head {
  margin-top: 32px;
}
.ui-sg-head h2 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
}
.ui-sg-head p {
  max-width: 620px;
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
}

.ui-sg-card {
  position: relative;
  margin-top: 12px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as-page-sub + .ui-sg-card {
  margin-top: 24px;
}

.ui-sg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 56px;
  padding: 10px 14px 10px 16px;
}
.ui-sg-row + .ui-sg-row {
  box-shadow: inset 0 0.5px 0 var(--line);
}
.ui-sg-label {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.ui-sg-label b {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
  overflow-wrap: anywhere;
}
.ui-sg-label small {
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.ui-sg-control {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ui-sg-field {
  flex: none;
  width: 148px;
}
.ui-sg-mono {
  font-family: var(--aui-font-mono, ui-monospace, "SF Mono", Menlo, monospace);
}

/* Color swatch input styled as an AffectUI 30x30 rounded tile */
.ui-sg-swatch-pick {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 0.5px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}
.ui-sg-swatch-pick input[type="color"] {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.ui-sg-range {
  width: 160px;
  accent-color: var(--ink);
  cursor: pointer;
}
.ui-sg-unit {
  min-width: 44px;
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Live theme preview row */
.ui-sg-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}
.ui-sg-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 0.5px var(--line-strong);
}
.ui-sg-sample-card {
  margin-left: auto;
  padding: 10px 14px;
  border-radius: var(--r-lg, 12px);
  background: var(--ds-surface, var(--subtle));
  color: var(--ds-text, var(--ink));
  box-shadow: inset 0 0 0 0.5px var(--line);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ui-sg-sample-card strong {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ui-sg-sample-card span {
  font-size: 12px;
  color: var(--muted);
}

/* Preferences-style service link tiles */
.ui-spf-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.ui-spf-tool {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  text-align: left;
  text-decoration: none;
  color: var(--muted);
  transition: box-shadow 160ms ease, color 160ms ease;
}
.ui-spf-tool:hover {
  box-shadow: var(--card-shadow-hover);
  color: var(--ink);
}
.ui-spf-tool b {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--strong);
}
.ui-spf-tool small {
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.ui-sg-danger {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: calc(var(--aui-radius, 7px) + 1px);
  box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--aui-red, #f04438) 35%, transparent);
  font-size: 13px;
  font-weight: 500;
  color: var(--aui-red, #f04438);
  transition: background-color 140ms ease, opacity 140ms ease;
}
.ui-sg-danger:hover {
  background: color-mix(in srgb, var(--aui-red, #f04438) 7%, transparent);
}

@container ui-as-main (max-width: 680px) {
  .ui-spf-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container ui-as-main (max-width: 600px) {
  .ui-sg-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .ui-sg-field,
  .ui-sg-range {
    width: 100%;
  }
  .ui-sg-sample-card {
    margin-left: 0;
    width: 100%;
  }
}




.ui-aga, .ui-aga-panel {
  --ui-aga-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --aga-out: cubic-bezier(0.23, 1, 0.32, 1);
  --aga-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(0, 0, 0, 0.06)), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05));
  --aga-line: var(--aui-border, rgba(0, 0, 0, 0.06));
  --aga-head: color-mix(in srgb, var(--ink) 4.5%, var(--panel));
  --aga-auto: var(--aui-blue, #0190fe);
  --aga-approved: var(--aui-amber, #e8b000);
}
:where(.dark, [data-theme="dark"]) :is(.ui-aga, .ui-aga-panel) {
  --ui-aga-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --aga-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(255, 255, 255, 0.08)), 0 1px 2px 0 rgba(0, 0, 0, 0.3));
  --aga-line: var(--aui-border, rgba(255, 255, 255, 0.07));
  --aga-auto: var(--aui-blue, #4fb0fe);
  --aga-approved: var(--aui-amber, #e6c24d);
}
.ui-aga { position: relative; container: ui-aga / inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; background: var(--panel); }
.ui-aga-num { font-variant-numeric: tabular-nums; }
.ui-aga-faint { color: var(--faint); }
.ui-aga-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:is(.ui-aga, .ui-aga-panel) :focus-visible { outline: 2px solid var(--ui-aga-focus); outline-offset: 2px; }
:is(.ui-aga, .ui-aga-panel) :is(input, textarea):focus-visible { outline: none; }

/* ---------- Head ---------- */
.ui-aga-head { display: flex; flex: none; align-items: center; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-aga-title { flex: none; margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-aga-seg { display: flex; flex: none; gap: 2px; }
.ui-aga-seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-aga-seg button:hover { color: var(--ink); }
.ui-aga-seg button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.ui-aga-seg__n { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-aga-search { display: flex; flex: 0 1 220px; align-items: center; gap: 6px; min-width: 0; height: 28px; margin-left: auto; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--chip); color: var(--faint); cursor: text; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-aga-search:focus-within { background: var(--card); box-shadow: var(--card-shadow-hover); }
.ui-aga-search > svg { flex: none; }
.ui-aga-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; appearance: none; }
.ui-aga-search input::placeholder { color: var(--placeholder); }
.ui-aga-search input::-webkit-search-cancel-button { display: none; }

/* ---------- List ---------- */
.ui-aga-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ui-aga-list { display: grid; gap: 16px; padding: 10px 8px 40px; }
.ui-aga-center { display: grid; min-height: 100%; place-items: center; padding: 40px 24px 80px; }
.ui-aga-day { display: grid; gap: 4px; }
.ui-aga-dhead { display: flex; align-items: center; gap: 8px; height: 32px; margin: 0; padding: 0 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--aga-head); font-size: 12.5px; font-weight: 500; color: var(--ink); }
.ui-aga-dhead__n { min-width: 20px; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--card); box-shadow: 0 0 0 0.5px var(--aga-line); font-size: 11.5px; font-weight: 400; line-height: 18px; text-align: center; color: var(--muted); }
.ui-aga-rows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }

.ui-aga-row { position: relative; display: flex; align-items: center; gap: 8px; min-height: 56px; padding-right: 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); transition: background-color 140ms ease; }
.ui-aga-row:hover { background: var(--hover); }
.ui-aga-row[data-selected] { background: var(--chip); }
.ui-aga-row__main { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; min-height: 56px; padding: 8px 0 8px 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); text-align: left; }
.ui-aga-row__main:focus-visible { outline-offset: -2px; }
.ui-aga-row__time { flex: none; width: 38px; font-size: 12px; color: var(--faint); }
.ui-aga-row__text { display: grid; flex: 1; min-width: 0; }
.ui-aga-row__line { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.ui-aga-row:dir(rtl) .ui-aga-row__line { text-align: right; }
/* The sentence carries the strike: a line drawn through it from the left, then the words fade */
.ui-aga-row__sentence { position: relative; background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 55%; background-size: 0 1px; transition: color 400ms ease 300ms; }
.ui-aga-row[data-undone] .ui-aga-row__sentence { background-size: 100% 1px; color: var(--faint); }
.ui-aga-row[data-struck] .ui-aga-row__sentence { animation: ui-aga-strike 520ms var(--aga-out) both; }
.ui-aga-row__meta { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.ui-aga-row__task { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--faint); }
.ui-aga-who { display: inline-flex; flex: none; align-items: center; gap: 6px; }
.ui-aga-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--aga-auto); }
.ui-aga-who[data-by="approved"] .ui-aga-dot { background: var(--aga-approved); }
.ui-aga-row[data-undone] .ui-aga-dot { background: var(--faint); }
.ui-aga-row__end { display: flex; flex: none; justify-content: flex-end; width: 84px; }
.ui-aga-tag { padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--muted); }
.ui-aga-row[data-struck] .ui-aga-tag { animation: ui-aga-pop 360ms var(--aga-out) 360ms both; }
.ui-aga-final { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--faint); }

.ui-aga-mark { display: grid; flex: none; place-items: center; border-radius: 7px; background: var(--chip); color: var(--muted); }
.ui-aga-mark[data-logo] { background: #fff; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.ui-aga-mark[data-tile] { box-shadow: none; }
:where(.dark, [data-theme="dark"]) .ui-aga-mark[data-tile] { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.16); }
.ui-aga-mark[data-logo] svg { display: block; width: var(--aga-glyph); height: var(--aga-glyph); }

.ui-aga-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--aga-card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, filter 140ms ease; }
.ui-aga-btn:hover { box-shadow: 0 0 0 0.5px var(--aui-border-strong, rgba(0, 0, 0, 0.1)), 0 2px 4px rgba(0, 0, 0, 0.06); }
.ui-aga-btn > svg { flex: none; color: var(--muted); }
.ui-aga-btn:has(> svg:first-child) { padding-left: 8px; }
.ui-aga-btn--sm { height: 26px; font-size: 12.5px; }
.ui-aga-btn--dark { background: var(--ink); box-shadow: none; color: var(--card); }
.ui-aga-btn--dark > svg { color: inherit; }
.ui-aga-btn--dark:hover { box-shadow: none; filter: brightness(1.15); }
.ui-aga-btn:active { transform: scale(0.97); }

/* ---------- Panel ---------- */
.ui-aga-panel { display: flex; flex-direction: column; gap: 22px; padding: 4px 4px 16px; }
.ui-aga-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-aga-panel :focus-visible { outline-offset: -2px; }
.ui-aga-panel__head { display: flex; align-items: flex-start; gap: 12px; }
.ui-aga-panel__titles { display: grid; gap: 2px; min-width: 0; }
.ui-aga-panel__title { margin: 0; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); overflow-wrap: anywhere; }
.ui-aga-panel__title[data-undone] { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.ui-aga-panel__sub { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-aga-props { display: grid; gap: 2px; margin: 0; }
.ui-aga-props > div { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; min-height: 28px; }
.ui-aga-props dt { font-size: 12px; color: var(--muted); }
.ui-aga-props dd { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; color: var(--ink); }
.ui-aga-props dd > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-aga-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ui-aga-label { margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-aga-card { margin: 0 -8px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--aga-card-shadow); }
.ui-aga-what { display: grid; gap: 10px; padding: 10px 12px; }
.ui-aga-details { display: grid; gap: 4px; margin: 0; }
.ui-aga-details > div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 20px; }
.ui-aga-details dt { color: var(--muted); }
.ui-aga-details dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.ui-aga-preview-wrap { display: grid; justify-items: start; gap: 4px; }
.ui-aga-preview:not([data-open]) { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
.ui-aga-preview-wrap .ui-aga-preview__more { margin-left: 4px; }
.ui-aga-preview { margin: 0; padding-left: 10px; box-shadow: inset 2px 0 0 var(--aga-line); font-size: 13px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.ui-aga-why { display: grid; gap: 6px; padding: 10px 12px; font-size: 13px; }
.ui-aga-why .ui-aga-who { font-size: 12px; font-weight: 500; color: var(--ink); }
.ui-aga-why__text { margin: 0; line-height: 20px; color: var(--text); }
.ui-aga-why__rule { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 2px 0 0; padding-top: 8px; box-shadow: inset 0 0.5px 0 var(--aga-line); font-size: 12.5px; color: var(--ink); }
.ui-aga-why__rule > svg { flex: none; color: var(--muted); }
.ui-aga-why__rule > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-aga-link { display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--faint); transition: background-color 140ms ease, color 140ms ease; }
.ui-aga-link:hover { background: var(--chip); color: var(--ink); }
.ui-aga-link--text { display: inline-flex; gap: 2px; width: auto; margin-left: auto; padding: 0 4px 0 6px; font-size: 12px; color: var(--muted); }
.ui-aga-undo { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; }
.ui-aga-undo__text { display: grid; flex: 1; min-width: 0; font-size: 12px; line-height: 16px; }
.ui-aga-undo__how { font-size: 13px; line-height: 20px; color: var(--ink); }
.ui-aga-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; line-height: 20px; color: var(--muted); }
.ui-aga-note > svg { flex: none; margin-top: 3px; }

/* Loading: the same day heads and 56px rows, gray bars in place of the text, each centered in its line */
.ui-aga [data-skel] { pointer-events: none; }
.ui-aga-skel-line { display: flex; align-items: center; min-width: 0; height: 20px; }
.ui-aga-skel-titles { flex: 1; }
.ui-aga-row[data-skel] .ui-aga-row__end { align-items: center; height: 20px; }

.ui-as-app[data-panel="closed"] .ui-aga-head { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-aga-head { padding-left: 46px; padding-right: 52px; }
}
@container ui-aga (max-width: 720px) {
  .ui-aga-seg__n { display: none; }
}
@container ui-aga (max-width: 560px) {
  .ui-aga-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ui-aga-search { flex: 0 0 28px; justify-content: center; padding: 0 7px; }
  .ui-aga-search input::placeholder { color: transparent; }
  .ui-aga-search:focus-within, .ui-aga-search:has(input:not(:placeholder-shown)) { flex: 1 1 auto; justify-content: flex-start; }
  .ui-aga-head:has(.ui-aga-search:focus-within) .ui-aga-seg, .ui-aga-head:has(.ui-aga-search input:not(:placeholder-shown)) .ui-aga-seg { display: none; }
  /* The filters scroll sideways when they don't fit, fading at the edge */
  .ui-aga-seg { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .ui-aga-seg::-webkit-scrollbar { display: none; }
  .ui-aga-seg button:focus-visible { outline-offset: -2px; }
  .ui-aga-row__time { display: none; }
  .ui-aga-row__line { display: -webkit-box; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .ui-aga-row__end { width: auto; }
  .ui-aga-row__end .ui-aga-btn > span { display: none; }
  .ui-aga-row__end .ui-aga-btn { width: 28px; padding: 0; }
}

@keyframes ui-aga-strike {
  0% { background-size: 0 1px; color: var(--ink); }
  60% { background-size: 100% 1px; color: var(--ink); }
  100% { background-size: 100% 1px; color: var(--faint); }
}
@keyframes ui-aga-pop { from { opacity: 0; transform: scale(0.8); } }

@media (prefers-reduced-motion: reduce) {
  .ui-aga-row[data-struck] .ui-aga-row__sentence, .ui-aga-row[data-struck] .ui-aga-tag { animation: none; }
  .ui-aga-row__sentence { transition: none; }
}
@media (pointer: coarse) {
  .ui-aga-btn, .ui-aga-seg button, .ui-aga-search { min-height: 36px; }
  .ui-aga-row__end .ui-aga-btn { width: 36px; }
}


/* Agent chat: thread and composer in the page, the brief in the App Shell's work area on the right */
.ui-as-chat { display: flex; height: 100%; min-height: 0; }
.ui-as-chat__main { display: flex; flex: 1; flex-direction: column; min-width: 0; }

.ui-as-chat__bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: var(--as-head-h, 48px);
  padding: 0 12px 0 20px;
  color: var(--muted);
}
.ui-as-chat__crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.ui-as-chat__crumbs i { font-style: normal; color: var(--faint); }
.ui-as-chat__home { display: inline-flex; align-items: center; gap: 8px; color: inherit; transition: color 140ms ease; }
.ui-as-chat__home:hover { color: var(--ink); }
.ui-as-chat__crumbs > * { flex: none; }
/* Long chat and brief names stay on one line */
.ui-as-chat__crumbs > b { flex: 0 1 auto; min-width: 0; overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-as-chat__bar { gap: 12px; }
.ui-as-chat__bar > .ui-as-icon-btn { flex: none; }
.ui-as-chat__crumbs .ui-as-icon-btn { width: 24px; height: 24px; margin-left: -2px; }
/* While the brief is folded away, its icon sits in the bar's right end – the shell puts it on the bar's centerline */
.ui-as-app:has(.ui-as-chat) > .ui-as-panel-open { right: calc(var(--frame-gap) + 12px); }

.ui-as-chat__thread { flex: 1; min-height: 0; overflow-y: auto; padding: 40px 32px 16px; }
.ui-as-chat__column { display: flex; flex-direction: column; gap: 22px; max-width: 680px; margin: 0 auto; }
.ui-as-chat__user {
  align-self: flex-end;
  max-width: 80%;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 8px 14px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--chip);
  font-size: 14px;
  color: var(--ink);
}
.ui-as-chat__answer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.ui-as-chat__answer p { margin: 0; }
.ui-as-chat__route { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.ui-as-chat__avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--ink);
}
/* The finished thinking, folded: the Thinking State's header – pixel mark and "Worked for …" */
.ui-as-chat__worked { display: flex; align-items: center; gap: 10px; height: 33px; margin: -4px 0; font-size: 12px; font-weight: 500; color: var(--ink); }
.ui-as-chat__mark { display: grid; grid-template-columns: repeat(3, 3px); grid-auto-rows: 3px; gap: 1.5px; place-content: center; width: 15px; height: 15px; }
.ui-as-chat__mark i { border-radius: 0.75px; background: rgba(0, 96, 226, 0.765); }
.ui-as-chat__label { padding-top: 4px; font-size: 12.5px; color: var(--muted); }
.ui-as-chat__agents { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; margin-top: -6px; }
.ui-as-chat__agent {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 0.5px var(--line-strong);
  max-width: 100%;
  font-size: 13px;
  color: var(--text);
}
.ui-as-chat__agent svg { flex: none; color: var(--muted); }
.ui-as-chat__agent span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-chat__agent[data-active] { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-as-chat__agent[data-active] svg { color: var(--ink); }

.ui-as-chat__composer { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 744px; margin: 0 auto; padding: 8px 32px 24px; }
.ui-as-chat__route { font-size: 13px; font-weight: 400; color: var(--muted); }
.ui-as-chat__composer > .ui-ccc { max-width: none; }
.ui-as-chat__route b { font-weight: 500; color: var(--ink); }

/* The brief, laid out like the Workspace pane: small labels over cards with hairlines */
.ui-as-brief { display: flex; flex-direction: column; gap: 18px; min-height: 100%; padding: 0 2px; }
.ui-as-brief__seg { display: flex; flex: none; gap: 2px; padding: 3px; border-radius: calc(var(--aui-radius, 7px) + 3px); background: var(--chip); }
.ui-as-brief__seg button {
  flex: 1;
  height: 26px;
  border-radius: var(--aui-radius, 7px);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background-color 140ms ease, color 140ms ease;
}
.ui-as-brief__seg button:hover { color: var(--ink); }
.ui-as-brief__seg button[aria-selected="true"] { background: var(--card); box-shadow: var(--card-shadow); color: var(--ink); }

/* One white card, like the Workspace's lists */
.ui-as-brief__card,
.ui-as-brief__product,
.ui-as-brief__go,
.ui-as-activity {
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: inset 0 0 0 0.5px var(--line-strong), var(--shadow);
}
.ui-as-brief__card { display: flex; flex-direction: column; padding: 4px 12px; }
.ui-as-brief__card:has(> .ui-as-brief__pills),
.ui-as-brief__card:has(> .ui-as-brief__details) { padding: 12px; }

.ui-as-brief__product { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.ui-as-brief__thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #efeada;
  color: var(--aui-warning, #b25e00);
}
.ui-as-brief__pinfo { display: flex; flex: 1; flex-direction: column; min-width: 0; font-size: 12px; line-height: 17px; color: var(--muted); }
.ui-as-brief__pinfo b { font-size: 13px; font-weight: 500; line-height: 20px; color: var(--strong); }
.ui-as-brief__pinfo > b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Price and sales are numbers – they wrap to a second line instead of being cut */
.ui-as-brief__pinfo > span { overflow-wrap: anywhere; }
.ui-as-brief__chip { flex: none; max-width: 40%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent); font-size: 12px; font-weight: 500; color: var(--aui-success, #1e8a4f); }

.ui-as-brief__section { display: flex; flex-direction: column; gap: 8px; }
.ui-as-brief__section--split { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 12px; }
.ui-as-brief__none { margin: 8px 4px; font-size: 13px; color: var(--muted); }
.ui-as-brief__label { padding: 0 4px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-as-brief__section--split .ui-as-brief__label { display: block; padding: 0 0 10px; }

.ui-as-brief__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 5px);
  color: var(--muted);
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.ui-as-brief__option:hover { background: var(--hover); color: var(--ink); }
.ui-as-brief__option[aria-checked="true"] { background: var(--chip); color: var(--ink); }
.ui-as-brief__radio { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); transition: box-shadow 160ms ease; }
.ui-as-brief__option[aria-checked="true"] .ui-as-brief__radio { box-shadow: inset 0 0 0 4px var(--ink); }
.ui-as-brief__name { display: flex; flex: 1; flex-direction: column; min-width: 0; font-size: 13px; font-weight: 500; line-height: 18px; color: var(--ink); }
.ui-as-brief__option .ui-as-brief__name { color: inherit; }
.ui-as-brief__name > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-brief__name small { font-size: 12.5px; font-weight: 400; line-height: 17px; color: var(--faint); }
.ui-as-brief__signal { display: flex; flex: none; align-items: flex-end; gap: 2px; height: 11px; }
.ui-as-brief__signal i { width: 3px; border-radius: 1px; background: #d9d9d9; }
.ui-as-brief__signal i:nth-child(1) { height: 5px; }
.ui-as-brief__signal i:nth-child(2) { height: 8px; }
.ui-as-brief__signal i:nth-child(3) { height: 11px; }
.ui-as-brief__signal i[data-on] { background: var(--aui-success, #1e8a4f); }

.ui-as-brief__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ui-as-brief__pills span { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 4px 10px; border-radius: 999px; box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 12.5px; color: var(--text); }

.ui-as-brief__channel { display: flex; align-items: center; gap: 12px; min-height: 44px; }
/* The name and its switch: the library's Switch, across the rest of the row */
.ui-as-brief__toggle { flex: 1; min-width: 0; }
.ui-as-brief__channel > svg { flex: none; color: var(--muted); }
/* Small switch, drawn on the checkbox itself */

.ui-as-brief__swatches, .ui-as-brief__formats { display: flex; flex-wrap: wrap; gap: 10px 14px; white-space: nowrap; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-as-brief__swatches span, .ui-as-brief__formats span { display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* A long color or format name wraps under its swatch instead of running out of the card */
.ui-as-brief__swatches span, .ui-as-brief__formats span { max-width: 100%; white-space: normal; text-align: center; overflow-wrap: anywhere; }
.ui-as-brief__swatches i { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.ui-as-brief__formats span { justify-content: flex-end; min-height: 44px; }
.ui-as-brief__formats i { height: 24px; max-width: 36px; border: 1.5px solid var(--faint); border-radius: 4px; }

.ui-as-brief__details { display: grid; gap: 12px; margin: 0; }
.ui-as-brief__details div { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.ui-as-brief__details div { gap: 16px; }
.ui-as-brief__details dt { display: flex; flex: none; align-items: center; gap: 8px; color: var(--muted); }
.ui-as-brief__details dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

.ui-as-brief__panel { display: flex; flex: 1 0 auto; flex-direction: column; gap: 18px; animation: ui-as-rise 380ms var(--ease) both; }
/* An empty section: its empty state sits in the middle of the panel */
.ui-as-brief__panel:has(> .ui-as-empty[data-bare]) { justify-content: center; padding-bottom: 48px; }
.ui-as-ads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ui-as-ad { margin: 0; }
.ui-as-ad__art {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border-radius: 12px;
  background: var(--ad);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  color: var(--ad-ink);
}
/* Long headlines break where they must and stop after four lines */
.ui-as-ad__art b {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.ui-as-ad figcaption { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink); }
.ui-as-ad figcaption > * { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-ad figcaption b { flex: none; max-width: 60%; font-weight: 500; }
.ui-as-ad figcaption span { font-weight: 400; color: var(--muted); }
.ui-as-brief__assets > .ui-as-brief__label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-activity { flex: none !important; margin: 0; padding: 14px 12px 0; list-style: none; }
.ui-as-activity li { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
/* A fine line joins the icons into a timeline */
.ui-as-activity li:not(:last-child)::before { content: ""; position: absolute; top: 28px; bottom: 2px; left: 13px; width: 1px; background: var(--line); }
.ui-as-activity__icon { display: grid; flex: none; place-items: center; width: 27px; height: 27px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px var(--line-strong); color: var(--muted); }
.ui-as-activity__text { display: flex; flex-direction: column; min-width: 0; padding-top: 3px; overflow-wrap: anywhere; font-size: 13px; line-height: 19px; color: var(--ink); }
.ui-as-activity__text small { font-size: 12.5px; color: var(--faint); }

.ui-as-brief__go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 10px 10px 10px 12px;
  /* Stays in view at the bottom when the brief is taller than the work area */
  position: sticky;
  bottom: 0;
  z-index: 1;
}
/* A ring in the work area's white around it, so nothing shows past its rounded corners */
.ui-as-brief__go { box-shadow: inset 0 0 0 0.5px var(--line-strong), var(--shadow), 0 0 0 12px var(--card); }
/* Content scrolling under it fades out just above the bar; below it the white ring covers – a shadow, so it adds no
   scroll room and the bar doesn't creep up at the very end */
.ui-as-brief__go::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  pointer-events: none;
}
.ui-as-brief__go::before { bottom: calc(100% + 0.5px); height: 28px; background: linear-gradient(to bottom, transparent, var(--card) 85%); }
/* Scrolled to the end, the last card sits clear of the fade */
.ui-as-brief__panel > :nth-last-child(2) { margin-bottom: 12px; }
.ui-as-brief__tags { display: flex; gap: 4px; }
.ui-as-brief__tags span { padding: 3px 9px; border-radius: 999px; box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 12.5px; font-weight: 500; color: var(--text); }

/* Loading: gray bars in the real rows and cards; each bar sits in the middle of its line, the line keeps its height */
.ui-as-chat [data-skel], .ui-acs-brief [data-skel] { pointer-events: none; }
.ui-acs-line { display: flex; align-items: center; height: 1lh; font-style: normal; }
.ui-as-chat__answer > .ui-acs-p { display: flex; flex-direction: column; align-self: stretch; }
.ui-as-chat__answer .ui-as-chat__label { display: flex; }
/* The pills, swatches, formats and tags style every span in them – not the gray bars */
.ui-acs-brief :is(.ui-as-brief__pills, .ui-as-brief__swatches, .ui-as-brief__formats, .ui-as-brief__tags) .ui-as-skel { min-height: 0; padding: 0; box-shadow: none; }
/* The brief's files: chips in the shape of the App Shell's file chips */
.ui-acs-files { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-acs-file { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px 0 7px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); }
.ui-acs-brief .ui-as-empty__text { display: flex; flex-direction: column; align-items: center; }

:where(.dark, [data-theme="dark"]) .ui-as-brief__thumb { background: #3a3329; color: #d9cda5; }
:where(.dark, [data-theme="dark"]) .ui-as-brief__signal i:not([data-on]) { background: #3a3a3f; }

/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
.ui-as-chat__main > .ui-as-chat__bar { transition: padding 420ms var(--ease); }
/* While the brief is folded away its icon waits at the bar's right end – a long chat name stops before it */
.ui-as-app[data-panel="closed"] .ui-as-chat__main > .ui-as-chat__bar { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  /* …and for the brief's icon on the right, so the chat's ⋯ never sits under it */
  .ui-as-chat__main > .ui-as-chat__bar { padding-left: 52px; padding-right: 52px; }
}
@container ui-as (max-width: 600px) {
  /* Only the chat's name stays in the bar */
  .ui-as-chat__main .ui-as-chat__crumbs { min-width: 0; }
  .ui-as-chat__main .ui-as-chat__crumbs > :is(svg, i, .ui-as-chat__home) { display: none; }
  .ui-as-chat__main .ui-as-chat__crumbs { font-size: 0; }
  .ui-as-chat__main .ui-as-chat__crumbs > b { overflow: hidden; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
  .ui-as-chat__thread { padding: 24px 16px 12px; }
  .ui-as-chat__composer { padding: 6px 8px 8px; }
  .ui-as-chat__route { padding-left: 6px; }
}


/* The chat and its progress side by side, both part of the page – a line between them, the panel folds to nothing */
.ui-prg {
  --ui-prg-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --ui-prg-side: 300px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ui-prg-side);
  height: 100%;
  min-height: 0;
  overflow: clip;
  transition: grid-template-columns 360ms cubic-bezier(0.32, 0.72, 0.24, 1);
}
.ui-prg[data-panel="closed"] { grid-template-columns: minmax(0, 1fr) 0px; }
:where(.dark, [data-theme="dark"]) .ui-prg { --ui-prg-focus: var(--aui-focus, rgba(77, 141, 255, 0.8)); }
.ui-prg :is(button):focus-visible { outline: 2px solid var(--ui-prg-focus); outline-offset: 2px; }
.ui-prg-fold :is(button):focus-visible { outline-offset: -2px; }
.ui-prg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ----- The chat ----- */
.ui-prg-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ui-prg-bar { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 8px; height: 48px; padding: 0 12px 0 20px; }
.ui-prg-toggle { display: inline-flex; flex: none; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 12px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; transition: background-color 120ms ease; }
.ui-prg-toggle:hover { background: var(--hover); color: var(--ink); }
.ui-prg-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 24px 24px; }
.ui-prg-col { display: flex; flex-direction: column; gap: 18px; max-width: 680px; margin: 0 auto; }
.ui-prg-user { align-self: flex-end; max-width: 80%; margin: 0; padding: 9px 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--chip); font-size: 14px; line-height: 21px; color: var(--ink); overflow-wrap: anywhere; }
.ui-prg-answer { display: flex; flex-direction: column; gap: 10px; }
.ui-prg-text { font-size: 14px; line-height: 22px; color: var(--ink); overflow-wrap: anywhere; }
.ui-prg-text b { font-weight: 600; }
.ui-prg-text ul { margin: 6px 0 0; padding-left: 20px; }
.ui-prg-text li + li { margin-top: 3px; }

/* Tool calls: the library's Tool Call Card; app logos in its tile keep their own colors */
.ui-prg-logo { display: grid; place-items: center; width: 16px; height: 16px; }
.ui-prg-logo > svg { width: 15px; height: 15px; }
.ui-prg-answer > .ui-tclc { margin: 2px 0; }
.ui-prg-composer { flex: none; width: min(680px, calc(100% - 48px)); margin: 0 auto 20px; }
.ui-prg-composer > .ui-ccc { max-width: none; }

/* Folds: sections and tool details open and close smoothly */
.ui-prg-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 260ms cubic-bezier(0.32, 0.72, 0.24, 1); }
.ui-prg-fold[data-open] { grid-template-rows: 1fr; }
/* A little room at the sides, so card edges and focus rings inside a fold aren't cut */
.ui-prg-fold__in { min-height: 0; margin-inline: -4px; padding-inline: 4px; overflow: hidden; opacity: 0; transition: opacity 200ms ease; }
.ui-prg-fold[data-open] > .ui-prg-fold__in { opacity: 1; }
.ui-prg-chev { display: grid; flex: none; color: var(--muted); transition: transform 220ms ease; }
.ui-prg-chev[data-open] { transform: rotate(90deg); }
.ui-prg-spin { width: 12px; height: 12px; border: 1.5px solid var(--line-strong, var(--line)); border-top-color: var(--accent); border-radius: 50%; animation: ui-prg-spin 800ms linear infinite; }

/* ----- The panel: part of the page, a line on its left ----- */
.ui-prg-side { position: relative; min-width: 0; overflow: hidden; border-left: 1px solid var(--line); }
.ui-prg[data-panel="closed"] .ui-prg-side { border-left-color: transparent; }
.ui-prg-side__in { width: var(--ui-prg-side); height: 100%; overflow-y: auto; padding: 0 16px 20px; scrollbar-width: thin; }
.ui-prg-close { position: absolute; top: 12px; right: 12px; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); color: var(--muted); transition: background-color 120ms ease, color 120ms ease; }
.ui-prg-close:hover { background: var(--hover); color: var(--ink); }
/* Sections: the same room above and below the heading when folded; a line between them, inset like the content */
.ui-prg-section { padding: 12px 0; }
.ui-prg-section + .ui-prg-section { border-top: 1px solid var(--line); }
.ui-prg-section__head { margin: 0; transition: margin-bottom 260ms cubic-bezier(0.32, 0.72, 0.24, 1); }
.ui-prg-section[data-open] .ui-prg-section__head { margin-bottom: 6px; }
.ui-prg-section__head button { display: inline-flex; align-items: center; gap: 4px; height: 26px; margin-left: -6px; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); font-size: 13px; font-weight: 500; color: var(--ink); transition: background-color 120ms ease; }
.ui-prg-section__head button:hover { background: var(--hover); }

/* Progress: a line of steps, done ones checked, the running one turning, earlier ones folded away */
.ui-prg-trail { --ui-prg-rail: var(--line-strong, var(--line)); }
.ui-prg-steps { display: grid; margin: 0; padding: 0; list-style: none; }
.ui-prg-trail__earlier, .ui-prg-steps > li { position: relative; padding: 0 0 9px 26px; }
.ui-prg-steps > li:last-child { padding-bottom: 0; }
/* The line: one stretch per row, so it runs unbroken – dashed beside folded steps, stopping at the newest step's mark */
.ui-prg-trail__earlier::before, .ui-prg-steps > li::before { content: ""; position: absolute; top: 0; bottom: 0; left: 7px; width: 2px; border-radius: 1px; background: var(--ui-prg-rail); }
.ui-prg-trail__earlier::before { top: 3px; background: repeating-linear-gradient(to bottom, var(--ui-prg-rail) 0 3px, transparent 3px 6px); }
.ui-prg-trail__earlier[data-open]::before { background: var(--ui-prg-rail); }
.ui-prg-steps:first-child > li:first-child::before { top: 3px; }
/* A small gap before the newest step's mark – the line stops short of the circle */
.ui-prg-steps > li:last-child::before { display: none; }
.ui-prg-steps > li:nth-last-child(2)::before { bottom: 5px; }
.ui-prg-steps:first-child > li:only-child::before { display: none; }
.ui-prg-earlier { display: inline-flex; align-items: center; gap: 4px; margin: -2px 0 0 -6px; padding: 2px 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-prg-earlier:hover { background: var(--hover); color: var(--text); }
.ui-prg-steps > li { min-width: 0; font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-prg-steps > li[data-state="running"] { color: var(--ink); }
/* The newest step's mark: a gray dot with a check, a turning ring while it runs */
.ui-prg-step__mark { position: absolute; top: 1px; left: 0; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line-strong, var(--line)); color: var(--panel); }
.ui-prg-steps > li[data-state="done"] .ui-prg-step__mark { background: var(--muted); box-shadow: none; }
.ui-prg-steps > li[data-state="running"] .ui-prg-step__mark { box-shadow: none; }
.ui-prg-step__label { min-width: 0; overflow-wrap: anywhere; }

/* Outputs: the newest as a page, the rest as rows */
.ui-prg-preview { display: grid; gap: 2px; width: 100%; padding-top: 2px; text-align: left; }
.ui-prg-preview__meta { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ui-prg-preview__text { display: grid; min-width: 0; }
.ui-prg-page { display: grid; gap: 6px; height: 132px; overflow: hidden; margin-bottom: 6px; padding: 16px 18px; border-radius: 10px; background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0, 0, 0, 0.05); transition: box-shadow 160ms ease; }
.ui-prg-preview:hover .ui-prg-page { box-shadow: 0 0 0 1px var(--line-strong, var(--line)), 0 3px 10px -4px rgba(0, 0, 0, 0.14); }
.ui-prg-page b { font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-prg-page i { font-size: 10.5px; font-style: normal; line-height: 15px; color: var(--text); }
.ui-prg-page__lines { display: grid; gap: 6px; padding-top: 4px; }
.ui-prg-page__lines span { height: 5px; border-radius: 3px; background: var(--chip); }
.ui-prg-page__lines span:nth-child(2) { width: 82%; }
.ui-prg-page__lines span:nth-child(3) { width: 64%; }
.ui-prg-preview__name { font-size: 12.5px; line-height: 18px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-prg-preview__source { font-size: 11.5px; line-height: 16px; color: var(--muted); }
.ui-prg-files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin: 8px -4px 0; padding: 0; list-style: none; }
.ui-prg-row { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; height: 32px; padding: 0 4px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); text-align: left; transition: background-color 120ms ease; }
button.ui-prg-row:hover { background: var(--hover); }
.ui-prg-row__mark { display: grid; flex: none; place-items: center; width: 18px; height: 18px; }
.ui-prg-row__mark > svg { width: 18px; height: 18px; }
.ui-prg-row__mark--icon { color: var(--muted); }
.ui-prg-row__mark--icon > svg { width: 16px; height: 16px; }
.ui-prg-row__name { flex: 1; min-width: 0; font-size: 12.5px; line-height: 18px; color: var(--text); }
.ui-prg-name { display: flex; min-width: 0; white-space: nowrap; }
.ui-prg-name__head { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-prg-name__tail { flex: none; }
.ui-prg-blank { padding: 12px 0 8px; }
.ui-prg-row__meta { flex: none; max-width: 50%; overflow: hidden; font-size: 11.5px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-prg-logos { display: inline-flex; flex: none; gap: 6px; }
.ui-prg-logos > svg { width: 15px; height: 15px; }

/* Loading: gray shapes in the real containers – the bars sit centered in the real line heights */
.ui-prg [data-skel] { pointer-events: none; }
.ui-prg-skel-line { display: flex; align-items: center; min-width: 0; }
.ui-prg-skel-user { align-self: flex-end; }
.ui-prg-skel-card { display: flex; align-items: center; gap: 10px; height: 44px; margin: 2px 0; padding: 0 14px; border-radius: var(--aui-radius-lg, 10px); background: var(--panel); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0, 0, 0, 0.05); }
.ui-prg-skel-card > .ui-as-skel:nth-child(3) { flex: 0 1 auto; min-width: 0; }
.ui-prg-skel-card__end { display: flex; flex: none; align-items: center; gap: 6px; margin-left: auto; }
.ui-prg-skel-copy { position: relative; }
.ui-prg-skel-copy > i { font-style: normal; visibility: hidden; }
.ui-prg-skel-copy > .ui-as-skel { position: absolute; top: 50%; left: 6px; translate: 0 -50%; }
.ui-prg-skel-mark { position: absolute; top: 1px; left: 0; }
.ui-prg-skel-page { margin-bottom: 6px; }

/* Narrow: the panel slides over the chat from the right and closes with its × */
@container ui-as-main (max-width: 720px) {
  .ui-prg, .ui-prg[data-panel="closed"] { grid-template-columns: minmax(0, 1fr); }
  .ui-prg-side { position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; width: min(var(--ui-prg-side), calc(100% - 40px)); background: var(--panel); box-shadow: -12px 0 32px -16px rgba(0, 0, 0, 0.25); transition: translate 320ms cubic-bezier(0.32, 0.72, 0.24, 1), visibility 0s; }
  .ui-prg[data-panel="closed"] .ui-prg-side { visibility: hidden; translate: 100% 0; transition: translate 280ms ease, visibility 0s 280ms; }
  .ui-prg-side__in { width: 100%; }
  .ui-prg-bar { padding-left: 52px; }
  .ui-prg-thread { padding: 8px 16px 16px; }
  .ui-prg-composer { width: calc(100% - 16px); margin-bottom: 8px; }
}
@media (pointer: coarse) {
  .ui-prg-row { min-height: 36px; }
}
@keyframes ui-prg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ui-prg, .ui-prg *, .ui-prg *::before { transition: none !important; animation: none !important; }
}


.ui-aib, .ui-aib-modal { --ui-aib-focus: var(--aui-focus, rgba(0, 96, 226, 0.7)); --aib-blue: var(--aui-blue, #0190fe); --aib-amber: var(--aui-amber, #e8b000); --aib-green: var(--aui-success, #1e8a4f); --aib-red: var(--aui-red, #f04438); }
:where(.dark, [data-theme="dark"]) :is(.ui-aib, .ui-aib-modal) { --ui-aib-focus: var(--aui-focus, rgba(77, 141, 255, 0.8)); --aib-blue: #4fb0fe; --aib-amber: #e6c24d; --aib-green: #5fc88a; --aib-red: #ff6b5f; }
.ui-aib { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; container: ui-aib / inline-size; }
.ui-aib :focus-visible, .ui-aib-modal :focus-visible { outline: 2px solid var(--ui-aib-focus); outline-offset: 2px; }
.ui-aib-modal textarea:focus-visible { outline: none; }
.ui-aib ul, .ui-aib ol { margin: 0; padding: 0; list-style: none; }
.ui-aib-num { font-variant-numeric: tabular-nums; }
.ui-aib-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.ui-aib__tools { display: flex; flex: none; align-items: center; gap: 4px; }
/* Board / List: two icons – the chosen one on a square gray fill, its name in a tip */
.ui-aib__views { display: inline-flex; gap: 2px; margin-right: 4px; }
.ui-aib__views button { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-aib__views button:hover { color: var(--ink); }
.ui-aib__views button[aria-checked="true"] { background: var(--chip); color: var(--ink); }
.ui-aib__views button::after { content: attr(data-tip); position: absolute; z-index: 40; top: calc(100% + 6px); left: 50%; padding: 3px 7px; border-radius: 6px; background: var(--ink); font-size: 12px; line-height: 16px; color: var(--card); white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, -2px); transition: opacity 120ms ease, transform 120ms ease; }
.ui-aib__views button:hover::after, .ui-aib__views button:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 400ms; }
.ui-aib__views button:focus-visible::after { transition-delay: 0ms; }
.ui-aib__tool { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-aib__tool:hover, .ui-aib__tool[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.ui-aib__tool[data-active] { color: var(--ink); }
.ui-aib__menu .ui-as-menu { min-width: 200px; }
.ui-aib__badge { display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--chip); font-size: 11px; color: var(--ink); }

/* ---------- Toolbar: which tasks, and a new one ---------- */
.ui-aib__toolbar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--as-head-h, 48px); padding: 10px 12px 10px 14px; box-sizing: border-box; }
.ui-aib__scopes { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; margin: -2px; padding: 2px; }
.ui-aib__scopes::-webkit-scrollbar { display: none; }
.ui-aib__scopes button { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 13px; color: var(--muted); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-aib__scopes button:hover { color: var(--ink); }
.ui-aib__scopes button[aria-selected="true"] { background: var(--chip); font-weight: 500; color: var(--ink); }
.ui-aib__scopes button span { font-size: 12px; font-weight: 400; color: var(--faint); }
.ui-aib__new { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 10px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--aui-primary, var(--ink)); font-size: 13px; font-weight: 500; color: var(--aui-on-primary, var(--card)); white-space: nowrap; transition: opacity 140ms ease; }
.ui-aib__new:hover:not(:disabled) { opacity: 0.88; }
.ui-aib__new:disabled { opacity: 0.35; cursor: default; }
.ui-aib-modal__foot .ui-aib__new { height: 32px; padding: 0 14px; }

/* ---------- Board: three gray columns, white cards ---------- */
/* The whole board scrolls, not each column – so no column ever clips a card's edge or its shadow on hover */
.ui-aib__board { display: flex; flex: 1; align-items: flex-start; gap: 10px; min-height: 0; padding: 2px 12px 16px; overflow: auto; overscroll-behavior-x: contain; }
.ui-aib-col { display: flex; flex: 1 1 0; max-width: 320px; flex-direction: column; min-width: 0; padding: 4px 4px 6px; border-radius: calc(var(--aui-radius-lg, 10px) + 4px); background: var(--frame); }
.ui-aib-col__head { display: grid; grid-template-columns: minmax(24px, auto) minmax(0, 1fr) minmax(24px, auto); align-items: center; height: 36px; padding: 0 6px; }
.ui-aib-col__head > svg { margin-left: 2px; }
.ui-aib-col__label { overflow: hidden; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-aib-col__count { justify-self: end; min-width: 20px; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 11.5px; line-height: 18px; text-align: center; color: var(--muted); }
.ui-aib-col__cards { display: flex; flex-direction: column; gap: 6px; }
.ui-aib-col__empty { margin: 6px 8px 8px; font-size: 12.5px; color: var(--faint); }

/* Card */
.ui-aib-card { flex: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); transition: box-shadow 160ms ease; }
.ui-aib-card:hover { box-shadow: var(--card-shadow-hover); }
.ui-aib-card__main { container: aib-card / inline-size; display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 14px 10px; border-radius: var(--aui-radius-lg, 10px); text-align: left; }
/* Drawn on the card's edge, so the scrolling column doesn't cut it off */
.ui-aib-card__main:focus-visible { outline-offset: -2px; }
.ui-aib-card__title { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 20px; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-aib-card__title > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Every card the same height: two lines of detail, longer text ends in "…" – open, it shows all of it */
.ui-aib-card__text { display: -webkit-box; height: 38px; margin-left: 24px; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; font-size: 12.5px; line-height: 19px; color: var(--muted); }
.ui-aib-card__text[data-empty] { color: var(--faint); }
.ui-aib-card--skel .ui-aib-card__text { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.ui-aib-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; margin: 2px 0 0 24px; font-size: 12.5px; color: var(--text); }
.ui-aib-foot__state { display: inline-flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.ui-aib-foot__word { min-width: 2.6em; overflow: hidden; text-overflow: ellipsis; }
.ui-aib-foot__state > .ui-aib-num { flex: none; margin-left: -3px; }
.ui-aib-counts { display: inline-flex; flex: none; align-items: center; margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-aib-counts > span { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; }
.ui-aib-counts > span:last-child { padding-right: 0; }
.ui-aib-counts > span + span { box-shadow: -0.5px 0 0 var(--line-strong); }

@container aib-card (max-width: 300px) {
  .ui-aib-card:is([data-status="running"], [data-status="waiting"]) :is(.ui-aib-foot__word, .ui-aib-foot__dot), .ui-aib-card[data-status="done"] .ui-aib-foot__word { display: none; }
  .ui-aib-card .ui-aib-foot__time { margin-left: 0; }
}

/* State marks */
.ui-aib-state { flex: none; width: 13px; height: 13px; color: var(--aib-blue); }
.ui-aib-state[data-status="running"] { animation: ui-aib-spin 900ms linear infinite; }
.ui-aib-col__head .ui-aib-state[data-status="running"], .ui-aib-group__head .ui-aib-state[data-status="running"] { animation: none; }
.ui-aib-state[data-status="waiting"] { color: var(--aib-amber); }
.ui-aib-state[data-status="done"] { color: var(--aib-green); }
.ui-aib-state[data-status="failed"] { color: var(--aib-red); }
.ui-aib-state[data-status="stopped"] { color: var(--faint); }

/* The agent's pixel mark: 3×3 squares in its color; they twinkle in a diagonal wave while it works */
.ui-aib-agent { --aib-mark: rgba(0, 96, 226, 0.78); display: grid; flex: none; grid-template-columns: repeat(3, 3px); grid-auto-rows: 3px; gap: 1.5px; place-content: center; width: 16px; height: 16px; }
:where(.dark, [data-theme="dark"]) .ui-aib-agent:not([style]) { --aib-mark: rgba(77, 141, 255, 0.85); }
.ui-aib-agent i { border-radius: 0.75px; background: var(--aib-mark); opacity: 0; }
.ui-aib-agent i[data-on] { opacity: 1; }
.ui-aib-agent[data-busy] i { animation: ui-aib-pixel 1.2s ease-in-out infinite both; }
.ui-aib-agent[data-busy] i:not([data-on]) { opacity: 0.16; }

.ui-aib-steps { position: relative; display: grid; gap: 6px; padding-left: 14px !important; }
.ui-aib-steps li { position: relative; display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; line-height: 18px; color: var(--text); }
.ui-aib-steps li::before { content: ""; position: absolute; top: 7px; left: -14px; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.ui-aib-steps li:not(:last-child)::after { content: ""; position: absolute; top: 15px; bottom: -9px; left: -12px; width: 1px; background: var(--line); }
.ui-aib-steps li[data-last]::before { background: var(--ink); }
.ui-aib-steps li > span { min-width: 0; overflow-wrap: anywhere; }
.ui-aib-steps time { flex: none; max-width: 45%; color: var(--faint); text-align: end; }
.ui-aib-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 12.5px; font-weight: 500; color: var(--ink); transition: box-shadow 140ms ease, opacity 140ms ease; }
.ui-aib-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-aib-btn--primary { background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-aib-btn--primary:hover { box-shadow: none; opacity: 0.88; }

/* ---------- Panel ---------- */
.ui-aib-panel { --ui-aib-focus: var(--aui-focus, rgba(0, 96, 226, 0.7)); --aib-blue: var(--aui-blue, #0190fe); --aib-amber: var(--aui-amber, #e8b000); --aib-green: var(--aui-success, #1e8a4f); --aib-red: var(--aui-red, #f04438); display: flex; flex-direction: column; gap: 24px; padding: 8px 8px 24px; }
:where(.dark, [data-theme="dark"]) .ui-aib-panel { --ui-aib-focus: var(--aui-focus, rgba(77, 141, 255, 0.8)); --aib-blue: #4fb0fe; --aib-amber: #e6c24d; --aib-green: #5fc88a; --aib-red: #ff6b5f; }
.ui-aib-panel :focus-visible { outline: 2px solid var(--ui-aib-focus); outline-offset: 2px; }
.ui-aib-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-aib-panel__head { display: grid; gap: 8px; }
.ui-aib-panel__title { margin: 0; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); overflow-wrap: anywhere; }
.ui-aib-panel__desc { margin: 0; font-size: 13px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.ui-aib-panel__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ui-aib-props { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; row-gap: 10px; margin: 0; font-size: 13px; }
.ui-aib-props dt { color: var(--muted); }
.ui-aib-props dd { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; color: var(--ink); }
.ui-aib-props dd > svg { flex: none; color: var(--muted); }
.ui-aib-props dd > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-aib-faint { color: var(--faint); }
.ui-aib-panel__section { display: grid; gap: 12px; }
.ui-aib-panel__label { display: flex; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-aib-panel__label span { font-weight: 400; color: var(--faint); }
.ui-aib-panel .ui-aib-steps { margin: 0; list-style: none; gap: 10px; padding: 12px 14px 12px 28px !important; border-radius: 10px; background: color-mix(in srgb, var(--ink) 3.5%, var(--card)); }
.ui-aib-panel .ui-aib-steps li { font-size: 13px; line-height: 20px; }
.ui-aib-panel .ui-aib-steps li::before { top: 8px; }
.ui-aib-panel .ui-aib-steps li:not(:last-child)::after { top: 16px; bottom: -11px; }
.ui-aib-panel .ui-aib-steps li::before { background: color-mix(in srgb, var(--ink) 22%, var(--card)); }
.ui-aib-panel .ui-aib-steps li[data-last]::before { background: var(--ink); }
.ui-aib-panel .ui-aib-steps li:not(:last-child)::after { background: color-mix(in srgb, var(--ink) 12%, var(--card)); }
.ui-aib-panel p { margin: 0; font-size: 13px; }
/* Loading: each gray bar centered in the line it stands in for */
.ui-aib-panel--skel { pointer-events: none; }
.ui-aib-skel { display: flex; align-items: center; height: 20px; }
.ui-aib-props__skel { display: contents; }
.ui-aib-props__skel > * { align-self: center; }
.ui-aib-props:has(.ui-aib-props__skel) { grid-auto-rows: 20px; }
.ui-aib-steps--skel { display: grid; gap: 10px; }

/* ---------- List: the same tasks under gray heads, one row each ---------- */
.ui-aib__list { flex: 1; min-height: 0; padding: 0 12px 16px; overflow: auto; }
.ui-aib-group { display: flex; flex-direction: column; gap: 2px; }
.ui-aib-group + .ui-aib-group { margin-top: 14px; }
.ui-aib-group__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; height: 34px; margin-bottom: 4px; padding: 0 8px 0 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 5px); background: linear-gradient(var(--frame), var(--frame)), var(--card); font-size: 12.5px; font-weight: 500; color: var(--ink); }
.ui-aib-group__head .ui-aib-col__count { margin-left: 2px; }
.ui-aib-group .ui-aib-col__empty { margin: 4px 12px; }
.ui-aib-rows { display: flex; flex-direction: column; gap: 2px; }
.ui-aib-row { border-radius: calc(var(--aui-radius-sm, 5px) + 5px); transition: background-color 120ms ease; }
.ui-aib-row:hover { background: var(--hover); }
.ui-aib-row__main { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px; border-radius: inherit; font-size: 13px; text-align: left; }
.ui-aib-row__main:focus-visible { outline-offset: -2px; }
.ui-aib-row__title { flex: none; max-width: 34%; overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-aib-row__text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-aib-row__end { flex: none; width: 290px; margin-left: auto; }
.ui-aib-row__end .ui-aib-foot { margin: 0; gap: 16px; }

/* No tasks at all */
.ui-aib__none { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 0 12px 12px; }
.ui-aib__none > .ui-as-empty { flex: 1; justify-content: center; margin-top: 0; }
.ui-aib [data-skel] { pointer-events: none; }

/* ---------- New task ---------- */
.ui-aib-modal { position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: rgba(0, 0, 0, 0.16); animation: ui-aib-fade 180ms ease both; }
:where(.dark, [data-theme="dark"]) .ui-aib-modal { background: rgba(0, 0, 0, 0.4); }
.ui-aib-modal__box { display: flex; flex-direction: column; width: 100%; max-width: 480px; max-height: 100%; overflow: auto; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, 0 0 0 0.5px var(--line-strong), 0 24px 48px -12px rgba(0, 0, 0, 0.25)); animation: ui-aib-in 240ms var(--ease, cubic-bezier(0.32, 0.72, 0.24, 1)) both; }
.ui-aib-modal__head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 12px 4px 20px; }
.ui-aib-modal__heading { display: grid; flex: 1; min-width: 0; }
.ui-aib-modal__heading b { font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); }
.ui-aib-modal__heading small { font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-aib-modal__body { display: grid; gap: 16px; padding: 16px 20px 20px; }
.ui-aib-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; box-shadow: inset 0 0.5px 0 var(--line); }
.ui-aib-modal__cancel { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: var(--text); transition: background-color 140ms ease; }
.ui-aib-modal__cancel:hover { background: var(--hover); color: var(--ink); }
.ui-aib-field { display: grid; gap: 6px; }
.ui-aib-field > span { font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-aib-field textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 0; border-radius: 8px; background: var(--frame); box-shadow: inset 0 0 0 0.5px var(--line); font: inherit; font-size: 13px; line-height: 20px; color: var(--ink); resize: vertical; outline: none; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-aib-field textarea::placeholder { color: var(--placeholder, var(--faint)); }
.ui-aib-field textarea:focus { background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.04); }
.ui-aib-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-aib-pick button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 8px; border-radius: 8px; box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-aib-pick button:hover { color: var(--ink); }
.ui-aib-pick button[aria-checked="true"] { background: var(--chip); box-shadow: none; font-weight: 500; color: var(--ink); }

@keyframes ui-aib-spin { to { transform: rotate(360deg); } }
@keyframes ui-aib-pixel { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes ui-aib-fade { from { opacity: 0; } }
@keyframes ui-aib-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* Narrow: the columns stack like the list, the row's end moves under the title */
@container ui-aib (max-width: 760px) {
  .ui-aib__board { flex-direction: column; align-items: stretch; overflow-x: hidden; }
  .ui-aib-col { flex: none; max-width: none; }
  .ui-aib-col__head { grid-template-columns: minmax(24px, auto) auto minmax(0, 1fr); gap: 2px; }
  .ui-aib-col__label { text-align: left; }
  .ui-aib-row__text { display: none; }
  .ui-aib-row__title { flex: 1; max-width: none; }
}
@container ui-aib (max-width: 560px) {
  .ui-aib__tool-label { display: none; }
  /* The tools go on a line of their own above the tabs, so the tabs keep their room */
  .ui-aib__toolbar { flex-wrap: wrap; row-gap: 8px; }
  .ui-aib__tools { order: 1; margin-left: auto; }
  /* The tabs line starts at the board's edge, not after the sidebar button the line above makes room for */
  .ui-aib__scopes { order: 2; flex: 1 1 100%; margin-left: -32px; margin-right: -40px; }
  .ui-aib__scopes { mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); padding-right: 20px; }
  .ui-aib__new > span { display: none; }
  .ui-aib__new { width: 28px; padding: 0; justify-content: center; }
  .ui-aib-row__main { height: auto; min-height: 42px; flex-wrap: wrap; row-gap: 2px; padding: 10px 12px; }
  .ui-aib-row__title { flex: 1 1 0; }
  .ui-aib-row__end { width: 100%; padding-left: 28px; }
  .ui-aib-card__text, .ui-aib-foot { margin-left: 0; }
}
.ui-as-app[data-panel="closed"] .ui-aib__toolbar { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-aib__toolbar { padding-left: 46px; padding-right: 52px; }
}
@media (pointer: coarse) {
  .ui-aib__views button, .ui-aib__tool, .ui-aib__scopes button, .ui-aib__new, .ui-aib-btn, .ui-aib-pick button { min-height: 36px; }
  .ui-aib__new, .ui-aib__views button { min-width: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-aib *, .ui-aib *::before, .ui-aib-modal, .ui-aib-modal__box { animation: none !important; transition: none !important; }
}


/* Memory: a list grouped by where it applies; the open memory sits in the shell's work area on the right */
.ui-am, .ui-am-panel {
  --ui-am-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --am-wait-bg: #ff9c0029;
  --am-wait-fg: var(--aui-warning, #b25e00);
  --am-out: cubic-bezier(0.23, 1, 0.32, 1);
  --am-row-h: 40px;
  /* The group heads' gray – a step deeper than the rows' hover */
  --am-head: color-mix(in srgb, var(--ink) 4.5%, var(--panel));
  --am-head-hover: color-mix(in srgb, var(--ink) 7%, var(--panel));
  /* The recall: a soft purple, only ever in the sheen */
  --am-c-purple: var(--aui-purple, #a651f0);
  --am-c-blue: var(--aui-blue, #0190fe);
  --am-c-green: var(--aui-green, #5fc88a);
  --am-c-orange: var(--aui-orange, #f28a2e);
  --am-c-teal: var(--aui-teal, #13b3a0);
  --am-c-amber: var(--aui-amber, #e8b000);
  --am-c-pink: var(--aui-pink, #ee3e9e);
}
:where(.dark, [data-theme="dark"]) :is(.ui-am, .ui-am-panel) {
  --ui-am-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --am-wait-bg: #fb6a0025;
  --am-wait-fg: var(--aui-warning, #ffb35c);
  --am-c-purple: var(--aui-purple, #b98af0);
  --am-c-blue: var(--aui-blue, #4fb0fe);
  --am-c-green: var(--aui-green, #7dcf9f);
  --am-c-orange: var(--aui-orange, #f2a15c);
  --am-c-teal: var(--aui-teal, #4fc3b4);
  --am-c-amber: var(--aui-amber, #e6c24d);
  --am-c-pink: var(--aui-pink, #f06db5);
}
.ui-am {
  position: relative;
  container: ui-am / inline-size;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
.ui-am-num { font-variant-numeric: tabular-nums; }
.ui-am-faint { color: var(--faint); }
.ui-am-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:is(.ui-am, .ui-am-panel) :focus-visible { outline: 2px solid var(--ui-am-focus); outline-offset: 2px; }
/* A text field shows its caret, never a ring */
:is(.ui-am, .ui-am-panel) :is(input, textarea):focus-visible { outline: none; }
:is(.ui-am, .ui-am-panel) [data-quiet]:focus-visible { outline: none; }

/* ---------- Head: the title and its count, Saved / To review, search, Remember ---------- */
.ui-am-head { display: flex; flex: none; align-items: center; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-am-title { display: flex; flex: none; align-items: baseline; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-am-title__count { font-size: 13px; font-weight: 400; color: var(--faint); }
.ui-am-seg { display: flex; flex: none; gap: 2px; }
.ui-am-seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-am-seg button:hover { color: var(--ink); }
.ui-am-seg button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.ui-am-seg__short { display: none; }
/* The only color: what waits for your OK */
.ui-am-badge { min-width: 18px; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--am-wait-bg); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--am-wait-fg); text-align: center; animation: ui-am-pop 320ms var(--am-out) both; }

/* Search: a quiet field – the edge firms up while you type, no ring */
.ui-am-search { display: flex; flex: 0 1 220px; align-items: center; gap: 6px; min-width: 0; height: 28px; margin-left: auto; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--chip); color: var(--faint); cursor: text; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-am-search:focus-within { background: var(--card); box-shadow: var(--card-shadow-hover); }
.ui-am-search > svg { flex: none; }
.ui-am-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; appearance: none; }
.ui-am-search input::placeholder { color: var(--placeholder); }
.ui-am-search input::-webkit-search-cancel-button { display: none; }
.ui-am-head__new { position: relative; }

.ui-am-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; cursor: pointer; user-select: none; transition: box-shadow 140ms ease, background-color 140ms ease, filter 140ms ease, opacity 140ms ease, color 140ms ease; }
.ui-am-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-am-btn > svg { flex: none; color: var(--muted); }
.ui-am-btn:has(> svg:first-child) { padding-left: 8px; }
.ui-am-btn--quiet { background: none; box-shadow: none; color: var(--text); }
.ui-am-btn--quiet:hover { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-am-btn--dark { background: var(--ink); box-shadow: none; color: var(--card); }
.ui-am-btn--dark > svg { color: inherit; }
.ui-am-btn--dark:hover { box-shadow: none; filter: brightness(1.15); }
.ui-am-btn--dark[aria-disabled] { opacity: 0.4; cursor: default; filter: none; }
.ui-am-btn--danger:hover { color: #d94820; }
.ui-am-btn--danger:hover > svg { color: inherit; }
:where(.dark, [data-theme="dark"]) .ui-am-btn--danger:hover { color: var(--aui-red, #ff6b5f); }
.ui-am-btn--sm { height: 24px; padding: 0 8px; font-size: 12px; }
.ui-am-btn:active:not([aria-disabled]) { transform: scale(0.97); }

/* ---------- Remember: one line under the head ---------- */
/* Above the list: its menu (Applies to) opens over the rows – the rows' own layers (the recall sheen) stay below */
.ui-am-new { position: relative; z-index: 4; display: flex; flex: none; align-items: flex-start; gap: 8px; min-height: 48px; margin: 8px 8px 0; padding: 8px 6px 8px 12px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--card); box-shadow: var(--card-shadow); animation: ui-am-drop 240ms var(--am-out) both; transition: box-shadow 140ms ease; }
.ui-am-new:has(.ui-am-new__input:focus) { box-shadow: var(--card-shadow-hover); }
.ui-am-new__glyph { margin-top: 6px; }
.ui-am-new > :is(.ui-am-btn, .ui-am-scope, .ui-as-anchor) { flex: none; margin-top: 2px; }
.ui-am-new__input { flex: 1; min-width: 0; min-height: 32px; max-height: 168px; padding: 6px 0; overflow-y: auto; border: 0; background: none; font: inherit; font-size: 13px; line-height: 20px; color: var(--ink); outline: none; resize: none; field-sizing: content; overscroll-behavior: contain; }
.ui-am-new__input::placeholder { color: var(--placeholder); }
.ui-am-scope { flex: none; min-width: 0; }
.ui-am-scope .ui-am-btn { max-width: 170px; }
.ui-am-scope__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-am-scope__icon { display: grid; flex: none; place-items: center; color: var(--muted); }

/* ---------- List ---------- */
.ui-am-scroll { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; }
.ui-am-tree { padding: 8px 8px 72px; outline: none; }
.ui-am-center { display: grid; flex: 1; place-items: center; padding: 40px 24px 80px; }
.ui-am-group { display: flex; flex-direction: column; gap: 2px; }
.ui-am-group + .ui-am-group { margin-top: 14px; }

/* A group's head: a gray, rounded fill like the Kanban list – its icon in the group's color, the count in a chip, the chevron right */
.ui-am-ghead { display: flex; align-items: center; gap: 8px; height: 34px; margin-bottom: 4px; padding: 0 8px 0 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--am-head); cursor: pointer; user-select: none; transition: background-color 140ms ease, filter 140ms ease; }
.ui-am-ghead:hover { background: var(--am-head-hover); }
.ui-am :is(.ui-am-ghead, .ui-am-row):focus-visible { outline: none; }
.ui-am[data-kb] :is(.ui-am-ghead, .ui-am-row):focus-visible { outline: 2px solid var(--ui-am-focus); outline-offset: -2px; }
.ui-am-ghead__chev { display: grid; flex: none; place-items: center; width: 20px; margin-left: auto; color: var(--faint); transition: transform 200ms var(--am-out); }
.ui-am-ghead[aria-expanded="false"] .ui-am-ghead__chev { transform: rotate(-90deg); }
.ui-am-ghead__icon { display: grid; flex: none; place-items: center; color: var(--am-tone, var(--text)); }
.ui-am-ghead__name { min-width: 0; overflow: hidden; font-size: 12.5px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-am-ghead__count { flex: none; min-width: 20px; margin-left: 2px; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--card); box-shadow: 0 0 0 0.5px var(--line); font-size: 11.5px; line-height: 18px; text-align: center; color: var(--muted); }

.ui-am-row { position: relative; display: flex; align-items: center; gap: 12px; height: var(--am-row-h); padding: 0 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); cursor: pointer; font-size: 13px; line-height: 20px; isolation: isolate; transition: background-color 140ms ease; }
.ui-am-row:hover { background: var(--hover); }
.ui-am-row[aria-selected="true"] { background: var(--chip); }
/* Where it came from: a small gray glyph – the words stay black */
.ui-am-glyph { display: grid; flex: none; place-items: center; width: 16px; color: var(--muted); }
.ui-am-row__text { flex: 1; min-width: 0; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; text-align: left; }
/* Right-to-left text in a left-to-right list still starts at the glyph – and the other way round on an RTL page */
.ui-am-row:dir(rtl) .ui-am-row__text { text-align: right; }
.ui-am-row[data-review] .ui-am-row__text { color: var(--text); }
/* Source, uses and time in fixed columns, so they line up from row to row */
.ui-am-row__source { flex: none; width: 92px; overflow: hidden; font-size: 12px; color: var(--faint); white-space: nowrap; text-overflow: ellipsis; text-align: right; }
.ui-am-row__uses { flex: none; width: 46px; white-space: nowrap; overflow: hidden; font-size: 12px; color: var(--faint); text-align: right; }
.ui-am-row__uses > span { display: inline-block; }
.ui-am-row__time { flex: none; width: 28px; font-size: 12px; color: var(--muted); text-align: right; }
.ui-am-row__acts { display: flex; flex: none; gap: 4px; margin-right: -6px; }

/* The recall: a soft sheen runs through the row with a glowing leading edge, the count ticks up, the time says now */
.ui-am-row::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0; }
.ui-am-row[data-recalled]::after {
  background:
    linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--am-c-purple) 10%, transparent) 70%, color-mix(in srgb, var(--am-c-purple) 34%, transparent) 99%, transparent 100%) no-repeat;
  background-size: 45% 100%;
  animation: ui-am-sheen 1600ms cubic-bezier(0.45, 0, 0.25, 1) both;
}
.ui-am-row[data-recalled] .ui-am-glyph { animation: ui-am-glyph 1600ms var(--am-out) both; }
.ui-am-row[data-recalled] .ui-am-row__uses > span { animation: ui-am-tick 420ms var(--am-out) both; }
.ui-am-row[data-recalled] :is(.ui-am-row__uses, .ui-am-row__time) { color: var(--ink); transition: color 600ms ease; }
/* A new row glides in at the top of its group; a forgotten one folds away */
.ui-am-row[data-fresh] { overflow: hidden; animation: ui-am-glide 380ms var(--am-out) both; }
.ui-am-row[data-leaving] { overflow: hidden; pointer-events: none; animation: ui-am-leave 300ms var(--am-out) both; }

/* ---------- Undo ---------- */
.ui-am-undo { position: absolute; bottom: 16px; left: 50%; z-index: 5; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); height: 36px; padding: 0 4px 0 12px; border-radius: calc(var(--aui-radius-lg, 10px) - 2px); background: var(--ink); color: var(--card); font-size: 13px; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.3); transform: translateX(-50%); animation: ui-am-rise 260ms var(--am-out) both; }
.ui-am-undo > svg { flex: none; opacity: 0.7; }
.ui-am-undo__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-am-undo__btn { flex: none; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-weight: 500; color: inherit; transition: background-color 140ms ease; }
.ui-am-undo__btn:hover { background: color-mix(in srgb, var(--card) 14%, transparent); }
.ui-am-undo__btn:focus-visible { outline: 2px solid var(--ui-am-focus); outline-offset: -2px; }

/* ---------- Memory panel – in the shell's work area on the right ---------- */
/* Loading: the same group heads and fixed rows, gray bars in place of the text, each centered in its line */
.ui-am [data-skel] { pointer-events: none; }
.ui-am-skel-text { display: flex; flex: 1; align-items: center; min-width: 0; height: 20px; }
.ui-am-skel-cell { display: flex; align-items: center; justify-content: flex-end; height: 20px; }
.ui-am-skel-lines { display: grid; }
.ui-am-skel-line { display: flex; align-items: center; min-width: 0; height: 20px; }

.ui-am-panel { display: flex; flex-direction: column; gap: 20px; padding: 2px 4px 16px; }
.ui-am-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-am-panel :focus-visible { outline-offset: -2px; }
.ui-am-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-am-note > svg { flex: none; margin-top: 1px; }
/* Its words: you edit them in place – a quiet card edge shows up on hover and firms up while you type */
.ui-am-panel__text { display: block; width: calc(100% + 20px); min-height: 40px; margin: -8px -10px; padding: 8px 10px; border: 0; border-radius: calc(var(--aui-radius, 7px) + 1px); background: none; font: inherit; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); outline: none; resize: none; overflow: hidden; field-sizing: content; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-am-panel__text:hover { background: var(--hover); }
.ui-am-panel__text:focus { background: var(--card); box-shadow: var(--card-shadow-hover); }
.ui-am-props { display: grid; gap: 2px; margin: 0; }
.ui-am-props > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; min-height: 28px; }
.ui-am-props dt { font-size: 12px; color: var(--muted); }
.ui-am-props dd { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; color: var(--ink); }
.ui-am-props dd > svg { flex: none; color: var(--muted); }
.ui-am-props dd > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* The value keeps its room; the faint when gives way first */
.ui-am-props dd > span:not(.ui-am-faint) { flex: 0 1 auto; }
.ui-am-props dd > span.ui-am-faint { flex: 0 1000 auto; }
.ui-am-props .ui-am-scope { margin-left: -8px; }
.ui-am-props .ui-am-scope__btn { color: var(--ink); }
.ui-am-section { display: flex; flex-direction: column; gap: 8px; }
.ui-am-label { display: flex; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
/* Where it came from: your own words on a light tray that reaches out past the column */
.ui-am-quote { --am-tray: color-mix(in srgb, var(--ink) 2.5%, var(--panel)); display: grid; gap: 6px; margin: 0 -10px; padding: 10px 10px 6px; border-radius: var(--aui-radius-lg, 10px); background: var(--am-tray); }
.ui-am-quote__q { margin: 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-am-quote__text { margin: 0; padding-left: 10px; box-shadow: inset 2px 0 0 var(--line-strong, rgba(0, 0, 0, 0.14)); font-size: 13px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.ui-am-quote__foot { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 28px; font-size: 12px; color: var(--muted); }
.ui-am-quote__foot > svg { flex: none; }
.ui-am-quote__foot > span:not(.ui-am-faint) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-am-quote__foot > .ui-am-faint { flex: none; }
.ui-am-link { display: inline-flex; flex: none; align-items: center; gap: 4px; height: 24px; margin-left: auto; margin-right: -4px; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--muted); transition: color 140ms ease, background-color 140ms ease; }
.ui-am-link:hover { background: var(--chip); color: var(--ink); }
/* Where it was used: task by task, on a white card with the hairline stroke */
.ui-am-uses { display: grid; margin: 0 -10px; padding: 2px 10px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-am-uses li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-am-uses li + li { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-am-uses__mark { display: grid; flex: none; place-items: center; width: 16px; color: var(--muted); }
.ui-am-uses__text { display: grid; min-width: 0; }
.ui-am-uses__task { overflow: hidden; font-size: 13px; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-am-uses__how { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-am-panel__none { margin: 0; font-size: 13px; }
.ui-am-panel__acts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 0 -4px 0 0; }
.ui-am-panel__acts .ui-am-btn--quiet:only-child { margin-left: -8px; margin-right: auto; }

/* The shell's buttons wait in the corners – the head steps aside */
.ui-as-app[data-panel="closed"] .ui-am-head { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-am-head { padding-left: 46px; padding-right: 52px; }
}
@container ui-am (max-width: 720px) {
  .ui-am-row__source { display: none; }
}
/* Phones: each row on two lines – what it knows, and where from under it; search folds to its icon's width */
@container ui-am (max-width: 560px) {
  /* On the list, not on .ui-am: a container's own query only reaches what's inside it */
  .ui-am-tree { --am-row-h: 56px; }
  .ui-am-head { gap: 8px; }
  .ui-am-title__count { display: none; }
  .ui-am-search { flex: 1 1 auto; }
  .ui-am-head__new > span { display: none; }
  .ui-am-head .ui-am-btn.ui-am-head__new { display: grid; place-items: center; width: 28px; padding: 0; gap: 0; }
  .ui-am-row { gap: 10px; padding: 0 10px; }
  .ui-am-row > .ui-am-glyph { align-self: flex-start; margin-top: 10px; }
  .ui-am-row__text { display: -webkit-box; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .ui-am-row__uses { display: none; }
  .ui-am-row__acts { flex-direction: column; gap: 2px; }
  .ui-am-row__acts .ui-am-btn--quiet { display: none; }
}
/* Narrow: the sidebar already says Memory – the title steps back for the tabs and the search */
@container ui-am (max-width: 460px) {
  .ui-am-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@container ui-am (max-width: 400px) {
  .ui-am-seg button { padding: 0 6px; }
  .ui-am-search input::placeholder { color: transparent; }
  /* The search folds to its icon; while you type it takes the tabs' place */
  .ui-am-search { flex: 0 0 28px; justify-content: center; padding: 0 7px; }
  .ui-am-search:focus-within, .ui-am-search:has(input:not(:placeholder-shown)) { flex: 1 1 auto; justify-content: flex-start; }
  .ui-am-head:has(.ui-am-search:focus-within) .ui-am-seg, .ui-am-head:has(.ui-am-search input:not(:placeholder-shown)) .ui-am-seg { display: none; }
}
/* The narrowest phones: To review says Review, the head's gaps close up */
@container ui-am (max-width: 340px) {
  .ui-am-head { gap: 4px; }
  .ui-am-seg button { gap: 4px; padding: 0 5px; }
  .ui-am-seg__long { display: none; }
  .ui-am-seg__short { display: inline; }
}

@keyframes ui-am-sheen {
  0% { opacity: 1; background-position: -60% 0; }
  70% { opacity: 1; }
  100% { opacity: 0; background-position: 160% 0; }
}
@keyframes ui-am-glyph { 0%, 100% { color: var(--muted); } 25%, 60% { color: var(--am-c-purple); } }
@keyframes ui-am-tick { from { opacity: 0; transform: translateY(6px); } }
@keyframes ui-am-glide {
  from { height: 0; opacity: 0; transform: translateY(-6px); }
  60% { opacity: 1; }
  to { height: var(--am-row-h); transform: none; }
}
@keyframes ui-am-leave {
  from { height: var(--am-row-h); opacity: 1; }
  to { height: 0; opacity: 0; transform: translateX(8px); }
}
@keyframes ui-am-drop { from { opacity: 0; transform: translateY(-4px); } }
@keyframes ui-am-rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes ui-am-pop { from { transform: scale(0.6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-am-row[data-fresh], .ui-am-row[data-leaving], .ui-am-new, .ui-am-undo, .ui-am-badge, .ui-am-row[data-recalled] .ui-am-row__uses > span { animation: none; }
  .ui-am-row[data-recalled]::after { animation: none; }
  .ui-am-ghead__chev { transition: none; }
}

@media (pointer: coarse) {
  .ui-am-btn, .ui-am-seg button, .ui-am-search, .ui-am-link, .ui-am-undo__btn { min-height: 36px; }
  .ui-am-btn--sm { min-height: 32px; }
  .ui-am-head .ui-am-head__new::after { content: ""; position: absolute; inset: -4px; }
}


/* Agent Orchestration: the canvas fills the page, the run panel sits under it and stays; path, controls, toolbar and the agent's panel float on top */
.ui-ao {
  --ui-ao-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --ao-solid-chip: linear-gradient(var(--chip), var(--chip)), var(--panel);
  --ao-dot: rgba(0, 0, 0, 0.16);
  --ao-link: #83c7fe;
  --ao-link-muted: rgba(0, 0, 0, 0.12);
  --ao-flow: var(--aui-info, #0070d6);
  --ao-well: var(--aui-subtle, rgba(0, 0, 0, 0.028));
  --ao-field: rgba(0, 0, 0, 0.025);
  --ao-grid: rgba(0, 0, 0, 0.05);
  --ao-picked: rgba(0, 96, 226, 0.05);
  --ao-now: rgba(0, 96, 226, 0.45);
  /* Status chips: a soft tint and its ink */
  --ao-run-bg: #008ff519;
  --ao-run-fg: #006dcbf2;
  --ao-ok-bg: #00a43319;
  --ao-ok-fg: #007d2ee0;
  --ao-wait-bg: #ff9c0029;
  --ao-wait-fg: var(--aui-warning, #b25e00);
  --ao-err-bg: #f52b0018;
  --ao-err-fg: #d72400da;
  /* Bars by kind: a light tint and a hairline edge */
  --ao-agent-bg: rgba(0, 0, 0, 0.045);
  --ao-agent-edge: rgba(0, 0, 0, 0.1);
  --ao-agent-mark: rgba(0, 0, 0, 0.3);
  --ao-llm-bg: color-mix(in srgb, var(--aui-purple, #a651f0) 10%, transparent);
  --ao-llm-edge: color-mix(in srgb, var(--aui-purple, #a651f0) 30%, transparent);
  --ao-llm-mark: color-mix(in srgb, var(--aui-purple, #a651f0) 72%, transparent);
  --ao-tool-bg: color-mix(in srgb, var(--aui-cyan, #14b3f0) 8.5%, transparent);
  --ao-tool-edge: color-mix(in srgb, var(--aui-cyan, #14b3f0) 28%, transparent);
  --ao-tool-mark: color-mix(in srgb, var(--aui-cyan, #14b3f0) 62%, transparent);
  --ao-error-bg: #f52b0018;
  --ao-error-edge: color-mix(in srgb, var(--aui-red, #f04438) 34%, transparent);
  --ao-error-mark: color-mix(in srgb, var(--aui-red, #f04438) 62%, transparent);
  --ao-tip: rgba(0, 0, 0, 0.88);
  --ao-tip-ink: #fcfcfc;
  --ao-float: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 4px 16px -4px rgba(0, 0, 0, 0.08);
  --ao-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ao-panel-w: 388px;
  --mono: var(--aui-font-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
:where(.dark, [data-theme="dark"]) .ui-ao {
  --ui-ao-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --ao-dot: rgba(255, 255, 255, 0.12);
  --ao-link: color-mix(in srgb, var(--aui-blue, #4fb0fe) 62%, transparent);
  --ao-link-muted: rgba(255, 255, 255, 0.14);
  --ao-flow: #90cdfe;
  --ao-well: var(--aui-subtle, rgba(255, 255, 255, 0.04));
  --ao-field: rgba(255, 255, 255, 0.04);
  --ao-grid: rgba(255, 255, 255, 0.05);
  --ao-picked: color-mix(in srgb, var(--aui-blue, #4fb0fe) 8%, transparent);
  --ao-now: color-mix(in srgb, var(--aui-blue, #4fb0fe) 55%, transparent);
  --ao-run-bg: #0077ff3a;
  --ao-run-fg: var(--aui-info, #4fb0fe);
  --ao-ok-bg: #00f04a1f;
  --ao-ok-fg: var(--aui-green, #5fc88a);
  --ao-wait-bg: #fb6a0025;
  --ao-wait-fg: var(--aui-warning, #ffb35c);
  --ao-err-bg: #ff35232b;
  --ao-err-fg: var(--aui-danger, #ff8a7a);
  --ao-agent-bg: rgba(255, 255, 255, 0.07);
  --ao-agent-edge: rgba(255, 255, 255, 0.14);
  --ao-agent-mark: rgba(255, 255, 255, 0.4);
  --ao-llm-bg: color-mix(in srgb, var(--aui-purple, #b98af0) 16%, transparent);
  --ao-llm-edge: color-mix(in srgb, var(--aui-purple, #b98af0) 38%, transparent);
  --ao-llm-mark: color-mix(in srgb, var(--aui-purple, #b98af0) 80%, transparent);
  --ao-tool-bg: color-mix(in srgb, var(--aui-cyan, #5cc6ee) 13%, transparent);
  --ao-tool-edge: color-mix(in srgb, var(--aui-cyan, #5cc6ee) 34%, transparent);
  --ao-tool-mark: color-mix(in srgb, var(--aui-cyan, #5cc6ee) 75%, transparent);
  --ao-error-bg: #ff35232b;
  --ao-error-edge: color-mix(in srgb, var(--aui-red, #ff6b5f) 40%, transparent);
  --ao-error-mark: color-mix(in srgb, var(--aui-red, #ff6b5f) 75%, transparent);
  --ao-tip: #2c2c30;
  --ao-tip-ink: rgba(255, 255, 255, 0.9);
  --ao-float: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 4px 16px -4px rgba(0, 0, 0, 0.5);
}
.ui-ao-num { font-variant-numeric: tabular-nums; }
.ui-ao-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Top: the path on the left, the run's controls on the right ---------- */
.ui-ao-top { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 8; container: ao-top / inline-size; display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; transition: right 300ms var(--ease); }
.ui-ao-top > * { pointer-events: auto; }
/* With the agent's panel open, the controls step left of it */
.ui-ao__area[data-panel] .ui-ao-top { right: calc(var(--ao-panel-w) + 20px); }
/* The path and the run controls: a gray fill like the run panel's tabs – laid over the panel color, so the canvas never shows through */
.ui-ao-path { display: flex; flex: 0 0.4 auto; align-items: center; gap: 0; min-width: 0; height: 28px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--ao-solid-chip); }
.ui-ao-path > i { flex: none; padding: 0 2px; font-style: normal; color: var(--faint); }
.ui-ao-path > .ui-as-anchor { display: flex; min-width: 0; }
.ui-ao-path .ui-as-menu { min-width: 240px; }
.ui-ao-crumb { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 260px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-ao-crumb:hover, .ui-ao-crumb[aria-expanded="true"] { background: var(--hover); }
.ui-ao-crumb > svg { flex: none; color: var(--faint); }
.ui-ao-crumb__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ao-crumb__mono { font-family: var(--mono); font-size: 12px; font-weight: 400; }
.ui-ao-env { flex: none; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; }
.ui-ao-env { background: var(--chip); color: var(--muted); }
/* Short of room, long (translated) labels give way faster than the path: they end in '…', the full label stays in the tooltip */
.ui-ao-controls { display: flex; flex: 0 1 auto; gap: 8px; min-width: 0; }
.ui-ao-controls .ui-ao-btn { flex: 0 1 auto; min-width: 28px; }
.ui-ao-controls .ui-ao-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Buttons: white with the card's hairline; the blue primary only where the run waits for you */
.ui-ao-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease, filter 140ms ease; }
.ui-ao-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-ao-btn > svg { flex: none; color: var(--muted); }
.ui-ao-btn--primary { background: var(--accent); box-shadow: none; color: #fff; }
.ui-ao-btn--primary > svg { color: inherit; }
.ui-ao-btn--primary:hover { box-shadow: none; filter: brightness(1.07); }
/* Run controls: each its own button; starting again is the dark one */
.ui-ao-controls .ui-ao-btn { height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--ao-solid-chip); box-shadow: none; }
.ui-ao-controls .ui-ao-btn:not(.ui-ao-btn--start):hover { background: linear-gradient(var(--hover), var(--hover)), var(--ao-solid-chip); box-shadow: none; }
.ui-ao-btn--start, .ui-ao-controls .ui-ao-btn--start { background: var(--aui-primary, var(--ink)); color: var(--aui-on-primary, var(--card)); }
.ui-ao-btn--start > svg { color: inherit; }
.ui-ao-controls .ui-ao-btn--start:hover, .ui-ao-empty .ui-ao-btn--start:hover { background: var(--aui-primary, var(--ink)); filter: brightness(1.15); }
.ui-ao[data-narrow] .ui-ao-controls .ui-ao-btn { width: 28px; padding: 0; gap: 0; }
.ui-ao[data-narrow] .ui-ao-controls .ui-ao-btn span { display: none; }
/* Little room beside the open panel: the controls turn into icons too, so the path keeps its words */
@container ao-top (max-width: 560px) {
  .ui-ao-controls .ui-ao-btn { width: 28px; padding: 0; gap: 0; }
  .ui-ao-controls .ui-ao-btn span { display: none; }
}

/* ---------- Canvas ---------- */
.ui-ao__area { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.ui-ao-vp {
  position: absolute;
  inset: 0;
  overflow: hidden;
  outline: none;
  touch-action: none;
  user-select: none;
  background-color: var(--panel);
  background-image: radial-gradient(circle at 1px 1px, var(--ao-dot) 0.7px, transparent 1.05px);
  background-size: 20px 20px;
}
.ui-ao-vp[data-panning], .ui-ao-vp[data-panning] .ui-ao-card { cursor: grabbing; }
.ui-ao-vp[data-follow] .ui-ao-world { transition: transform 600ms var(--ao-out); }
.ui-ao-vp[data-follow] { transition: background-position 600ms var(--ao-out); }
.ui-ao-world { position: absolute; top: 0; left: 0; width: 0; height: 0; transform-origin: 0 0; }
.ui-ao-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }

/* Connectors: thin blue lines, a hollow dot where they leave the parent; gray toward agents that haven't started */
.ui-ao-links { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.ui-ao-link { fill: none; stroke: var(--ao-link); stroke-width: 1.5; stroke-linecap: round; transition: stroke 240ms ease, opacity 240ms ease; }
.ui-ao-links [data-muted] .ui-ao-link { stroke: var(--ao-link-muted); }
.ui-ao-links [data-faded] { opacity: 0.35; transition: opacity 240ms ease; }
.ui-ao-links--dots { z-index: 3; }
.ui-ao-dot { fill: var(--card); stroke: var(--ao-link); stroke-width: 1.5; transition: opacity 240ms ease; }
.ui-ao-dot[data-muted] { stroke: var(--ao-link-muted); }
.ui-ao-dot[data-faded] { opacity: 0.35; }
/* The flow toward a running agent – a gradient stretch of the line in the accent, drawn by FlowTrail */
.ui-ao-flow__line { fill: none; stroke-width: 2; stroke-linecap: round; }
.ui-ao-flow__stop { stop-color: var(--ao-flow); }

/* Agent card: a role tag above, then a white card – header (mark, name, status chip), the task, and the gray well */
.ui-ao-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 240px;
  height: 110px;
  padding: 12px 12px 4px;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: box-shadow 160ms ease, opacity 240ms ease;
}
.ui-ao-card:hover { box-shadow: var(--card-shadow-hover); }
.ui-ao-card:focus { outline: none; }
.ui-ao-card:focus-visible { outline: 2px solid var(--ui-ao-focus); outline-offset: 2px; }
.ui-ao-card[data-status="queued"], .ui-ao-card[data-status="stopped"] { opacity: 0.6; }
/* One agent opened: it and the ones it started stay, the rest fade back – no ring */
.ui-ao-card[data-faded] { opacity: 0.38; }
.ui-ao-card[data-faded][data-status="queued"] { opacity: 0.28; }
.ui-ao-card[data-selected] { box-shadow: var(--card-shadow-hover); }
.ui-ao-card__role { position: absolute; bottom: calc(100% + 6px); left: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 2px 6px; border-radius: var(--aui-radius-sm, 5px); background: var(--chip); font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.ui-ao-card__head { display: flex; align-items: center; gap: 8px; min-width: 0; height: 24px; }
.ui-ao-card__head > b { flex: 1; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--strong); }
.ui-ao-card__task { flex: none; overflow: hidden; height: 18px; font-size: 12.5px; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
/* The well: tools as tiles, the model, and the cost · time on the right */
.ui-ao-card__well { display: flex; flex: none; align-items: center; gap: 8px; min-width: 0; height: 36px; margin: 0 -8px; padding: 0 10px 0 8px; border-radius: calc(var(--aui-radius-lg, 10px) - 3px); background: var(--ao-well); }
.ui-ao-card__model { flex: 1; min-width: 0; overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-ao-card__cost { flex: none; font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap; color: var(--ink); }
.ui-ao-card__time { font-weight: 400; color: var(--muted); }

/* The model's mark: a small white tile with the card's hairline */
.ui-ao-mark { display: grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--card); box-shadow: var(--card-shadow); color: var(--text); }
.ui-ao-mark > svg { width: 14px; height: 14px; }
.ui-ao-mark--small { width: 20px; height: 20px; border-radius: 6px; }
.ui-ao-mark--small > svg { width: 12px; height: 12px; }
.ui-ao-mark--big { width: 30px; height: 30px; border-radius: 8px; }
.ui-ao-mark--big > svg { width: 16px; height: 16px; }
.ui-ao-mark-ink { color: var(--strong); }
.ui-ao-mark-text { font-size: 10px; font-weight: 500; }
/* Tools: small white tiles, each slightly over the one before */
.ui-ao-tools { display: inline-flex; flex: none; margin: -3px; padding: 3px; }
.ui-ao-tool { display: grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--card); box-shadow: var(--card-shadow); color: var(--text); }
.ui-ao-tool + .ui-ao-tool { margin-left: -5px; }
.ui-ao-tool--more { width: auto; min-width: 20px; padding: 0 4px; font-size: 10px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-ao-tool--row { width: 22px; height: 22px; }

/* Status chips: the only colour – blue running, amber needs you, green done, red failed, gray queued and stopped */
.ui-ao-chip { display: inline-flex; flex: none; align-items: center; gap: 4px; height: 20px; padding: 0 6px 0 5px; border-radius: var(--aui-radius-sm, 5px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 16px; white-space: nowrap; color: var(--muted); }
.ui-ao-chip > svg { flex: none; }
.ui-ao-chip[data-status="running"] { background: var(--ao-run-bg); color: var(--ao-run-fg); }
.ui-ao-chip[data-status="waiting"] { background: var(--ao-wait-bg); color: var(--ao-wait-fg); }
.ui-ao-chip[data-status="done"] { background: var(--ao-ok-bg); color: var(--ao-ok-fg); }
.ui-ao-chip[data-status="failed"] { background: var(--ao-err-bg); color: var(--ao-err-fg); }
.ui-ao-chip .ui-ao-spin { width: 11px; height: 11px; }
.ui-ao-spin { width: 14px; height: 14px; }
.ui-ao[data-paused] .ui-ao-spin { animation-play-state: paused; }

/* ---------- Toolbar ---------- */
.ui-ao-tb { position: absolute; bottom: 14px; left: 50%; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--ao-float); translate: -50% 0; transition: left 300ms var(--ease); }
.ui-ao__area[data-panel] .ui-ao-tb { left: calc(50% - var(--ao-panel-w) / 2 - 10px); }
.ui-ao-tb__btn { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-ao-tb__btn:hover { background: var(--hover); color: var(--ink); }
.ui-ao-tb__sep { width: 0.5px; height: 16px; margin: 0 4px; background: var(--line-strong); }
.ui-ao-tb__zoom { position: relative; width: 44px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-ao-tb__zoom:hover { background: var(--hover); color: var(--ink); }
.ui-ao-tb [data-tip]:is(:hover, :focus-visible)::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50% 0;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--ao-tip);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: pre;
  color: var(--ao-tip-ink);
  pointer-events: none;
  animation: ui-ao-fade 140ms ease both;
}
.ui-ao-tb [data-tip]:first-child:is(:hover, :focus-visible)::after { left: 0; translate: 0 0; }
.ui-ao__area > .ui-as-toast { bottom: 64px; }

/* ---------- Run panel ---------- */
.ui-ao-run { position: relative; flex: none; display: flex; flex-direction: column; height: var(--run-h); overflow: hidden; background: var(--panel); box-shadow: inset 0 0.5px 0 var(--line-strong); transition: height 300ms var(--ease); }
.ui-ao[data-resizing] :is(.ui-ao-run, .ui-ao-panel) { transition: none; }
.ui-ao[data-resizing] { cursor: row-resize; user-select: none; }
.ui-ao-run__grip { position: absolute; top: 0; left: 0; right: 0; z-index: 2; height: 6px; cursor: row-resize; touch-action: none; }
.ui-ao-run__grip::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: transparent; transition: background-color 140ms ease; }
.ui-ao-run__grip:hover::after, .ui-ao[data-resizing] .ui-ao-run__grip::after { background: var(--edge-active); }
.ui-ao-run__grip:focus-visible { outline-offset: -2px; }
.ui-ao-run__head { display: flex; flex: none; align-items: center; gap: 8px; height: 44px; padding: 0 8px 0 10px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-ao-run[data-folded] .ui-ao-run__head { box-shadow: none; }
.ui-ao-run__fold > svg { transition: rotate 240ms var(--ease); }
.ui-ao-run[data-folded] .ui-ao-run__fold > svg { rotate: 180deg; }
.ui-ao-tabs { display: flex; flex: 0 1 auto; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ui-ao-tabs::-webkit-scrollbar { display: none; }
.ui-ao-tabs button { position: relative; display: inline-flex; flex: none; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-ao-tabs button:hover { color: var(--ink); }
.ui-ao-tabs button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.ui-ao-tabs button:focus-visible { outline-offset: -2px; }
.ui-ao-tabs__count { min-width: 16px; padding: 0 4px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--ao-err-bg); font-size: 11px; line-height: 16px; text-align: center; color: var(--ao-err-fg); }
/* The run in numbers: quiet gray, one fixed width per figure so nothing shifts as they tick */
.ui-ao-sum { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; margin: 0 4px 0 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-ao-sum > div { flex: none; }
.ui-ao-sum dd { display: flex; align-items: center; gap: 6px; margin: 0; }
.ui-ao-sum dd > svg { flex: none; color: var(--faint); }
.ui-ao-sum .ui-ao-progress { color: var(--muted); }
.ui-ao-sum__time .ui-ao-num { min-width: 38px; }
.ui-ao-sum__tokens .ui-ao-num { min-width: 40px; }
.ui-ao-sum__cost { min-width: 40px; text-align: right; font-weight: 500; color: var(--ink); }
/* Focus never lands under the sticky axis or table head, and its ring keeps clear of the edges */
.ui-ao-run__body { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-padding: 32px 0 8px; }
.ui-ao-run__body .ui-as-empty[data-bare] { padding: 20px 16px; }
[data-faded] { transition: opacity 200ms ease; }
.ui-ao-run__body [data-faded] { opacity: 0.4; }

/* Trace: names on the left, bars on one time axis, durations on the right */
.ui-ao-trace { --name: 260px; --len: 64px; --pad: 10px; --gap: 14px; --row: 28px; position: relative; min-width: 0; padding-bottom: 8px; }
.ui-ao-trace__axis, .ui-ao-trace__row { display: grid; grid-template-columns: var(--name) minmax(0, 1fr) var(--len); column-gap: var(--gap); align-items: center; padding: 0 var(--pad); }
.ui-ao-trace__axis { position: sticky; top: 0; z-index: 2; height: 28px; background: var(--panel); box-shadow: inset 0 -0.5px 0 var(--line); font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.ui-ao-trace__axis > span:first-child { padding-left: 6px; }
.ui-ao-trace__ticks { position: relative; align-self: stretch; }
.ui-ao-trace__ticks > span { position: absolute; top: 6px; left: calc(var(--v) * 100% / var(--range)); padding-left: 5px; font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-ao-trace__ticks > span:last-child:not(:first-child) { translate: -100% 0; padding: 0 5px 0 0; }
.ui-ao-trace__rows { position: relative; padding-top: 4px; outline: none; }
.ui-ao-trace__grid { position: absolute; top: 0; bottom: 0; left: calc(var(--pad) + var(--name) + var(--gap)); right: calc(var(--pad) + var(--len) + var(--gap)); pointer-events: none; }
.ui-ao-trace__grid > i { position: absolute; top: 0; bottom: 0; left: calc(var(--v) * 100% / var(--range)); width: 0.5px; background: var(--ao-grid); }
.ui-ao-trace__now { position: absolute; top: 0; bottom: 0; left: calc(var(--v) * 100% / var(--range)); width: 1px; background: var(--ao-now); transition: left 1000ms linear; }
.ui-ao[data-paused] .ui-ao-trace__now { transition: none; }
.ui-ao-trace__row { position: relative; height: var(--row); font-size: 13px; color: var(--ink); cursor: pointer; outline: none; transition: background-color 120ms ease, opacity 200ms ease; }
.ui-ao-trace__row:hover { background: var(--hover); }
.ui-ao-trace__row[data-open] { background: var(--ao-picked); }
.ui-ao-trace__row:focus-visible { outline: 2px solid var(--ui-ao-focus); outline-offset: -2px; }
.ui-ao-trace__name { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: calc(var(--level) * 14px); }
.ui-ao-trace__row:not([data-span]) .ui-ao-trace__title { font-weight: 500; color: var(--strong); }
.ui-ao-trace__row[data-span] .ui-ao-trace__name { padding-left: calc(var(--level) * 14px + 2px); }
.ui-ao-trace__chev { display: grid; flex: none; place-items: center; width: 16px; height: 18px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); color: var(--faint); }
button.ui-ao-trace__chev:hover { background: var(--chip); color: var(--ink); }
.ui-ao-trace__chev > svg { transition: rotate 200ms var(--ease); }
.ui-ao-trace__chev[data-open] > svg { rotate: 90deg; }
.ui-ao-trace__title { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ao-trace__detail { flex: 1 1 0; min-width: 0; overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-ao-trace__state { display: grid; flex: none; place-items: center; width: 14px; margin-left: auto; color: var(--muted); }
.ui-ao-trace__state[data-status="running"] { color: var(--ao-run-fg); }
.ui-ao-trace__state[data-status="waiting"] { color: var(--ao-wait-fg); }
.ui-ao-trace__state[data-status="failed"] { color: var(--ao-err-fg); }
.ui-ao-trace__state .ui-ao-spin { width: 12px; height: 12px; }
.ui-ao-trace__track { position: relative; align-self: stretch; min-width: 0; }
.ui-ao-trace__len { font-size: 12px; text-align: right; color: var(--muted); white-space: nowrap; }
.ui-ao-swatch { flex: none; width: 8px; height: 8px; margin: 0 4px 0 6px; border-radius: 2px; background: var(--k-mark); }
/* Bars by kind: a light tint and a hairline edge; errors red */
.ui-ao [data-kind] { --k-bg: var(--ao-agent-bg); --k-edge: var(--ao-agent-edge); --k-mark: var(--ao-agent-mark); }
.ui-ao [data-kind="llm"] { --k-bg: var(--ao-llm-bg); --k-edge: var(--ao-llm-edge); --k-mark: var(--ao-llm-mark); }
.ui-ao [data-kind="tool"] { --k-bg: var(--ao-tool-bg); --k-edge: var(--ao-tool-edge); --k-mark: var(--ao-tool-mark); }
.ui-ao [data-kind][data-status="failed"] { --k-bg: var(--ao-error-bg); --k-edge: var(--ao-error-edge); --k-mark: var(--ao-error-mark); }
.ui-ao-bar {
  position: absolute;
  top: calc(50% - 7px);
  left: calc(var(--s) * 100% / var(--range));
  width: max(3px, calc(var(--d) * 100% / var(--range)));
  height: 14px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--k-bg);
  box-shadow: inset 0 0 0 0.5px var(--k-edge);
  animation: ui-ao-grow 560ms var(--ease) backwards;
  transition: width 1000ms linear, left 720ms var(--ease), box-shadow 160ms ease;
}
.ui-ao-trace__row:is(:hover, [data-open]) .ui-ao-bar { box-shadow: inset 0 0 0 1px var(--k-mark); }
.ui-ao-bar[data-kind="agent"] { height: 10px; top: calc(50% - 5px); }
.ui-ao-bar__call { position: absolute; top: 2px; bottom: 2px; min-width: 2px; border-radius: 2px; background: var(--k-mark); opacity: 0.45; }
.ui-ao-bar[data-status="waiting"] { background: repeating-linear-gradient(-45deg, var(--k-bg) 0 4px, transparent 4px 7px); }
/* Still running: a sheen sweeps along and the leading edge glows */
.ui-ao-bar[data-status="running"]::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--card), transparent) -60px 0 / 60px 100% no-repeat; opacity: 0.7; animation: ui-ao-sweep 1500ms linear infinite; }
.ui-ao-bar[data-status="running"]::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: min(28px, 100%); background: linear-gradient(90deg, transparent, var(--k-edge)); animation: ui-ao-glow 1100ms ease-in-out infinite alternate; }
.ui-ao[data-paused] .ui-ao-bar { transition: left 720ms var(--ease); }
.ui-ao[data-paused] .ui-ao-bar::before, .ui-ao[data-paused] .ui-ao-bar::after { animation-play-state: paused; }

/* Tokens & cost: one row per agent in the tree's order, figures in fixed columns, the run's total at the foot */
.ui-ao-cost { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; font-size: 13px; color: var(--ink); }
.ui-ao-cost th, .ui-ao-cost td { height: 30px; padding: 0 10px; font-weight: 400; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-ao-cost thead th { position: sticky; top: 0; z-index: 1; height: 28px; background: var(--panel); box-shadow: inset 0 -0.5px 0 var(--line); font-size: 10px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.ui-ao-cost thead th:first-child { width: 34%; padding-left: 16px; }
.ui-ao-cost .ui-ao-cost__model { width: 15%; color: var(--muted); }
.ui-ao-cost [data-num] { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.ui-ao-cost [data-strong] { font-weight: 500; color: var(--ink); }
.ui-ao-cost .ui-ao-cost__share { width: 13%; padding: 0 4px 0 8px; }
.ui-ao-cost .ui-ao-cost__branch { width: 10%; color: var(--muted); }
.ui-ao-cost tbody tr { cursor: pointer; outline: none; transition: background-color 120ms ease, opacity 200ms ease; }
.ui-ao-cost tbody tr:hover { background: var(--hover); }
.ui-ao-cost tbody tr:focus-visible { outline: 2px solid var(--ui-ao-focus); outline-offset: -2px; }
.ui-ao-cost tbody th { padding-left: 10px; }
.ui-ao-cost__agent { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: calc(var(--level) * 14px); }
.ui-ao-cost__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-ao-cost__bar { display: block; height: 6px; border-radius: 3px; background: var(--ao-field); }
.ui-ao-cost__bar > i { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--faint); transition: width 1000ms linear; }
.ui-ao-cost tfoot th, .ui-ao-cost tfoot td { box-shadow: inset 0 0.5px 0 var(--line); font-weight: 500; color: var(--ink); }
.ui-ao-cost tfoot th { padding-left: 16px; }

/* Events: newest first, one fixed height each; colour only in the tag of an error or an approval */
.ui-ao-events { margin: 0; padding: 4px 6px 8px; list-style: none; }
.ui-ao-events li { animation: ui-ao-rise 320ms var(--ease) both; }
.ui-ao-event { display: grid; grid-template-columns: 44px 16px minmax(0, 140px) minmax(0, 1fr) auto; align-items: center; column-gap: 10px; width: 100%; height: 32px; padding: 0 10px 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; text-align: left; color: var(--ink); transition: background-color 120ms ease; }
.ui-ao-event:hover { background: var(--hover); }
.ui-ao-event:focus-visible { outline-offset: -2px; }
.ui-ao-event > svg { color: var(--muted); }
.ui-ao-event__at { font-size: 12px; color: var(--muted); }
.ui-ao-event__who { min-width: 0; overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; color: var(--strong); }
.ui-ao-event__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.ui-ao-tag { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.ui-ao-tag[data-type="error"] { background: var(--ao-err-bg); color: var(--ao-err-fg); }
.ui-ao-tag[data-type="approval"] { background: var(--ao-wait-bg); color: var(--ao-wait-fg); }

/* ---------- Agent panel ---------- */
.ui-ao-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: calc(10px + var(--run-h));
  z-index: 7;
  display: flex;
  flex-direction: column;
  width: var(--ao-panel-w);
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  outline: none;
  background: var(--card);
  box-shadow: var(--ao-float);
  animation: ui-ao-in-right 260ms var(--ease) both;
  transition: bottom 300ms var(--ease);
}
.ui-ao-panel__head { display: flex; flex: none; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 12px; }
.ui-ao-panel__head .ui-ao-chip { margin-right: 2px; }
.ui-ao-panel__title { display: grid; flex: 1; min-width: 0; }
.ui-ao-panel__title b { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--strong); }
.ui-ao-panel__title small { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-ao-panel__tabs { display: flex; flex: none; gap: 2px; padding: 0 10px 8px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-ao-panel__tabs button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-ao-panel__tabs button:hover { color: var(--ink); }
.ui-ao-panel__tabs button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.ui-ao-panel__tabs button:focus-visible { outline-offset: -2px; }
.ui-ao-panel__count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-ao-panel__body { display: flex; flex: 1; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 16px; scroll-padding: 8px 0; }
.ui-ao-panel__body[data-tab="Context"] { padding: 12px; }
.ui-ao-panel__body:focus-visible { outline-offset: -2px; border-radius: 0 0 calc(var(--aui-radius-lg, 10px) + 2px) calc(var(--aui-radius-lg, 10px) + 2px); }
.ui-ao-panel__task { margin: 0; font-size: 13px; line-height: 20px; color: var(--ink); }
/* A note: what the agent waits for, with its answer – or what went wrong; gray, the words carry it */
.ui-ao-note { display: grid; gap: 10px; padding: 10px 12px; border-radius: calc(var(--aui-radius-lg, 10px) - 2px); background: var(--aui-subtle, var(--ao-field)); box-shadow: inset 0 0 0 0.5px var(--line); }
.ui-ao-note__text { display: flex; gap: 8px; font-size: 13px; line-height: 20px; color: var(--ink); }
.ui-ao-note__text > svg { flex: none; margin-top: 3px; color: var(--muted); }
.ui-ao-note__actions { display: flex; justify-content: flex-end; gap: 6px; }
.ui-ao-link-btn { display: inline-flex; align-items: center; gap: 4px; justify-self: start; height: 24px; margin-left: 14px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; font-weight: 500; color: var(--text); }
.ui-ao-link-btn:hover { background: var(--hover); color: var(--ink); }
.ui-ao-link-btn > svg { color: var(--faint); }
.ui-ao-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-radius: calc(var(--aui-radius-lg, 10px) - 2px); box-shadow: inset 0 0 0 0.5px var(--line-strong); }
.ui-ao-stats > div { display: grid; gap: 2px; min-width: 0; padding: 10px 12px; }
.ui-ao-stats > div:nth-child(even) { box-shadow: inset 0.5px 0 0 var(--line); }
.ui-ao-stats > div:nth-child(n + 3) { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-ao-stats > div:nth-child(4) { box-shadow: inset 0.5px 0.5px 0 var(--line); }
.ui-ao-stats dt { font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.ui-ao-stats dd { margin: 0; overflow: hidden; font-size: 15px; font-weight: 500; line-height: 22px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-ao-section { display: grid; gap: 6px; }
.ui-ao-label { display: flex; gap: 6px; margin: 0; font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.ui-ao-label .ui-ao-num { color: var(--faint); }
/* Tasks: a checked-off list */
.ui-ao-todo { display: grid; margin: 0; padding: 0; list-style: none; }
.ui-ao-todo__item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-ao-todo__item:first-child { padding-top: 2px; }
.ui-ao-todo__item:last-child { box-shadow: none; }
.ui-ao-todo__check { display: grid; place-items: center; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; background: var(--muted); color: var(--card); }
.ui-ao-todo__item[data-status="running"] .ui-ao-todo__check { background: none; color: var(--muted); }
.ui-ao-todo__item[data-status="running"] .ui-ao-spin { width: 16px; height: 16px; }
.ui-ao-todo__item[data-status="failed"] .ui-ao-todo__check { background: var(--ao-err-fg); }
.ui-ao-todo__body { display: grid; gap: 2px; min-width: 0; }
.ui-ao-todo__task { overflow: hidden; font-size: 13px; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-ao-todo__meta { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; line-height: 16px; white-space: nowrap; color: var(--muted); }
.ui-ao-todo__meta > svg { flex: none; }
.ui-ao-todo__meta > i { font-style: normal; color: var(--faint); }
.ui-ao-todo__tool { flex: none; }
.ui-ao-todo__result { overflow: hidden; text-overflow: ellipsis; }
.ui-ao-todo__item[data-status="failed"] .ui-ao-todo__result { color: var(--ao-err-fg); }
.ui-ao-todo__nums { display: grid; justify-items: end; align-content: start; font-size: 12px; line-height: 20px; color: var(--muted); }
.ui-ao-todo__nums > span + span { line-height: 16px; margin-top: 2px; color: var(--faint); }
.ui-ao-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0 -6px; padding: 0; list-style: none; }
.ui-ao-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); font-size: 13px; text-align: left; color: var(--ink); transition: background-color 120ms ease; }
button.ui-ao-row:hover { background: var(--hover); }
button.ui-ao-row:focus-visible { outline-offset: -2px; }
.ui-ao-row__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ao-row__meta { flex: none; max-width: 40%; overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }

/* Phones: the agent's panel becomes a sheet from the bottom over a soft scrim; the run panel keeps the figures that matter */
.ui-ao-scrim { position: absolute; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.16); animation: ui-ao-fade 200ms ease both; }
:where(.dark, [data-theme="dark"]) .ui-ao-scrim { background: rgba(0, 0, 0, 0.45); }
.ui-ao-panel[data-sheet] { top: auto; right: 8px; bottom: 8px; left: 8px; width: auto; height: min(78%, 600px); animation: ui-ao-in-up 300ms var(--ease) both; }
.ui-ao[data-narrow] .ui-ao-tb { bottom: 10px; }
.ui-ao[data-narrow] .ui-ao-tb__zoom { display: none; }
.ui-ao[data-narrow] .ui-ao-tabs button span:not(.ui-ao-tabs__count) { display: none; }
.ui-ao[data-narrow] .ui-ao-sum { gap: 10px; }
.ui-ao[data-narrow] :is(.ui-ao-sum__tokens, .ui-ao-sum__time dd > svg) { display: none; }
.ui-ao[data-narrow] .ui-ao-trace { --name: 132px; --len: 44px; --gap: 8px; --pad: 6px; }
.ui-ao[data-narrow] .ui-ao-trace__detail { display: none; }
.ui-ao[data-narrow] .ui-ao-trace__name { padding-left: calc(min(var(--level), 2) * 8px); }
/* Phones: the names need the room more than the marks */
.ui-ao[data-narrow] .ui-ao-trace__name > .ui-ao-mark { display: none; }
.ui-ao[data-narrow] :is(.ui-ao-cost__model, .ui-ao-cost__cached, .ui-ao-cost__share, .ui-ao-cost__branch) { display: none; }
.ui-ao[data-narrow] .ui-ao-cost thead th:first-child { width: 40%; }
/* Phones: figures are never cut – the columns give up padding, not digits */
.ui-ao[data-narrow] .ui-ao-cost :is(th, td)[data-num] { padding: 0 6px; text-overflow: clip; }
.ui-ao[data-narrow] .ui-ao-cost__agent { padding-left: calc(min(var(--level), 2) * 8px); }
.ui-ao[data-narrow] .ui-ao-event { grid-template-columns: 40px 14px minmax(0, 1fr); }
.ui-ao[data-narrow] .ui-ao-event :is(.ui-ao-event__who, .ui-ao-tag) { display: none; }
/* Narrow: the App Shell's sidebar button sits in the top left corner – the path bar starts after it */
@container ui-as (max-width: 900px) {
  .ui-ao-top { left: 52px; }
}
@container ui-as (max-width: 720px) {
  .ui-ao-env { display: none; }
}
@container ui-as (max-width: 480px) {
  /* A narrow axis keeps every other label – the last one leans left and would run into its neighbour */
  .ui-ao-trace__ticks > span:nth-child(even) { visibility: hidden; }
  .ui-ao-path > i, .ui-ao-path > .ui-as-anchor:first-child { display: none; }
}

@keyframes ui-ao-fade { from { opacity: 0; } }
@keyframes ui-ao-rise { from { opacity: 0; transform: translateY(-4px); } }
@keyframes ui-ao-in-right { from { opacity: 0; transform: translateX(8px); } }
@keyframes ui-ao-in-up { from { opacity: 0; transform: translateY(16px); } }
@keyframes ui-ao-grow { from { clip-path: inset(0 100% 0 0 round 4px); } to { clip-path: inset(0 0 0 0 round 4px); } }
@keyframes ui-ao-sweep { to { background-position: calc(100% + 60px) 0; } }
@keyframes ui-ao-glow { from { opacity: 0.45; } to { opacity: 1; } }

/* Reduced motion: no flow along the lines – the line into a running agent turns accent instead; nothing sweeps or slides */
@media (prefers-reduced-motion: reduce) {
  .ui-ao-flow { display: none; }
  .ui-ao-bar, .ui-ao-bar::before, .ui-ao-bar::after, .ui-ao-events li, .ui-ao-panel { animation: none !important; }
  .ui-ao-bar, .ui-ao-trace__now, .ui-ao-run, .ui-ao-top, .ui-ao-tb { transition: none; }
}

/* Loading: the same cards, rows and cells, gray bars where the data goes – centred in the real line heights */
.ui-ao [data-skel] { pointer-events: none; }
.ui-ao-card[data-skel] { cursor: default; }
.ui-ao-skel-role { padding: 0; background: none; }
.ui-ao-skel-line { display: flex; align-items: center; }
.ui-ao-card__head > .ui-ao-skel-line { height: 20px; }
.ui-ao-skel-dd { display: flex; align-items: center; gap: 6px; height: 16px; }
.ui-ao-skel-dd > svg { flex: none; color: var(--faint); }
.ui-ao-skel-bar { position: absolute; top: calc(50% - 5px); }
.ui-ao-skel-len { display: flex; align-items: center; justify-content: flex-end; height: 18px; }
.ui-ao-skel-cell { display: flex; align-items: center; height: 18px; }
.ui-ao-skel-cell[data-num] { justify-content: flex-end; }
.ui-ao-event[data-skel] { cursor: default; }
.ui-ao[data-narrow] :is(.ui-ao-trace__name > .ui-ao-skel-mark, .ui-ao-sum__time .ui-ao-skel-dd > svg, .ui-ao-event .ui-ao-skel-who, .ui-ao-event .ui-ao-skel-tag) { display: none; }

/* Touch: every control at least 36px */
@media (pointer: coarse) {
  .ui-ao-tb__btn, .ui-ao-panel__head .ui-as-icon-btn, .ui-ao-run__head .ui-as-icon-btn { width: 36px; height: 36px; }
  .ui-ao-btn, .ui-ao-crumb, .ui-ao-tabs button, .ui-ao-panel__tabs button { min-height: 36px; }
  .ui-ao[data-narrow] .ui-ao-controls .ui-ao-btn { width: 36px; }
  @container ao-top (max-width: 560px) { .ui-ao-controls .ui-ao-btn { width: 36px; } }
  .ui-ao-trace { --row: 36px; }
  .ui-ao-event, .ui-ao-row { height: 40px; }
  .ui-ao-cost th, .ui-ao-cost td { height: 36px; }
  .ui-ao-run__grip { height: 14px; }
}


/* Permissions: one choice on top, the apps under it, the red lines last; an app opens in the shell's work area */
.ui-apm, .ui-apm-panel, .ui-apm-level {
  --ui-apm-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --apm-out: cubic-bezier(0.23, 1, 0.32, 1);
  --apm-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(0, 0, 0, 0.06)), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05));
  --apm-line: var(--aui-border, rgba(0, 0, 0, 0.06));
  /* The three choices – small marks only */
  --apm-allow: var(--aui-blue, #0190fe);
  --apm-ask: var(--aui-amber, #e8b000);
  --apm-never: rgba(0, 0, 0, 0.2);
  --apm-c-purple: var(--aui-purple, #a651f0);
  --apm-c-green: var(--aui-green, #5fc88a);
  --apm-c-orange: var(--aui-orange, #f28a2e);
  --apm-c-blue: var(--aui-blue, #0190fe);
  --apm-c-amber: var(--aui-amber, #e8b000);
  --apm-c-teal: var(--aui-teal, #13b3a0);
  --apm-c-pink: var(--aui-pink, #ee3e9e);
}
:where(.dark, [data-theme="dark"]) :is(.ui-apm, .ui-apm-panel, .ui-apm-level) {
  --ui-apm-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --apm-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(255, 255, 255, 0.08)), 0 1px 2px 0 rgba(0, 0, 0, 0.3));
  --apm-line: var(--aui-border, rgba(255, 255, 255, 0.07));
  --apm-allow: var(--aui-blue, #4fb0fe);
  --apm-ask: var(--aui-amber, #e6c24d);
  --apm-never: rgba(255, 255, 255, 0.25);
  --apm-c-purple: var(--aui-purple, #b98af0);
  --apm-c-green: var(--aui-green, #7dcf9f);
  --apm-c-orange: var(--aui-orange, #f2a15c);
  --apm-c-blue: var(--aui-blue, #4fb0fe);
  --apm-c-amber: var(--aui-amber, #e6c24d);
  --apm-c-teal: var(--aui-teal, #4fc3b4);
  --apm-c-pink: var(--aui-pink, #f06db5);
}
.ui-apm {
  position: relative;
  container: ui-apm / inline-size;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
.ui-apm-num { font-variant-numeric: tabular-nums; }
.ui-apm-faint { color: var(--faint); }
.ui-apm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:is(.ui-apm, .ui-apm-panel) :focus-visible { outline: 2px solid var(--ui-apm-focus); outline-offset: 2px; }
:is(.ui-apm, .ui-apm-panel) :is(input, textarea):focus-visible { outline: none; }

.ui-apm-head { display: flex; flex: none; align-items: center; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-apm-title { margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-apm-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ui-apm-page { display: grid; gap: 28px; max-width: 680px; margin: 0 auto; padding: 24px 24px 48px; }
.ui-apm-intro { margin: 0 0 -8px; font-size: 13px; line-height: 20px; color: var(--muted); }

.ui-apm-section { display: grid; gap: 8px; }
.ui-apm-label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-apm-label > svg { flex: none; }
.ui-apm-note { margin: -4px 0 2px; font-size: 12px; line-height: 16px; color: var(--faint); }
.ui-apm-card { margin: 0; padding: 0; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--apm-card-shadow); }
.ui-apm-section > .ui-as-empty { margin-top: 0; }

/* ---------- Autonomy: three tiles and what they mean ---------- */
.ui-apm-auto { padding: 6px; }
/* A segmented choice: three options on a gray track, the picked one a white card that glides */
.ui-apm-tiles { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: calc(var(--aui-radius, 7px) + 2px); background: color-mix(in srgb, var(--ink) 3.5%, var(--card)); isolation: isolate; }
.ui-apm-tiles__thumb { position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 10px) / 3); border-radius: var(--aui-radius, 7px); background: var(--card); box-shadow: var(--apm-card-shadow); transform: translateX(calc(var(--apm-at, 1) * (100% + 2px))); transition: transform 420ms var(--apm-out); }
.ui-apm-tile { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 10px 12px 12px; border-radius: var(--aui-radius, 7px); text-align: left; transition: color 160ms ease; }
.ui-apm-tile:focus-visible { outline-offset: -2px; }
.ui-apm-tile__head { display: flex; align-items: center; gap: 8px; }
.ui-apm-tile__icon { display: grid; flex: none; place-items: center; width: 16px; color: var(--faint); transition: color 240ms ease; }
.ui-apm-tile:hover .ui-apm-tile__icon { color: var(--muted); }
.ui-apm-tile[aria-checked="true"] .ui-apm-tile__icon { color: var(--apm-allow); }
.ui-apm-tile:not([aria-checked="true"]) .ui-apm-tile__name { color: var(--text); }
.ui-apm-tile__name { font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-apm-tile__text { padding-left: 24px; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-apm-means { display: grid; gap: 10px; margin-top: 6px; padding: 12px 8px 8px; box-shadow: inset 0 0.5px 0 var(--apm-line); }
.ui-apm-means__line { margin: 0; font-size: 13px; line-height: 20px; color: var(--muted); }
.ui-apm-means__line b { font-weight: 500; color: var(--ink); }
.ui-apm-bar { display: flex; gap: 2px; height: 4px; }
.ui-apm-bar__seg { flex-basis: 0; min-width: 0; border-radius: 2px; transition: flex-grow 640ms var(--apm-out); }
.ui-apm-bar__seg[data-level="allow"] { background: var(--apm-allow); }
.ui-apm-bar__seg[data-level="ask"] { background: var(--apm-ask); }
.ui-apm-bar__seg[data-level="never"] { background: var(--apm-never); }

/* ---------- Apps: one quiet row each ---------- */
.ui-apm-apps { padding: 4px; }
.ui-apm-app { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); text-align: left; transition: background-color 140ms ease; }
.ui-apm-app:hover { background: var(--hover); }
.ui-apm-app[aria-current] { background: color-mix(in srgb, var(--ink) 4%, var(--card)); }
.ui-apm-app:focus-visible { outline-offset: -2px; }
.ui-apm-apps li + li .ui-apm-app { box-shadow: 0 -0.5px 0 var(--apm-line); }
.ui-apm-mark { display: grid; flex: none; place-items: center; border-radius: 7px; background: color-mix(in srgb, var(--apm-tone) 13%, var(--card)); color: var(--apm-tone); }
/* A company's logo: on a white tile with the card's hairline – or on its brand color */
.ui-apm-mark[data-logo] { background: #fff; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.ui-apm-mark[data-tile] { box-shadow: none; }
/* On the dark panel a dark brand tile (GitHub) keeps a hairline edge */
:where(.dark, [data-theme="dark"]) .ui-apm-mark[data-tile] { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.16); }
.ui-apm-mark[data-logo] svg { display: block; width: var(--apm-glyph); height: var(--apm-glyph); }
/* A tab with the app's logo: the shell's own glyph steps aside */
.ui-asw-ptab:has(.ui-apm-tablabel) > svg { display: none; }
.ui-apm-tablabel { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ui-apm-tablabel .ui-apm-mark { border-radius: 4px; }
.ui-apm-tablabel > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-app__text { display: grid; flex: 0 1 200px; min-width: 0; }
.ui-apm-app__name { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-app__account { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--faint); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-app__summary { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.ui-apm-app__words { min-width: 0; overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-app__chev { display: grid; flex: none; place-items: center; color: var(--faint); }
.ui-apm-mini { display: flex; flex: none; gap: 2px; width: 36px; height: 4px; }
.ui-apm-mini__seg { flex-basis: 0; min-width: 3px; border-radius: 2px; background: var(--apm-never); transition: flex-grow 640ms var(--apm-out), background-color 400ms ease; }
.ui-apm-mini__seg[data-level="allow"] { background: var(--apm-allow); }
.ui-apm-mini__seg[data-level="ask"] { background: var(--apm-ask); }
.ui-apm-mark__letter { font-weight: 500; line-height: 1; }
.ui-apm-dot { display: block; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--apm-never); transition: background-color 400ms ease; }
.ui-apm-dot[data-level="allow"] { background: var(--apm-allow); }
.ui-apm-dot[data-level="ask"] { background: var(--apm-ask); }
.ui-apm-dot[data-level="mixed"] { background: conic-gradient(var(--apm-allow) 0 50%, var(--apm-ask) 0); }

/* ---------- Actions: rows in a card, a quiet choice at the end ---------- */
.ui-apm-actions { padding: 2px 4px; }
.ui-apm-action { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 4px 6px 8px; }
.ui-apm-action + .ui-apm-action { box-shadow: inset 0 0.5px 0 var(--apm-line); }
.ui-apm-action[data-limit] { flex-wrap: wrap; row-gap: 2px; }
.ui-apm-action__icon { display: grid; flex: none; place-items: center; width: 16px; color: var(--muted); }
.ui-apm-action__text { display: grid; flex: 1; min-width: 0; }
.ui-apm-action__name { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-action__detail { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--faint); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-level { flex: none; }
.ui-apm-choice { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12.5px; color: var(--text); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-apm-choice:hover, .ui-apm-choice[aria-expanded="true"] { background: var(--chip); color: var(--ink); }
.ui-apm-choice > svg { flex: none; color: var(--faint); }
.ui-apm-choice > .ui-apm-dot { width: 7px; height: 7px; }

.ui-apm-limit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; padding: 0 0 4px 26px; font-size: 12px; color: var(--muted); }
.ui-apm-limit__field { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: 0 0 0 0.5px var(--aui-border-strong, rgba(0, 0, 0, 0.12)); color: var(--muted); transition: box-shadow 140ms ease; }
:where(.dark, [data-theme="dark"]) .ui-apm-limit__field { box-shadow: 0 0 0 0.5px var(--aui-border-strong, rgba(255, 255, 255, 0.15)); }
.ui-apm-limit__field:focus-within { box-shadow: 0 0 0 1px var(--muted); }
.ui-apm-limit__field input { padding: 0; border: 0; background: none; font: inherit; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; outline: none; }

/* ---------- App panel ---------- */
.ui-apm-panel { display: flex; flex-direction: column; gap: 22px; padding: 4px 4px 16px; }
.ui-apm-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-apm-panel :focus-visible { outline-offset: -2px; }
.ui-apm-panel__head { display: flex; align-items: center; gap: 12px; }
.ui-apm-panel__titles { display: grid; min-width: 0; }
.ui-apm-panel__title { margin: 0; overflow: hidden; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-panel__account { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-panel .ui-apm-card { margin: 0 -8px; }
.ui-apm-group { display: grid; gap: 8px; }
.ui-apm-group__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-right: -4px; }
.ui-apm-events { padding: 2px 12px; }
.ui-apm-events li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-apm-events li + li { box-shadow: inset 0 0.5px 0 var(--apm-line); }
.ui-apm-events__text { display: grid; flex: 1; min-width: 0; }
.ui-apm-events__what { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-apm-events__when { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
/* The only colored words: how it ended */
.ui-apm-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); font-size: 11px; font-weight: 500; line-height: 18px; white-space: nowrap; background: var(--chip); color: var(--muted); }
.ui-apm-badge[data-outcome="approved"] { background: color-mix(in srgb, var(--aui-blue, #0190fe) 14%, var(--card)); color: var(--aui-info, #0070d6); }
.ui-apm-badge[data-outcome="blocked"] { background: color-mix(in srgb, var(--aui-red, #f04438) 13%, var(--card)); color: var(--aui-danger, #c4320a); }
:where(.dark, [data-theme="dark"]) .ui-apm-badge[data-outcome="approved"] { color: #8dccfe; }
:where(.dark, [data-theme="dark"]) .ui-apm-badge[data-outcome="blocked"] { color: var(--aui-danger, #ff8a7a); }

/* The shell's buttons wait in the corners – the head steps aside */
.ui-as-app[data-panel="closed"] .ui-apm-head { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-apm-head { padding-left: 46px; padding-right: 52px; }
}
@container ui-apm (max-width: 620px) {
  .ui-apm-page { padding: 16px 16px 40px; gap: 24px; }
  /* Stacked on phones: the thumb steps aside, the picked option is its own white card */
  .ui-apm-tiles { grid-template-columns: minmax(0, 1fr); }
  .ui-apm-tiles__thumb { display: none; }
  .ui-apm-tile { padding: 8px 10px; }
  .ui-apm-tile[aria-checked="true"] { background: var(--card); box-shadow: var(--apm-card-shadow); }
  .ui-apm-app__words { display: none; }
  .ui-apm-app__text { flex: 1 1 auto; }
}

/* Loading: the same cards, rows and line heights – gray bars in place of the text */
:is(.ui-apm, .ui-apm-panel) [data-skel] { pointer-events: none; }
.ui-apm-skel-line { display: flex; align-items: center; min-width: 0; }
.ui-apm-skel-chev { width: 12px; }
.ui-apm-skel-choice { display: flex; flex: none; align-items: center; height: 28px; padding: 0 8px; }
.ui-apm-apps > [data-skel] + [data-skel] { box-shadow: 0 -0.5px 0 var(--apm-line); }
.ui-apm-skel-event { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-apm-skel-event + .ui-apm-skel-event { box-shadow: inset 0 0.5px 0 var(--apm-line); }
@container ui-apm (max-width: 620px) {
  .ui-apm .ui-apm-skel-words { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-apm-bar__seg, .ui-apm-tiles__thumb, .ui-apm-dot, .ui-apm-mini__seg { transition: none; }
}
@media (pointer: coarse) {
  .ui-apm-choice { min-height: 36px; }
  .ui-apm-limit__field { height: 32px; }
}


/* Agent run: the plan and its activity in the middle; what needs you sits in the App Shell's work area on the right */
.ui-ar { display: flex; height: 100%; min-height: 0; }
.ui-ar__main { display: flex; flex: 1; flex-direction: column; min-width: 0; }

.ui-ar__bar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--as-head-h, 48px);
  padding: 0 12px 0 20px;
  color: var(--muted);
}
.ui-ar__crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; white-space: nowrap; }
.ui-ar__crumbs i { font-style: normal; color: var(--faint); }
.ui-ar__crumbs b { overflow: hidden; font-weight: 500; color: var(--ink); text-overflow: ellipsis; }
.ui-ar__tools { display: flex; flex: none; align-items: center; gap: 6px; }
/* While the work area is folded away its icon sits at the bar's right end, on its centerline (the shell's) – the tools make room */
.ui-as-app:has(.ui-ar) > .ui-as-panel-open { right: calc(var(--frame-gap) + 12px); }
.ui-as-app[data-panel="closed"] .ui-ar__main > .ui-ar__bar .ui-ar__tools { margin-right: 34px; transition: margin-right 420ms var(--ease); }
.ui-ar__tools .ui-as-icon-btn[aria-pressed="true"] { background: var(--chip); color: var(--ink); }
.ui-ar__time { display: flex; align-items: center; gap: 6px; margin-right: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Status pill: a soft dot that breathes while the run is live */
.ui-ar__pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 22px;
  margin-left: 4px;
  padding: 0 9px 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}
.ui-ar__pill span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ui-ar__pill[data-phase="running"] span { animation: ui-ar-breathe 1.4s ease-in-out infinite; }
.ui-ar__pill[data-phase="waiting"] { background: color-mix(in srgb, var(--aui-orange, #f28a2e) 10%, transparent); color: var(--aui-warning, #b25e00); }
.ui-ar__pill[data-phase="waiting"] span { animation: ui-ar-breathe 1.4s ease-in-out infinite; }
.ui-ar__pill[data-phase="done"] { background: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent); color: var(--aui-success, #1e8a4f); }
.ui-ar__pill[data-phase="stopped"] { background: var(--chip); color: var(--muted); }
@keyframes ui-ar-breathe { 50% { opacity: 0.35; } }

.ui-ar__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 32px 40px; }
.ui-ar__column { display: flex; flex-direction: column; gap: 12px; max-width: 720px; margin: 0 auto; }

/* The run at a glance */
.ui-ar__hero { display: flex; flex-direction: column; padding: 4px 4px 18px; }
/* One line of text after the mark – a long agent or person name wraps like a sentence, not into columns */
.ui-ar__who { display: block; min-height: 22px; font-size: 12.5px; line-height: 22px; color: var(--muted); overflow-wrap: anywhere; }
.ui-ar__who i { margin: 0 6px; font-style: normal; color: var(--faint); }
.ui-ar__avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 7px; background: var(--chip); color: var(--ink); vertical-align: top; }
.ui-ar__title { margin: 10px 0 0; font-size: 22px; font-weight: 500; line-height: 30px; letter-spacing: -0.02em; color: var(--strong); text-wrap: balance; }
.ui-ar__progress { display: block; height: 4px; margin-top: 16px; overflow: hidden; border-radius: 2px; background: var(--chip); }
.ui-ar__progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 600ms var(--ease); }
.ui-ar__progress i[data-phase="waiting"] { background: #d97506; }
.ui-ar__progress i[data-phase="done"] { background: var(--aui-success, #1e8a4f); }
.ui-ar__progress i[data-phase="stopped"] { background: var(--faint); }
.ui-ar__figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 0; }
.ui-ar__figures div { display: grid; gap: 2px; min-width: 0; }
.ui-ar__figures dt { font-size: 12px; color: var(--muted); }
.ui-ar__figures dd { margin: 0; overflow: hidden; font-size: 15px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Plan and Activity: each its own gray layer with a head, the white cards of the tools stand out on it */
.ui-ar__block { display: flex; flex-direction: column; padding: 14px 16px 16px; border-radius: calc(var(--aui-radius-lg, 10px) + 4px); background: var(--frame); }
.ui-ar__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 500; line-height: 18px; color: var(--ink); }
.ui-ar__head svg { flex: none; color: var(--muted); }
.ui-ar__head > span { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

/* The plan flat in its layer: no card, no head of its own (the block has it), small quiet marks */
.ui-ar__block .ui-plc { max-width: none; }
.ui-ar__block .ui-plc__card { border-radius: 0; background: none; box-shadow: none; }
.ui-ar__block .ui-plc__head { display: none; }
.ui-ar__block .ui-plc__list { padding: 0; }
.ui-ar__block .ui-plc__step { --ui-plc-inset: 0px; grid-template-columns: 16px minmax(0, 1fr) auto; padding: 7px 0; }
.ui-ar__block .ui-plc__marker { width: 16px; height: 16px; margin-top: 2px; font-size: 9.5px; background: var(--card); }
.ui-ar__block .ui-plc__marker .ui-plc__spinner { width: 12px; height: 12px; }
.ui-ar__block .ui-plc__mark { width: 9px !important; height: 9px !important; }
.ui-ar__block .ui-plc__rail { top: 27px; bottom: -9px; left: 7.5px; }
.ui-ar__block .ui-plc__foot { min-height: 0; margin-top: 8px; padding: 12px 0 0; border-top: 1px solid var(--line); }

.ui-ar__label { display: block; padding: 0 0 10px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }

/* Company marks: a white tile with a hairline and a slight shadow, like the logos elsewhere */
.ui-ar-logo { display: grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 1px 1.5px rgba(0, 0, 0, 0.08); }
.ui-ar-logo svg { width: 12px; height: 12px; }
.ui-ar__tools-used { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.ui-ar__tools-used > span:first-of-type { margin-left: 4px; }
/* In the tool cards and their group the mark fills the icon spot */
.ui-ar__feed .ui-tclc__icon:has(.ui-ar-logo) { background: none; box-shadow: none; }
.ui-ar-ask__icon:has(svg[viewBox="0 0 24 24"]) { background: #fff; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 1px 1.5px rgba(0, 0, 0, 0.08); }
.ui-ar-ask__icon > svg[viewBox="0 0 24 24"] { width: 15px; height: 15px; }

/* Tool cards get room inside their folding list, so their focus ring and corners aren't cut off */
.ui-ar__feed .ui-tclc-group > .ui-tclc__body > .ui-tclc__clip { margin: 0 -4px; padding: 0 4px 4px; }
.ui-ar__entry { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 0 0 18px 28px; }
/* A fine line joins the step numbers into a timeline */
.ui-ar__entry::before { content: ""; position: absolute; top: 22px; bottom: 4px; left: 8px; width: 1px; background: var(--line-strong); }
.ui-ar__entry[data-last] { padding-bottom: 12px; }
.ui-ar__entry[data-last]::before { display: none; }
.ui-ar__entry-head { display: flex; align-items: center; min-width: 0; min-height: 18px; overflow-wrap: anywhere; font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-ar__num {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px var(--line-strong);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: background-color 200ms ease, color 200ms ease;
}
.ui-ar__num { background: var(--card); }
/* Done: a dark check on a soft gray ring – quieter than a filled dot */
.ui-ar__num[data-done] { background: color-mix(in srgb, var(--ink) 9%, transparent); box-shadow: none; color: var(--ink); }
.ui-ar__note { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.ui-ar__note[data-state="pending"] { color: var(--aui-warning, #b25e00); }
.ui-ar__note[data-state="approved"] { color: var(--aui-success, #1e8a4f); }
.ui-ar__note button { margin-left: 4px; font-weight: 500; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.ui-ar__loader { align-self: flex-start; margin-left: 28px; }

/* The work area: sections under small labels, no lines between them – like the brief in AI Chat / Agents */
.ui-ar__none { padding: 28px 12px; }
.ui-ar__panel-body { display: flex; flex-direction: column; gap: 22px; padding: 2px 2px 16px; }
.ui-ar__section { display: flex; flex-direction: column; }
/* A request for approval: one white card – what, why, the details, then Deny and Approve */
.ui-ar-ask { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ar-ask + .ui-ar-ask { margin-top: 10px; }
.ui-ar-ask__meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.ui-ar-ask__meta code { padding: 0 5px; border-radius: var(--aui-radius-sm, 5px); background: var(--chip); font-family: var(--aui-font-mono, ui-monospace, "SF Mono", Menlo, monospace); font-size: 11px; line-height: 18px; color: var(--text); }
.ui-ar-ask__risk { margin-left: auto; padding: 0 7px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 11.5px; font-weight: 500; line-height: 20px; color: var(--text); }
.ui-ar-ask__risk[data-risk="medium"] { background: color-mix(in srgb, var(--aui-orange, #f28a2e) 10%, transparent); color: var(--aui-warning, #b25e00); }
.ui-ar-ask__risk[data-risk="high"] { background: color-mix(in srgb, var(--aui-red, #f04438) 8%, transparent); color: var(--aui-danger, #c4320a); }
.ui-ar-ask__head { display: flex; align-items: flex-start; gap: 10px; }
.ui-ar-ask__icon { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--ink); }
.ui-ar-ask__titles { display: grid; min-width: 0; }
.ui-ar-ask__titles b { font-size: 13px; font-weight: 500; line-height: 18px; color: var(--ink); overflow-wrap: anywhere; }
.ui-ar-ask__titles small { overflow: hidden; font-size: 12.5px; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-ar-ask__details { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); }
.ui-ar-ask__details div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; font-size: 12.5px; line-height: 18px; }
.ui-ar-ask__details dt { color: var(--muted); }
.ui-ar-ask__details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.ui-ar-ask__actions { display: flex; justify-content: flex-end; gap: 6px; }
.ui-ar-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: calc(var(--aui-radius, 7px) + 1px); font-size: 12.5px; font-weight: 500; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); transition: background-color 140ms ease, opacity 140ms ease; }
.ui-ar-btn:hover { background: var(--hover); }
.ui-ar-btn--primary { padding-left: 10px; background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-ar-btn--primary:hover { background: var(--aui-primary, var(--ink)); opacity: 0.88; }
.ui-ar-ask__done { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.ui-ar-ask__done[data-status="approved"] { color: var(--aui-success, #1e8a4f); }
.ui-ar-ask__done[data-status="denied"] { color: var(--aui-danger, #c4320a); }
.ui-ar-ask__done { border-radius: calc(var(--aui-radius-sm, 5px) + 1px); }
/* Touch: Deny and Approve at a finger's height */
@media (pointer: coarse) {
  .ui-ar-btn { height: 34px; padding: 0 14px; }
  .ui-ar-btn--primary { padding-left: 12px; }
}
.ui-ar-ask[data-status="pending"] { box-shadow: var(--card-shadow), 0 0 0 3px color-mix(in srgb, var(--aui-orange, #f28a2e) 12%, transparent); }

.ui-ar__panel-body .ui-dfc__card { border-radius: calc(var(--aui-radius-lg, 10px) + 2px); box-shadow: var(--card-shadow); }
.ui-ar__panel-body .ui-dfc__body { padding: 14px 14px 16px; }
.ui-ar__panel-body .ui-dfc__text { font-size: 12.5px; line-height: 21px; }
.ui-ar__panel-body :is(.ui-dfc__btn, .ui-dfc__icon) { height: 26px; font-size: 12.5px; }
.ui-ar__panel-body .ui-dfc__icon { width: 26px; }
.ui-ar__count {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d97506;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  animation: ui-as-pop 320ms var(--ease) both;
}

/* Loading: gray shapes in the real containers – the bars sit centered in the real line heights */
:is(.ui-ar, .ui-ar__panel-body) [data-skel] { pointer-events: none; }
.ui-ar-skel-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-ar-skel-copy { position: relative; display: inline-block; min-width: 0; }
.ui-ar-skel-copy > i { font-style: normal; visibility: hidden; }
.ui-ar-skel-copy > .ui-as-skel { position: absolute; top: 50%; left: 0; translate: 0 -50%; }
.ui-ar-skel-in { position: relative; }
.ui-ar-skel-crumb { display: flex; flex: 0 1 auto; align-items: center; min-width: 0; }
.ui-ar__title.ui-ar-skel-line { height: 30px; }
.ui-ar-skel-plan { display: flex; flex-direction: column; }
.ui-ar-skel-step { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: 10px; align-items: start; padding: 7px 0; }
.ui-ar-skel-step > .ui-as-skel { margin-top: 2px; }
.ui-ar-skel-step__main { display: grid; gap: 2px; min-width: 0; }
.ui-ar-skel-step__sub { display: flex; align-items: center; gap: 8px; height: 16px; min-width: 0; }
/* The plan's foot: 12px above its 20px row and a hairline – 33px in all, like the real one */
.ui-ar-skel-plan__foot { display: flex; align-items: center; gap: 8px; height: 33px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.ui-ar-skel-num { position: absolute; top: 0; left: 0; }
.ui-ar-skel-group { display: flex; align-items: center; gap: 8px; height: 32px; }
.ui-ar-skel-risk { margin-left: auto; }
.ui-ar-skel-diff { border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ar-skel-diff__body { display: flex; flex-direction: column; padding: 14px 14px 16px; }
.ui-ar-skel-diff__label { display: flex; align-items: center; gap: 6px; height: 16px; margin-bottom: 8px; }
.ui-ar-skel-diff__foot { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 8px 8px 16px; border-top: 0.5px solid var(--line); }
.ui-ar-skel-diff__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ui-ar-skel-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.ui-ar__details { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; }
.ui-ar__details div { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; }
.ui-ar__details dt { display: flex; flex: none; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
/* Long names stay on one line, the full text is in the title */
.ui-ar__details dd { min-width: 0; margin: 0; overflow: hidden; font-weight: 500; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

:where(.dark, [data-theme="dark"]) .ui-ar__pill[data-phase="waiting"], :where(.dark, [data-theme="dark"]) .ui-ar__note[data-state="pending"] { color: var(--aui-amber, #e6c24d); }
:where(.dark, [data-theme="dark"]) .ui-ar__pill[data-phase="waiting"] { background: color-mix(in srgb, var(--aui-amber, #e6c24d) 12%, transparent); }
:where(.dark, [data-theme="dark"]) .ui-ar__pill[data-phase="done"], :where(.dark, [data-theme="dark"]) .ui-ar__note[data-state="approved"] { color: var(--aui-green, #5fc88a); }
:where(.dark, [data-theme="dark"]) .ui-ar__pill[data-phase="done"] { background: color-mix(in srgb, var(--aui-green, #7dcf9f) 12%, transparent); }

/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
.ui-ar__main > .ui-ar__bar { transition: padding-left 420ms var(--ease); }
/* Narrow panels: the time gives way */
@container ui-as-main (max-width: 1000px) {
  .ui-ar__time { display: none; }
}
@container ui-as (max-width: 900px) {
  .ui-ar__main > .ui-ar__bar { padding-left: 52px; }
}
@container ui-as (max-width: 600px) {
  .ui-ar__main .ui-ar__crumbs > svg, .ui-ar__main .ui-ar__crumbs > i { display: none; }
  .ui-ar__main .ui-ar__crumbs { font-size: 0; }
  .ui-ar__main .ui-ar__crumbs > b { font-size: 13px; }
  .ui-ar__bar { padding-right: 8px; }
  /* The status pill keeps only its dot, so the run's title stays readable */
  .ui-ar__main .ui-ar__pill { gap: 0; padding: 0 8px; font-size: 0; }
  .ui-ar__scroll { padding: 12px 12px 24px; }
  .ui-ar__figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-ar__block { padding: 12px; }
}


.ui-ags, .ui-ags-panel {
  --ui-ags-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --ags-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ags-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(0, 0, 0, 0.06)), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05));
  --ags-line: var(--aui-border, rgba(0, 0, 0, 0.06));
  --ags-blue: var(--aui-blue, #0190fe);
  --ags-c-purple: var(--aui-purple, #a651f0);
  --ags-c-orange: var(--aui-orange, #f28a2e);
  --ags-c-teal: var(--aui-teal, #13b3a0);
  --ags-c-blue: var(--aui-blue, #0190fe);
  --ags-c-amber: var(--aui-amber, #e8b000);
  --ags-c-pink: var(--aui-pink, #ee3e9e);
  --ags-c-green: var(--aui-green, #5fc88a);
  --ags-c-gray: rgba(0, 0, 0, 0.3);
}
:where(.dark, [data-theme="dark"]) :is(.ui-ags, .ui-ags-panel) {
  --ui-ags-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --ags-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(255, 255, 255, 0.08)), 0 1px 2px 0 rgba(0, 0, 0, 0.3));
  --ags-line: var(--aui-border, rgba(255, 255, 255, 0.07));
  --ags-blue: var(--aui-blue, #4fb0fe);
  --ags-c-purple: var(--aui-purple, #b98af0);
  --ags-c-orange: var(--aui-orange, #f2a15c);
  --ags-c-teal: var(--aui-teal, #4fc3b4);
  --ags-c-blue: var(--aui-blue, #4fb0fe);
  --ags-c-amber: var(--aui-amber, #e6c24d);
  --ags-c-pink: var(--aui-pink, #f06db5);
  --ags-c-green: var(--aui-green, #7dcf9f);
  --ags-c-gray: rgba(255, 255, 255, 0.32);
}
.ui-ags { position: relative; container: ui-ags / inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; background: var(--panel); }
.ui-ags-num { font-variant-numeric: tabular-nums; }
.ui-ags-faint { color: var(--faint); }
.ui-ags-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:is(.ui-ags, .ui-ags-panel) :focus-visible { outline: 2px solid var(--ui-ags-focus); outline-offset: 2px; }

.ui-ags-head { display: flex; flex: none; align-items: center; gap: 10px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); font-size: 13px; }
.ui-ags-title { margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-ags-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ui-ags-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: 760px; margin: 0 auto; padding: 24px 24px 48px; }
.ui-ags-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ui-ags-label { margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-ags-card { margin: 0; padding: 0; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--ags-card-shadow); }
.ui-ags-page > .ui-as-empty { margin-top: 0; }

/* ---------- Timeline: a live chart of how busy it is ---------- */
.ui-ags-line { display: grid; gap: 10px; padding: 14px 16px 14px; }
.ui-ags-line__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.ui-ags-line__top b { font-weight: 500; color: var(--ink); }
.ui-ags-chart { position: relative; contain: inline-size; }
.ui-ags-chart svg { display: block; overflow: visible; }
.ui-ags-chart__grid { stroke: var(--ags-line); stroke-width: 1; opacity: 0.4; }
.ui-ags-chart__base { stroke: var(--ags-line); stroke-width: 1; }
.ui-ags-chart__area { fill: url(#ui-ags-fade); }
.ui-ags-chart__line { fill: none; stroke: var(--ags-blue); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.ui-ags-chart__head { fill: var(--ags-blue); stroke: var(--card); stroke-width: 1.5; }
.ui-ags-chart__glow { fill: var(--ags-blue); opacity: 0.18; transform-box: fill-box; transform-origin: center; animation: ui-ags-glow 2200ms ease-in-out infinite; }
.ui-ags-tick { font: 400 11px var(--font-sans, inherit); fill: var(--faint); }
/* Runs: a line in the project's color with a square cap – red when it failed; coming ones dashed with a hollow cap */
.ui-ags-marker line { stroke: var(--ags-tone); stroke-width: 1; opacity: 0.55; }
.ui-ags-marker rect { fill: var(--ags-tone); }
.ui-ags-marker[data-failed] line { stroke: var(--aui-red, #f04438); opacity: 0.8; }
.ui-ags-marker[data-failed] rect { fill: var(--aui-red, #f04438); }
.ui-ags-marker[data-state="next"] line { stroke-dasharray: 2 3; opacity: 0.45; }
.ui-ags-marker[data-state="next"] circle { fill: var(--card); stroke: var(--ags-tone); stroke-width: 1.5; }
.ui-ags-marker[data-state="running"] line { opacity: 0.9; }
.ui-ags-mark { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); }
.ui-ags-mark:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ui-ags-mark:focus-visible { outline-offset: -2px; }
/* What's running, beside the head */
.ui-ags-chip { position: absolute; display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 9px 3px 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); background: var(--card); box-shadow: 0 0 0 0.5px var(--ags-line), 0 6px 16px -6px rgba(0, 0, 0, 0.2); font-size: 12px; line-height: 18px; color: var(--ink); white-space: nowrap; transform: translateX(10px); animation: ui-ags-chip 320ms var(--ags-out) both; pointer-events: none; }
.ui-ags-chip[data-flip] { transform: translateX(calc(-100% - 10px)); }
.ui-ags-chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ui-ags-line__say { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; line-height: 20px; color: var(--text); white-space: nowrap; }
.ui-ags-line__say b { font-weight: 500; color: var(--ink); }
.ui-ags-line__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-ags-live { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ags-blue); animation: ui-ags-blink 1200ms ease-in-out infinite; }

/* ---------- Rows ---------- */
/* The schedules sit right on the page – just the rows, with hairlines between them */
.ui-ags-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0 -10px; padding: 0; list-style: none; }
.ui-ags-row { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 5px); transition: background-color 140ms ease; }
.ui-ags-row:hover { background: var(--hover); }
.ui-ags-row[data-selected] { background: color-mix(in srgb, var(--ink) 4%, var(--card)); }
.ui-ags-row__main { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; min-height: 42px; padding: 0 0 0 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 5px); text-align: left; }
.ui-ags-row__main:focus-visible { outline-offset: -2px; }
.ui-ags-row__mark { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--ags-tone); }
.ui-ags-row[data-paused] .ui-ags-row__mark { background: none; box-shadow: inset 0 0 0 1.5px var(--ags-tone); }
.ui-ags-row__text { display: flex; flex: 1; align-items: baseline; gap: 10px; min-width: 0; }
.ui-ags-row__name { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-ags-row[data-paused] .ui-ags-row__name { color: var(--text); }
.ui-ags-row__cadence { flex: 0 100 auto; min-width: 0; overflow: hidden; font-size: 13px; line-height: 20px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-ags-row__nextline { display: none; font-size: 12px; line-height: 16px; color: var(--ink); }
.ui-ags-row__next { display: flex; flex: none; align-items: baseline; justify-content: flex-end; gap: 6px; width: 190px; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; }
.ui-ags-row__rel { font-size: 12px; }
.ui-ags-row__last { display: flex; flex: none; justify-content: flex-end; width: 78px; }
.ui-ags-row__cost { flex: none; width: 60px; white-space: nowrap; font-size: 12px; color: var(--muted); text-align: right; }
.ui-ags-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--muted); white-space: nowrap; }
.ui-ags-badge[data-outcome="needs"] { background: #ff9c0024; color: var(--aui-warning, #b25e00); }
.ui-ags-badge[data-outcome="failed"] { background: color-mix(in srgb, var(--aui-red, #f04438) 13%, var(--card)); color: var(--aui-danger, #c4320a); }
:where(.dark, [data-theme="dark"]) .ui-ags-badge[data-outcome="needs"] { color: var(--aui-warning, #ffb35c); }
:where(.dark, [data-theme="dark"]) .ui-ags-badge[data-outcome="failed"] { color: var(--aui-danger, #ff8a7a); }

.ui-ags-switch { position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 16%, var(--card)); transition: background-color 200ms ease; }
.ui-ags-switch[aria-checked="true"] { background: var(--ags-blue); }
.ui-ags-switch__knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 240ms var(--ags-out); }
.ui-ags-switch[aria-checked="true"] .ui-ags-switch__knob { transform: translateX(12px); }

.ui-ags-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--ags-card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, filter 140ms ease, opacity 140ms ease; }
.ui-ags-btn:hover { box-shadow: 0 0 0 0.5px var(--aui-border-strong, rgba(0, 0, 0, 0.1)), 0 2px 4px rgba(0, 0, 0, 0.06); }
.ui-ags-btn > svg { flex: none; color: var(--muted); }
.ui-ags-btn--dark { background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-ags-btn--dark > svg { color: inherit; }
.ui-ags-btn--dark:hover { box-shadow: none; filter: brightness(1.15); }
.ui-ags-btn:disabled { opacity: 0.55; cursor: default; filter: none; }
.ui-ags-btn:active:not(:disabled) { transform: scale(0.97); }

/* ---------- Panel ---------- */
.ui-ags-panel { display: flex; flex-direction: column; gap: 22px; padding: 4px 4px 16px; }
.ui-ags-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-ags-panel :focus-visible { outline-offset: -2px; }
.ui-ags-panel__head { display: flex; align-items: flex-start; gap: 10px; }
.ui-ags-panel__head .ui-ags-row__mark { margin-top: 7px; }
.ui-ags-panel__titles { display: grid; gap: 2px; min-width: 0; }
.ui-ags-panel__title { margin: 0; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); overflow-wrap: anywhere; }
.ui-ags-panel__sub { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-ags-panel__sub > svg { flex: none; }
.ui-ags-panel__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -8px; }
.ui-ags-panel__cost { margin-left: auto; font-size: 12px; }
.ui-ags-prompt-wrap { display: grid; justify-items: start; gap: 4px; }
.ui-ags-prompt-wrap .ui-ags-link { margin-left: 2px; }
.ui-ags-prompt:not([data-open]) { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
.ui-ags-prompt { margin: 0; padding-left: 10px; box-shadow: inset 2px 0 0 var(--ags-line); font-size: 13px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.ui-ags-panel .ui-ags-card { margin: 0 -8px; }
.ui-ags-list { padding: 2px 12px; }
.ui-ags-list li { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 13px; }
.ui-ags-list li + li { box-shadow: inset 0 0.5px 0 var(--ags-line); }
.ui-ags-list__when { color: var(--ink); }
.ui-ags-list li[data-skipped] .ui-ags-list__when { color: var(--faint); text-decoration: line-through; }
.ui-ags-list li > .ui-ags-faint { flex: 1; font-size: 12px; }
.ui-ags-link { display: inline-flex; flex: none; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-ags-link:hover { background: var(--chip); color: var(--ink); }
.ui-ags-history { padding: 2px 12px; }
.ui-ags-history li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-ags-history li + li { box-shadow: inset 0 0.5px 0 var(--ags-line); }
.ui-ags-history__text { display: grid; flex: 1; min-width: 0; font-size: 12px; line-height: 16px; }
.ui-ags-history__summary { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-ags-note { margin: 0; font-size: 13px; color: var(--faint); }

.ui-as-app[data-panel="closed"] .ui-ags-head { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-ags-head { padding-left: 46px; padding-right: 52px; }
}
@container ui-ags (max-width: 640px) {
  .ui-ags-page { padding: 16px 16px 40px; gap: 24px; }
  .ui-ags-row__cost, .ui-ags-row__last, .ui-ags-row__rel { display: none; }
  .ui-ags-row__next { width: auto; }
}
/* Phones: the name over its rhythm and the next run – two lines, the fill grows with them */
@container ui-ags (max-width: 440px) {
  .ui-ags-row__main { min-height: 56px; padding: 8px 0 8px 12px; }
  .ui-ags-row__main > .ui-ags-row__mark { align-self: flex-start; margin-top: 6px; }
  .ui-ags-row__text { flex-direction: column; align-items: stretch; gap: 0; }
  .ui-ags-row__cadence, .ui-ags-row__nextline { font-size: 12px; line-height: 16px; }
  .ui-ags-row__next { display: none; }
  .ui-ags-row__nextline { display: block; }
}

/* Loading: the same card, rows and line heights – gray bars in place of the text */
:is(.ui-ags, .ui-ags-panel) [data-skel] { pointer-events: none; }
.ui-ags-skel-line { display: flex; align-items: center; min-width: 0; }
.ui-ags-skel-cadence { flex: 0 100 auto; height: 20px; }
.ui-ags-row__text.ui-ags-skel-text { align-items: center; }
.ui-ags-skel-end { justify-content: flex-end; }
.ui-ags-skel-top { align-items: center; }
.ui-ags-skel-lh { height: 1lh; }
.ui-ags-skel-mark { margin-top: 7px; }
.ui-ags-skel-chart { height: 136px; padding: 10px 0 22px; }
.ui-ags-skel-prompt { display: grid; padding-left: 10px; box-shadow: inset 2px 0 0 var(--ags-line); }
.ui-ags-skel-run { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.ui-ags-skel-run--last { min-height: 0; padding: 8px 0; }
.ui-ags-skel-run + .ui-ags-skel-run { box-shadow: inset 0 0.5px 0 var(--ags-line); }
@container ui-ags (max-width: 440px) {
  .ui-ags-row__text.ui-ags-skel-text { align-items: stretch; }
  .ui-ags-skel-cadence { height: 16px; }
  .ui-ags-skel-cadence > * { height: 8px !important; }
}

@keyframes ui-ags-glow { 0%, 100% { transform: scale(0.7); opacity: 0.25; } 50% { transform: scale(1.25); opacity: 0.08; } }
@keyframes ui-ags-chip { from { opacity: 0; } }
@keyframes ui-ags-blink { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .ui-ags-chart__glow, .ui-ags-live, .ui-ags-chip { animation: none; }
}
@media (pointer: coarse) {
  .ui-ags-btn, .ui-ags-link { min-height: 36px; }
  .ui-ags-switch { width: 40px; height: 24px; border-radius: 12px; }
  .ui-ags-switch__knob { width: 20px; height: 20px; }
  .ui-ags-switch[aria-checked="true"] .ui-ags-switch__knob { transform: translateX(16px); }
}


.ui-agk, .ui-agk-panel {
  --ui-agk-focus: rgba(0, 96, 226, 0.7);
  --agk-out: cubic-bezier(0.23, 1, 0.32, 1);
  --agk-card-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --agk-line: rgba(0, 0, 0, 0.06);
  --agk-edge: rgba(0, 0, 0, 0.09);
  --agk-edge-soft: rgba(0, 0, 0, 0.05);
  --agk-edge-hover: rgba(0, 0, 0, 0.16);
  --agk-head: color-mix(in srgb, var(--ink) 4.5%, var(--panel));
  --agk-well: color-mix(in srgb, var(--ink) 3.5%, var(--card));
  --agk-blue: #0190fe;
  --agk-c-purple: #a651f0;
  --agk-c-orange: #f28a2e;
  --agk-c-teal: #13b3a0;
  --agk-c-blue: #0190fe;
  --agk-c-amber: #e8b000;
  --agk-c-pink: #ee3e9e;
  --agk-c-green: #5fc88a;
}
:where(.dark, [data-theme="dark"]) :is(.ui-agk, .ui-agk-panel) {
  --ui-agk-focus: rgba(77, 141, 255, 0.8);
  --agk-card-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --agk-line: rgba(255, 255, 255, 0.07);
  --agk-edge: rgba(255, 255, 255, 0.09);
  --agk-edge-soft: rgba(255, 255, 255, 0.06);
  --agk-edge-hover: rgba(255, 255, 255, 0.18);
  --agk-blue: #4fb0fe;
  --agk-c-purple: #b98af0;
  --agk-c-orange: #f2a15c;
  --agk-c-teal: #4fc3b4;
  --agk-c-blue: #4fb0fe;
  --agk-c-amber: #e6c24d;
  --agk-c-pink: #f06db5;
  --agk-c-green: #7dcf9f;
}
.ui-agk { position: relative; container: ui-agk / inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; background: var(--panel); }
.ui-agk-num { font-variant-numeric: tabular-nums; }
.ui-agk-faint { color: var(--faint); }
.ui-agk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:is(.ui-agk, .ui-agk-panel) :focus-visible { outline: 2px solid var(--ui-agk-focus); outline-offset: 2px; }
:is(.ui-agk, .ui-agk-panel) :is(input, textarea):focus-visible { outline: none; }

/* ---------- Head ---------- */
.ui-agk-head { display: flex; flex: none; align-items: center; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-agk-title { flex: none; margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-agk-search { display: flex; flex: 0 1 220px; align-items: center; gap: 6px; min-width: 0; height: 28px; margin-left: auto; padding: 0 8px; border-radius: 6px; background: var(--chip); color: var(--faint); cursor: text; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-agk-search:focus-within { background: var(--card); box-shadow: var(--card-shadow-hover); }
.ui-agk-search > svg { flex: none; }
.ui-agk-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; appearance: none; }
.ui-agk-search input::placeholder { color: var(--placeholder); }
.ui-agk-search input::-webkit-search-cancel-button { display: none; }

.ui-agk-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--card); box-shadow: var(--agk-card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease, color 140ms ease; }
.ui-agk-btn:hover { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06); }
.ui-agk-btn > svg { flex: none; color: var(--muted); }
.ui-agk-btn:has(> svg:first-child) { padding-left: 8px; }
.ui-agk-btn--quiet { background: none; box-shadow: none; color: var(--text); }
.ui-agk-btn--quiet:hover { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-agk-btn:active:not([aria-disabled]) { transform: scale(0.97); }

/* ---------- Your skills ---------- */
.ui-agk-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ui-agk-center { display: grid; min-height: 320px; place-items: center; padding: 40px 24px 80px; }
.ui-agk-body { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 28px; box-sizing: border-box; width: 100%; max-width: 752px; margin: 0 auto; padding: 20px 16px 40px; }
.ui-agk-chips { display: flex; gap: 4px; margin: -4px -16px -14px; padding: 4px 16px; overflow-x: auto; scrollbar-width: none; }
.ui-agk-chips::-webkit-scrollbar { display: none; }
.ui-agk-chips button { flex: none; height: 28px; padding: 0 8px; border-radius: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
.ui-agk-chips button:hover { color: var(--ink); }
.ui-agk-chips button:is([aria-selected="true"], [aria-checked="true"]) { background: var(--chip); color: var(--ink); }
.ui-agk-sect { display: grid; grid-template-columns: minmax(0, 1fr); }
.ui-agk-shead { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-agk-shead:has(+ .ui-agk-shead__text) { margin-bottom: 0; }
.ui-agk-shead__n { display: inline-block; font-size: 12px; font-weight: 400; color: var(--faint); animation: ui-agk-tick 420ms var(--agk-out); }
.ui-agk-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ui-agk-shead__text { margin: 0 0 12px; font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-agk-mark { display: grid; flex: none; place-items: center; border-radius: 7px; background: color-mix(in srgb, var(--agk-tone) 14%, var(--card)); color: var(--agk-tone); transition: filter 200ms ease, opacity 200ms ease; }

.ui-agk-switch { position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 16%, var(--card)); transition: background-color 200ms ease; }
.ui-agk-switch[aria-checked="true"] { background: var(--agk-blue); }
.ui-agk-switch__knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 240ms var(--agk-out); }
.ui-agk-switch[aria-checked="true"] .ui-agk-switch__knob { transform: translateX(12px); }
.ui-agk-card .ui-agk-switch { width: 26px; height: 16px; }
.ui-agk-card .ui-agk-switch__knob { width: 12px; height: 12px; }
.ui-agk-card .ui-agk-switch[aria-checked="true"] .ui-agk-switch__knob { transform: translateX(10px); }

/* Cards – calm: a hairline, small icon and name, two quiet lines, one chip; the switch or Install in the corner */
.ui-agk-card { position: relative; display: flex; min-width: 0; border-radius: 10px; background: var(--card); box-shadow: inset 0 0 0 0.5px var(--agk-edge); transition: box-shadow 160ms ease, background-color 160ms ease, opacity 300ms ease; }
.ui-agk-card:hover { background: color-mix(in srgb, var(--ink) 1.8%, var(--card)); box-shadow: inset 0 0 0 0.5px var(--agk-edge-soft), 0 1px 2px rgba(0, 0, 0, 0.04), 0 3px 8px -4px rgba(0, 0, 0, 0.08); }
.ui-agk-card[data-fresh] { animation: ui-agk-land 560ms var(--agk-out) both, ui-agk-glow 1200ms ease both; }
/* Landed: a light blue wave runs over the card once */
.ui-agk-card[data-fresh]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--agk-blue) 13%, transparent) 50%, transparent 65%) no-repeat; background-size: 250% 100%; animation: ui-agk-wave 900ms cubic-bezier(0.4, 0, 0.2, 1) 220ms both; }
.ui-agk-card[data-state="done"] { animation: ui-agk-leave 900ms ease 400ms both; }
.ui-agk-card__main { display: grid; flex: 1; align-content: start; gap: 6px; min-width: 0; padding: 12px 14px; border-radius: 10px; text-align: left; }
.ui-agk-card__main:focus-visible { outline-offset: -2px; }
.ui-agk-card__top { display: flex; align-items: center; gap: 8px; min-width: 0; height: 24px; padding-right: 36px; }
.ui-agk-card__name { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-agk-card__desc { display: -webkit-box; min-height: 36px; overflow: hidden; overflow-wrap: anywhere; font-size: 12.5px; line-height: 18px; color: var(--muted); -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ui-agk-card__foot { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 4px; }
.ui-agk-card__count { margin-left: auto; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.ui-agk-card__corner { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; height: 24px; }
.ui-agk-chip { max-width: 100%; overflow: hidden; padding: 0 6px; border-radius: 5px; background: var(--chip); font-size: 11.5px; line-height: 18px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-agk-card[data-off] :is(.ui-agk-card__name, .ui-agk-card__desc) { color: var(--faint); }
.ui-agk-card[data-off] .ui-agk-mark { filter: grayscale(1); opacity: 0.55; }
.ui-agk-card .ui-agk-mark { border-radius: 5px; }
/* Runs: two weeks as bars in the panel */
.ui-agk-runs__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ui-agk-runs__head > span { font-weight: 400; }
.ui-agk-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 6px; margin-top: 8px; }
.ui-agk-chart__y { display: flex; flex-direction: column; justify-content: space-between; height: 84px; margin: -6px 0; font-size: 11px; line-height: 12px; color: var(--faint); text-align: right; }
.ui-agk-chart__plot { position: relative; height: 72px; }
.ui-agk-chart__plot > i { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--agk-line); }
.ui-agk-chart__plot > i:nth-child(1) { top: 0; }
.ui-agk-chart__plot > i:nth-child(2) { top: 50%; }
.ui-agk-chart__plot > i:nth-child(3) { bottom: 0; border-top-style: solid; }
.ui-agk-runs { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 4px; }
.ui-agk-runs > span { flex: none; width: 9px; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--agk-tone) 18%, var(--card)); transform-origin: bottom; animation: ui-agk-bar 520ms var(--agk-out) both; transition: background-color 200ms ease; }
.ui-agk-runs > span[data-now] { background: color-mix(in srgb, var(--agk-tone) 70%, var(--card)); }
.ui-agk-chart[data-off] .ui-agk-runs > span { background: color-mix(in srgb, var(--ink) 12%, var(--card)); }
.ui-agk-runs__axis { display: flex; justify-content: space-between; padding: 0 2px; font-size: 11px; color: var(--faint); }
/* Install: the button turns into a ring that fills, then a check – the width glides with the words */
.ui-agk-install { min-width: 96px; }
.ui-agk-install[data-wide] { min-width: 120px; }
.ui-agk-install[data-small] { min-width: 0; width: 24px; height: 24px; padding: 0; box-shadow: inset 0 0 0 0.5px var(--agk-edge-hover); background: var(--card); }
.ui-agk-install[data-small][data-state="done"] { box-shadow: none; background: color-mix(in srgb, var(--agk-blue) 12%, var(--card)); }
.ui-agk-install[data-state="installing"] { color: var(--agk-blue); cursor: default; }
.ui-agk-install[data-state="done"] { background: color-mix(in srgb, var(--agk-blue) 12%, var(--card)); box-shadow: none; color: var(--agk-blue); cursor: default; }
.ui-agk-install__icon { display: grid; place-items: center; width: 14px; height: 14px; color: var(--muted); }
.ui-agk-install:not([data-state="idle"]) .ui-agk-install__icon { color: inherit; }
.ui-agk-install[data-state="done"] .ui-agk-install__icon { animation: ui-agk-pop 360ms var(--agk-out) both; }
.ui-agk-install__ring { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ui-agk-fill 1400ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.ui-agk-install__text { animation: ui-agk-swap 240ms var(--agk-out) both; }

/* ---------- Panel ---------- */
.ui-agk-panel { display: flex; flex-direction: column; gap: 28px; padding: 8px 8px 24px; }
.ui-agk-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-agk-panel :focus-visible { outline-offset: -2px; }
.ui-agk-panel__head { display: flex; align-items: center; gap: 12px; }
.ui-agk-panel__titles { display: grid; min-width: 0; }
.ui-agk-panel__title { margin: 0; overflow: hidden; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-agk-panel__sub { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-agk-panel__desc { margin: -14px 0 0; overflow-wrap: anywhere; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-agk-panel__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -12px; }
.ui-agk-panel__uses { margin-left: auto; font-size: 12px; }
.ui-agk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.ui-agk-dot[data-on] { background: var(--agk-blue); }
.ui-agk-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.ui-agk-label { margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-agk-triggers, .ui-agk-steps { display: grid; gap: 8px; margin: 0; padding: 12px 14px; list-style: none; border-radius: 10px; background: var(--agk-well); }
.ui-agk-triggers li { font-size: 13px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.ui-agk-steps li { display: flex; align-items: flex-start; gap: 10px; min-width: 0; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-agk-steps li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.ui-agk-steps__n { display: grid; flex: none; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 0.5px var(--agk-line); font-size: 11px; font-weight: 500; color: var(--muted); }
.ui-agk-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ui-agk-need { display: inline-flex; max-width: 100%; overflow-wrap: anywhere; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 8px; box-shadow: inset 0 0 0 0.5px var(--agk-line); font-size: 12.5px; line-height: 18px; color: var(--text); }
.ui-agk-need > svg { flex: none; color: var(--muted); }
.ui-agk-link { display: inline-flex; align-items: center; gap: 2px; height: 24px; margin: 0 -6px 0 auto; padding: 0 6px; border-radius: 6px; font-size: 12px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-agk-link:hover { background: var(--chip); color: var(--ink); }
.ui-agk-used { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ui-agk-used li { display: flex; align-items: baseline; gap: 12px; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-agk-used__task { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-agk-used li > .ui-agk-faint { flex: none; font-size: 12px; }
.ui-agk-note { margin: 0; font-size: 13px; color: var(--faint); }

.ui-as-app[data-panel="closed"] .ui-agk-head { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-agk-head { padding-left: 46px; padding-right: 52px; }
}
@container ui-agk (max-width: 560px) {
  .ui-agk-head { gap: 8px; }
  .ui-agk-search { flex: 0 0 28px; justify-content: center; padding: 0 7px; }
  .ui-agk-search input::placeholder { color: transparent; }
  .ui-agk-search:focus-within, .ui-agk-search:has(input:not(:placeholder-shown)) { flex: 1 1 auto; justify-content: flex-start; }
  .ui-agk-head__new > span { display: none; }
  .ui-agk-head .ui-agk-btn.ui-agk-head__new { width: 28px; padding: 0; }
  .ui-agk-tiles { grid-template-columns: minmax(0, 1fr); }
  .ui-agk-body { padding: 12px 12px 32px; }
  .ui-agk-card__desc { min-height: 0; }
  .ui-agk-chips { margin: -4px -12px -14px; padding: 4px 12px; }
}

/* ---------- New skill ---------- */
.ui-agk-modal { --ui-agk-focus: rgba(0, 96, 226, 0.7); --agk-out: cubic-bezier(0.23, 1, 0.32, 1); --agk-blue: #0190fe; --agk-well: color-mix(in srgb, var(--ink) 3.5%, var(--card)); position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: rgba(0, 0, 0, 0.16); animation: ui-agk-fade 180ms ease both; }
:where(.dark, [data-theme="dark"]) .ui-agk-modal { --ui-agk-focus: rgba(77, 141, 255, 0.8); --agk-blue: #4fb0fe; background: rgba(0, 0, 0, 0.4); }
.ui-agk-modal :focus-visible { outline: 2px solid var(--ui-agk-focus); outline-offset: 2px; }
.ui-agk-modal :is(input, textarea):focus-visible { outline: none; }
.ui-agk-modal__box { display: flex; flex-direction: column; width: 100%; max-width: 480px; max-height: 100%; overflow: auto; border-radius: 16px; background: var(--card); box-shadow: 0 0 0 0.5px var(--line-strong, rgba(0, 0, 0, 0.12)), 0 24px 48px -12px rgba(0, 0, 0, 0.25); animation: ui-agk-in 240ms var(--agk-out) both; }
.ui-agk-modal__head { display: flex; align-items: center; gap: 8px; padding: 16px 12px 4px 20px; }
.ui-agk-modal__head:has(> .ui-agk-modal__icon-btn:first-child) { padding-left: 12px; }
.ui-agk-modal__heading { display: grid; flex: 1; min-width: 0; }
.ui-agk-modal__heading b { font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); }
.ui-agk-modal__heading small { font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-agk-modal__icon-btn { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-agk-modal__icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.ui-agk-modal__icon-btn:disabled { opacity: 0.4; }
.ui-agk-modal__head > .ui-agk-modal__icon-btn:first-child { align-self: flex-start; margin-top: 4px; }
.ui-agk-modal__head > .ui-agk-modal__icon-btn:last-child { align-self: flex-start; }
.ui-agk-modal__body { padding: 16px 20px 20px; animation: ui-agk-swap 220ms var(--agk-out) both; }
.ui-agk-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; box-shadow: inset 0 0.5px 0 var(--line); }
.ui-agk-modal__cancel { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: var(--text); transition: background-color 140ms ease; }
.ui-agk-modal__cancel:hover { background: var(--hover); color: var(--ink); }
.ui-agk-modal__go { height: 32px; padding: 0 14px; border-radius: 8px; background: var(--ink); font-size: 13px; font-weight: 500; color: var(--card); transition: opacity 140ms ease; }
.ui-agk-modal__go:hover:not(:disabled) { opacity: 0.88; }
.ui-agk-modal__go:disabled { opacity: 0.35; cursor: default; }
/* The four ways in */
.ui-agk-ways { display: grid; gap: 4px; margin: -4px -8px 0; padding: 0; list-style: none; }
.ui-agk-way { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px 10px 10px; border-radius: 10px; text-align: left; color: var(--faint); transition: background-color 140ms ease, color 140ms ease; }
.ui-agk-way:hover { background: var(--agk-well); color: var(--muted); }
.ui-agk-way__icon { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--card); box-shadow: inset 0 0 0 0.5px var(--line-strong, rgba(0, 0, 0, 0.12)); color: var(--ink); }
.ui-agk-way__text { display: grid; flex: 1; min-width: 0; }
.ui-agk-way__text b { font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-agk-way__text small { font-size: 12.5px; line-height: 18px; color: var(--muted); }
/* Form */
.ui-agk-form { display: grid; gap: 16px; }
.ui-agk-field { display: grid; gap: 6px; }
.ui-agk-field > span { font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-agk-field > span em { margin-left: 4px; font-style: normal; font-weight: 400; color: var(--faint); }
.ui-agk-field :is(input, textarea) { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 0; border-radius: 8px; background: var(--agk-well); box-shadow: inset 0 0 0 0.5px transparent; font: inherit; font-size: 13px; line-height: 20px; color: var(--ink); resize: vertical; outline: none; transition: box-shadow 140ms ease, background-color 140ms ease; }
.ui-agk-field input { height: 36px; }
.ui-agk-field :is(input, textarea)::placeholder { color: var(--placeholder, var(--faint)); }
.ui-agk-field :is(input, textarea):focus { background: var(--card); box-shadow: inset 0 0 0 1px var(--line-strong, rgba(0, 0, 0, 0.16)), 0 1px 2px rgba(0, 0, 0, 0.04); }
.ui-agk-chips--form { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
.ui-agk-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.ui-agk-ideas button { max-width: 100%; padding: 4px 10px; border-radius: 8px; box-shadow: inset 0 0 0 0.5px var(--line-strong, rgba(0, 0, 0, 0.12)); font-size: 12.5px; line-height: 18px; text-align: left; color: var(--text); transition: background-color 140ms ease; }
.ui-agk-ideas button:hover { background: var(--agk-well); color: var(--ink); }
.ui-agk-writing { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0 36px; font-size: 13px; color: var(--muted); }
.ui-agk-writing .ui-agk-agent { transform: scale(1.5); margin-bottom: 4px; }
.ui-agk-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 32px 16px; border-radius: 12px; background: var(--agk-well); box-shadow: inset 0 0 0 1px var(--line); text-align: center; cursor: pointer; transition: background-color 160ms ease, box-shadow 160ms ease; }
.ui-agk-drop[data-over] { background: color-mix(in srgb, var(--agk-blue) 8%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--agk-blue) 45%, transparent); }
.ui-agk-drop:has(:focus-visible) { outline: 2px solid var(--ui-agk-focus); outline-offset: 2px; }
.ui-agk-drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ui-agk-drop__icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 10px; background: var(--card); box-shadow: inset 0 0 0 0.5px var(--line-strong, rgba(0, 0, 0, 0.12)); color: var(--ink); }
.ui-agk-drop b { font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-agk-drop small { font-size: 12.5px; color: var(--muted); }
/* The agent mark: 3×3 pixels in the agent blue; they twinkle in a diagonal wave while it writes */
.ui-agk-agent { --agk-mark: rgba(0, 96, 226, 0.78); display: grid; flex: none; grid-template-columns: repeat(3, 3px); grid-auto-rows: 3px; gap: 1.5px; place-content: center; width: 16px; height: 16px; }
:where(.dark, [data-theme="dark"]) .ui-agk-agent { --agk-mark: rgba(77, 141, 255, 0.85); }
.ui-agk-agent i { border-radius: 0.75px; background: var(--agk-mark); opacity: 0; }
.ui-agk-agent i[data-on] { opacity: 1; }
.ui-agk-agent[data-busy] i { animation: ui-agk-pixel 1.2s ease-in-out infinite both; }
.ui-agk-agent[data-busy] i:not([data-on]) { opacity: 0.16; }
@keyframes ui-agk-pixel { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes ui-agk-fade { from { opacity: 0; } }
@keyframes ui-agk-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

@keyframes ui-agk-fill { to { stroke-dashoffset: 0; } }
@keyframes ui-agk-pop { from { transform: scale(0.4); opacity: 0; } }
@keyframes ui-agk-swap { from { opacity: 0; transform: translateY(3px); } }
@keyframes ui-agk-tick { from { opacity: 0.3; transform: translateY(3px); } }
@keyframes ui-agk-leave { to { opacity: 0.45; } }
@keyframes ui-agk-bar { from { transform: scaleY(0); } }
@keyframes ui-agk-land { from { opacity: 0; transform: translateY(10px) scale(0.97); filter: blur(4px); } }
@keyframes ui-agk-glow { 0%, 40% { box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--agk-blue) 35%, transparent), 0 4px 14px -6px color-mix(in srgb, var(--agk-blue) 22%, transparent); } }
@keyframes ui-agk-wave { from { background-position: 120% 0; opacity: 1; } 85% { opacity: 1; } to { background-position: -20% 0; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-agk-install__ring { animation: none; stroke-dashoffset: 0; }
  .ui-agk-install__icon, .ui-agk-install__text, .ui-agk-shead__n, .ui-agk-card[data-state="done"], .ui-agk-card[data-fresh], .ui-agk-card[data-fresh]::after, .ui-agk-runs > span, .ui-agk-modal, .ui-agk-modal__box, .ui-agk-modal__body { animation: none; }
  .ui-agk-agent[data-busy] i { animation-duration: 2.4s; }
}
@media (pointer: coarse) {
  .ui-agk-btn, .ui-agk-chips button, .ui-agk-search, .ui-agk-link, .ui-agk-modal__icon-btn, .ui-agk-modal__cancel, .ui-agk-modal__go { min-height: 36px; }
  .ui-agk-switch, .ui-agk-card .ui-agk-switch { width: 40px; height: 24px; border-radius: 12px; }
  .ui-agk-switch__knob, .ui-agk-card .ui-agk-switch__knob { width: 20px; height: 20px; }
  .ui-agk-switch[aria-checked="true"] .ui-agk-switch__knob, .ui-agk-card .ui-agk-switch[aria-checked="true"] .ui-agk-switch__knob { transform: translateX(16px); }
}


/* Tasks: a list grouped by project; the open task sits in the shell's work area on the right */
/* The Task panel lives outside .ui-at – it shares the tints; the artifacts' viewers are the App Shell's */
.ui-at, .ui-at-task {
  --ui-at-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --at-wait-bg: #ff9c0029;
  --at-wait-fg: var(--aui-warning, #b25e00);
  --at-out: cubic-bezier(0.23, 1, 0.32, 1);
  --at-row-h: 40px;
  /* Accents – clear, soft, only ever small fills: squares, rings, glyphs, marks; text stays gray and black */
  --at-c-purple: var(--aui-purple, #a651f0);
  --at-c-green: var(--aui-green, #5fc88a);
  --at-c-orange: var(--aui-orange, #f28a2e);
  --at-c-blue: var(--aui-blue, #0190fe);
  --at-c-amber: var(--aui-amber, #e8b000);
  --at-c-cyan: var(--aui-cyan, #14b3f0);
  --at-c-teal: var(--aui-teal, #13b3a0);
  --at-c-pink: var(--aui-pink, #ee3e9e);
}
:where(.dark, [data-theme="dark"]) :is(.ui-at, .ui-at-task) {
  --ui-at-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --at-wait-bg: #fb6a0025;
  --at-wait-fg: var(--aui-warning, #ffb35c);
  /* A touch lighter and calmer on the dark panel */
  --at-c-purple: var(--aui-purple, #b98af0);
  --at-c-green: var(--aui-green, #7dcf9f);
  --at-c-orange: var(--aui-orange, #f2a15c);
  --at-c-blue: var(--aui-blue, #4fb0fe);
  --at-c-amber: var(--aui-amber, #e6c24d);
  --at-c-cyan: var(--aui-cyan, #5cc6ee);
  --at-c-teal: var(--aui-teal, #4fc3b4);
  --at-c-pink: var(--aui-pink, #f06db5);
}
.ui-at {
  position: relative;
  container: ui-at / inline-size;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
.ui-at-num { font-variant-numeric: tabular-nums; }
.ui-at-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Focus: one ring – 2px accent, following the element's corners – for the keyboard only */
:is(.ui-at, .ui-at-task) :focus-visible { outline: 2px solid var(--ui-at-focus); outline-offset: 2px; }
/* A text field shows its caret, never a ring */
:is(.ui-at, .ui-at-task) :is(input, textarea):focus-visible { outline: none; }
/* A focus moved for you – after a click, or back to where it came from – paints none; the next key brings it back */
:is(.ui-at, .ui-at-task) [data-quiet]:focus-visible { outline: none; }
/* Places the focus waits while their controls change – not controls themselves */
.ui-at-task:focus { outline: none; }

/* ---------- Head: the title and its count, Active / Done, New task ---------- */
.ui-at-head { display: flex; flex: none; align-items: center; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-at-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-at-title__count { font-size: 13px; font-weight: 400; color: var(--faint); }
.ui-at-seg { display: flex; flex: none; gap: 2px; }
.ui-at-seg button { height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-at-seg button:hover { color: var(--ink); }
.ui-at-seg button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.ui-at-head__new { position: relative; margin-left: auto; }

.ui-at-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease, filter 140ms ease, opacity 140ms ease; }
.ui-at-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-at-btn > svg { flex: none; color: var(--muted); }
.ui-at-btn:has(> svg:first-child) { padding-left: 8px; }
.ui-at-btn--quiet { background: none; box-shadow: none; color: var(--text); }
.ui-at-btn--quiet:hover { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-at-btn--dark { background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-at-btn--dark:hover { box-shadow: none; filter: brightness(1.15); }
.ui-at-btn--dark[aria-disabled] { opacity: 0.4; cursor: default; filter: none; }
.ui-at-btn:active:not([aria-disabled]) { transform: scale(0.97); }

/* ---------- New task: one line under the head ---------- */
.ui-at-new { display: flex; flex: none; align-items: flex-start; gap: 8px; min-height: 48px; margin: 8px 8px 0; padding: 8px 6px 8px 12px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--card); box-shadow: var(--card-shadow); animation: ui-at-drop 240ms var(--at-out) both; }
.ui-at-new > .ui-at-mark { margin: 9px 4px 0 0; }
/* The project and Create stay with the first line while the brief grows below */
.ui-at-new > :is(.ui-at-btn, .ui-at-new__project, .ui-as-anchor) { flex: none; margin-top: 2px; }
.ui-at-new__input { flex: 1; min-width: 0; min-height: 32px; max-height: 168px; padding: 6px 0; overflow-y: auto; border: 0; background: none; font: inherit; font-size: 13px; line-height: 20px; color: var(--ink); outline: none; resize: none; field-sizing: content; overscroll-behavior: contain; transition: height 160ms var(--at-out); }
.ui-at-new__input::placeholder { color: var(--placeholder); }
/* Typing in it: the line's own edge firms up a little – the caret says the rest */
.ui-at-new { transition: box-shadow 140ms ease; }
.ui-at-new:has(.ui-at-new__input:focus) { box-shadow: var(--card-shadow-hover); }
.ui-at-new__project { flex: none; min-width: 0; }
.ui-at-new__project .ui-at-btn { max-width: 160px; }
.ui-at-new__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- List ---------- */
.ui-at-scroll { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; }
.ui-at-tree { padding: 8px 8px 24px; outline: none; }
.ui-at-center { display: grid; flex: 1; place-items: center; padding: 40px 24px 80px; }
.ui-at-group + .ui-at-group { margin-top: 12px; }

.ui-at-ghead { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); cursor: pointer; user-select: none; transition: background-color 140ms ease; }
.ui-at-ghead:hover { background: var(--hover); }
/* Rows and heads: the ring only while you move through the list with the keyboard (data-kb), inset so the scroller never cuts it */
.ui-at :is(.ui-at-ghead, .ui-at-row):focus-visible { outline: none; }
.ui-at[data-kb] :is(.ui-at-ghead, .ui-at-row):focus-visible { outline: 2px solid var(--ui-at-focus); outline-offset: -2px; }
.ui-at-ghead__chev { display: grid; flex: none; place-items: center; width: 16px; color: var(--faint); transition: transform 200ms var(--at-out); }
.ui-at-ghead[aria-expanded="false"] .ui-at-ghead__chev { transform: rotate(-90deg); }
/* A project is just its name with a folder, in the text's own gray – the color lives in the progress rings */
.ui-at-ghead__icon { display: grid; flex: none; place-items: center; color: var(--text); }
.ui-at-ghead__name { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-at-ghead__count { flex: none; font-size: 12px; color: var(--faint); }
.ui-at-group__empty { display: flex; align-items: center; height: var(--at-row-h); margin: 0; padding: 0 12px 0 38px; font-size: 13px; color: var(--faint); }

.ui-at-row { display: flex; align-items: center; gap: 12px; height: var(--at-row-h); padding: 0 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); cursor: pointer; font-size: 13px; line-height: 20px; transition: background-color 140ms ease; }
.ui-at-row:hover { background: var(--hover); }
.ui-at-row[aria-selected="true"] { background: var(--chip); }
/* The ring takes the color of how far the task is (set inline); a done task is filled all the way in blue */
.ui-at-mark { flex: none; color: var(--muted); }
.ui-at-mark[data-done] { color: var(--at-c-green); }
.ui-at-row > .ui-at-mark { margin: 0 1px; }
.ui-at-row__main { display: flex; flex: 1; align-items: baseline; gap: 10px; min-width: 0; }
.ui-at-row__title { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-at-row__status { flex: 0 100 auto; min-width: 0; overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-at-row[data-done] .ui-at-row__title { color: var(--text); }
/* Steps, artifacts and time in fixed columns, so they line up from row to row */
.ui-at-row__steps { flex: none; width: 28px; font-size: 12px; color: var(--faint); text-align: right; }
.ui-at-row__files { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 4px; width: 34px; font-size: 12px; color: var(--faint); }
.ui-at-row__time { flex: none; width: 28px; font-size: 12px; color: var(--muted); text-align: right; }
/* A new task glides in at the top of its project */
.ui-at-row[data-fresh] { overflow: hidden; animation: ui-at-glide 420ms var(--at-out) both; }

/* The only color: Needs you */
.ui-at-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--at-wait-bg); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--at-wait-fg); white-space: nowrap; }
/* In a row it's the way into the card */
.ui-at-row__needs { position: relative; cursor: pointer; transition: filter 140ms ease; }
.ui-at-row__needs:hover { filter: saturate(1.4) brightness(0.96); }
.ui-at-row__needs::after { content: ""; position: absolute; inset: -6px -4px; }

/* Loading: the same groups and 40px rows, gray bars in place of the text */
.ui-at [data-skel] { pointer-events: none; }
.ui-at-skel-main { align-items: center; }
.ui-at-skel-main > :last-child { opacity: 0.6; }
.ui-at-skel-task { gap: 8px; padding-top: 7px; }
.ui-at-skel-props { display: grid; gap: 2px; margin-top: 18px; }
.ui-at-skel-props > span { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; height: 28px; }

/* ---------- Task panel – in the shell's work area on the right ---------- */
.ui-at-task { display: flex; flex-direction: column; gap: 20px; padding: 2px 4px 16px; }
.ui-at-task--empty { display: grid; min-height: 240px; place-items: center; }
.ui-at-task__goal { white-space: pre-line; margin: 0; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-at-task__faint { color: var(--faint); }
.ui-at-task__props { display: grid; gap: 2px; margin: 0; }
.ui-at-task__props > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; min-height: 28px; }
.ui-at-task__props dt { font-size: 12px; color: var(--muted); }
.ui-at-task__props dd { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; color: var(--ink); }
.ui-at-task__props dd > span:not(.ui-at-task__faint) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-at-task__section { display: flex; flex-direction: column; gap: 8px; }
.ui-at-task__label { display: flex; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
/* Steps: ticked circles, the next one an empty ring – the one waiting for you says so */
/* The plan on its own light gray tray that reaches out past the column – the steps stay in line with the rest */
.ui-at-steps { --at-tray: color-mix(in srgb, var(--ink) 2%, var(--panel)); display: grid; margin: 0 -10px; padding: 6px 10px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--at-tray); }
.ui-at-steps .ui-at-step__mark { background-color: var(--at-tray); }
.ui-at-step { position: relative; display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 13px; color: var(--ink); }
.ui-at-step:not(:last-child)::after { content: ""; position: absolute; top: 20px; bottom: -6px; left: 7px; width: 1px; background: var(--line); }
.ui-at-step__mark { position: relative; z-index: 1; display: grid; flex: none; place-items: center; width: 15px; height: 15px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px var(--line-strong, rgba(0, 0, 0, 0.16)); background: var(--panel); color: var(--panel); }
/* Done steps filled blue; the one it is on keeps its ring and gets a light, opaque fill of the same color – orange when it waits on you, blue while it runs */
.ui-at-step[data-state="done"] .ui-at-step__mark { background: var(--at-c-blue); box-shadow: none; }
.ui-at-step[data-state="done"] .ui-at-step__label, .ui-at-step[data-state="later"] .ui-at-step__label { color: var(--muted); }
.ui-at-step[data-state="you"] .ui-at-step__mark { background: color-mix(in srgb, var(--at-c-orange) 18%, var(--at-tray, var(--panel))); box-shadow: inset 0 0 0 1.5px var(--at-c-orange); }
.ui-at-step[data-state="now"] .ui-at-step__mark { background: color-mix(in srgb, var(--at-c-blue) 18%, var(--at-tray, var(--panel))); box-shadow: inset 0 0 0 1.5px var(--at-c-blue); }
.ui-at-step__label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-at-step__note { display: grid; place-items: center; width: 18px; height: 18px; margin-left: auto; padding: 0; }
/* What happened so far: plain lines, newest first */
.ui-at-history { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ui-at-history li { position: relative; padding-left: 16px; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-at-history li::before { content: ""; position: absolute; top: 8px; left: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.ui-at-history li:first-child { color: var(--ink); }
/* Decided: what you answered before, for this task */
/* Decided on a white card with the hairline stroke, reaching out like the steps and the Decide card */
.ui-at-decided { display: grid; gap: 0; margin: 0 -10px; padding: 2px 10px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-at-decided li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-at-decided li + li { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-at-decided li > svg { flex: none; color: var(--at-c-green); }
.ui-at-decided__text { display: grid; min-width: 0; }
.ui-at-decided__q { overflow: hidden; font-size: 13px; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-at-decided__a { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
/* The way on: the Inbox when it needs you, the agents behind it */
.ui-at-task__links { display: flex; align-items: center; gap: 8px; min-height: 28px; margin: 0 -4px 0 -8px; }
.ui-at-task__links .ui-at-btn--quiet { padding: 0 8px; }
.ui-at-link { display: inline-flex; align-items: center; gap: 4px; height: 28px; margin-left: auto; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--faint); transition: color 140ms ease, background-color 140ms ease; }
.ui-at-link:hover { background: var(--chip); color: var(--text); }
.ui-at-link > svg { flex: none; }
/* In the panel every ring sits inset – its body scrolls and would cut one outside */
.ui-at-task :focus-visible { outline-offset: -2px; }

/* Needs you: one quiet row – what waits, and the way to the Inbox */
/* Like the steps: the card reaches out past the column, its text stays in line with the rest */
.ui-at-needs { display: flex; align-items: center; gap: 12px; min-height: 56px; margin: 0 -10px; padding: 8px 8px 8px 10px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-at-needs__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ui-at-needs__head { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 2px; }
.ui-at-needs__count { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-at-needs__q { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* The shell's buttons wait in the corners – the sidebar's on the left below 900px, the folded work area's on the right: the head steps aside */
.ui-as-app[data-panel="closed"] .ui-at-head { padding-right: 52px; }
/* The head is the shell's head row (--as-head-h), so it shares the icons' centerline at every width */
@container ui-as (max-width: 900px) {
  .ui-at-head { padding-left: 46px; padding-right: 52px; }
}

/* Phones: each row on two lines – the title, and where it is under it; the counts make room */
@container ui-at (max-width: 560px) {
  /* On the list, not on .ui-at: a container's own query only reaches what's inside it */
  .ui-at-tree { --at-row-h: 52px; }
  .ui-at-head { gap: 8px; }
  .ui-at-row { gap: 10px; padding: 0 10px; }
  .ui-at-row > .ui-at-mark { align-self: flex-start; margin-top: 10px; }
  .ui-at-row__main { flex-direction: column; align-items: stretch; gap: 0; }
  .ui-at-row__status { font-size: 12px; line-height: 16px; }
  .ui-at-row__steps, .ui-at-row__files { display: none; }
  .ui-at-group__empty { padding-left: 34px; }
}
@container ui-at (max-width: 400px) {
  .ui-at-head__new > span { display: none; }
  /* Only the +: a square with the icon in its middle – no padding left over from the label (it outranks .ui-at-btn:has(> svg)) */
  .ui-at-head .ui-at-btn.ui-at-head__new { position: relative; display: grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0; gap: 0; }
  .ui-at-head .ui-at-head__new > svg { display: block; }
}

@keyframes ui-at-glide {
  from { height: 0; opacity: 0; transform: translateY(-6px); }
  60% { opacity: 1; }
  to { height: var(--at-row-h); transform: none; }
}
@keyframes ui-at-drop { from { opacity: 0; transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .ui-at-row[data-fresh], .ui-at-new { animation: none; }
  .ui-at-ghead__chev { transition: none; }
}

/* Touch: every control at least 36px, no shortcut hints */
@media (pointer: coarse) {
  .ui-at-btn, .ui-at-seg button, .ui-at-link { min-height: 36px; }
  /* The + keeps its square and takes the tap with an invisible ring, like the shell's icon buttons */
  .ui-at-head .ui-at-head__new::after { content: ""; position: absolute; inset: -4px; }
}


/* Thread: one conversation in a reading column, the composer at the bottom; artifacts open in the shell's work area */
/* The Task tab lives in the shell's work area, outside .ui-th – it shares the tints */
.ui-th, .ui-th-tp {
  --ui-th-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --th-out: cubic-bezier(0.23, 1, 0.32, 1);
  --th-col: 680px;
  --th-wait-bg: #ff9c0029;
  --th-wait-fg: var(--aui-warning, #b25e00);
  /* Accents – only ever small marks: rings, glyphs, badges, dots; text stays gray and black */
  --th-c-purple: var(--aui-purple, #a651f0);
  --th-c-green: var(--aui-green, #5fc88a);
  --th-c-orange: var(--aui-orange, #f28a2e);
  --th-c-blue: var(--aui-blue, #0190fe);
  --th-c-amber: var(--aui-amber, #e8b000);
  --th-c-teal: var(--aui-teal, #13b3a0);
  --th-c-pink: var(--aui-pink, #ee3e9e);
  --th-c-red: var(--aui-red, #f04438);
}
.ui-th {
  position: relative;
  container: ui-th / inline-size;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
:where(.dark, [data-theme="dark"]) :is(.ui-th, .ui-th-tp) {
  --ui-th-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --th-wait-bg: #fb6a0025;
  --th-wait-fg: var(--aui-warning, #ffb35c);
  --th-c-purple: var(--aui-purple, #b98af0);
  --th-c-green: var(--aui-green, #7dcf9f);
  --th-c-orange: var(--aui-orange, #f2a15c);
  --th-c-blue: var(--aui-blue, #4fb0fe);
  --th-c-amber: var(--aui-amber, #e6c24d);
  --th-c-teal: var(--aui-teal, #4fc3b4);
  --th-c-pink: var(--aui-pink, #f06db5);
  --th-c-red: var(--aui-red, #ff6b5f);
}
.ui-th-num { font-variant-numeric: tabular-nums; }
.ui-th-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Focus: one ring – 2px accent – for the keyboard only; a text field shows its caret, never a ring */
.ui-th :focus-visible, .ui-th-tp :focus-visible { outline: 2px solid var(--ui-th-focus); outline-offset: 2px; }
.ui-th :is(input, textarea):focus-visible { outline: none; }
.ui-th-scroll:focus-visible { outline-offset: -2px; }

/* ---------- Head: the thread's name and a quiet summary – no fill, no line: the conversation runs up under it ---------- */
.ui-th-head { position: absolute; top: 0; right: 0; left: 0; z-index: 3; display: flex; align-items: center; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; pointer-events: none; }
.ui-th-head > * { pointer-events: auto; }
.ui-th-title { min-width: 0; margin: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-summary { display: flex; flex: none; align-items: center; gap: 0; margin-left: auto; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); background: var(--panel); }
/* With the work area open the counts would sit over the text – they step aside */
.ui-as-app[data-panel="open"] .ui-th-summary { display: none; }
.ui-th-summary__item { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--muted); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-th-summary__item:hover { background: var(--chip); color: var(--ink); }
.ui-th-summary__item .ui-th-num { margin-right: -2px; color: var(--text); }
.ui-th-summary__sep { font-size: 12px; color: var(--faint); }
.ui-th-summary__ring { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--th-c-teal); }
.ui-th-summary__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--th-c-amber); }

/* ---------- Body: the conversation, the banner over its top, the Jump pill over its bottom ---------- */
.ui-th-body { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; }
/* The conversation runs up to the main area's top edge and only fades in its last few pixels */
.ui-th-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px); mask-image: linear-gradient(to bottom, transparent 0, #000 20px); }
/* No chat yet: the empty state sits in the middle of the column's height */
.ui-th-col:has(> .ui-th-empty) { box-sizing: border-box; min-height: 100%; }
.ui-th-empty { display: grid; flex: 1; place-items: center; }
.ui-th-col { display: flex; flex-direction: column; gap: 24px; max-width: calc(var(--th-col) + 48px); margin: 0 auto; padding: calc(var(--as-head-h, 48px) + 8px) 24px 32px; font-size: 14px; line-height: 1.6; color: var(--ink); }

/* Yours: a soft bubble on the right */
.ui-th-user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; animation: ui-th-in 420ms var(--th-out) both; }
.ui-th-user__bubble { max-width: 80%; margin: 0; padding: 8px 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--chip); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; transition: opacity 200ms ease; }
.ui-th-user[data-status="queued"] .ui-th-user__bubble, .ui-th-user[data-status="sending"] .ui-th-user__bubble { opacity: 0.55; }
.ui-th-user__files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 80%; margin: 0; padding: 0; list-style: none; }
.ui-th-user__state { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-th-user__state > svg { flex: none; }

/* The orchestrator's: plain text on the page under a small mark */
.ui-th-agent { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; overflow-wrap: anywhere; animation: ui-th-in 420ms var(--th-out) both; }
.ui-th-who { display: flex; align-items: center; gap: 8px; height: 22px; font-size: 13px; font-weight: 500; color: var(--ink); }
/* The orchestrator's mark: a 3 × 3 pixel square like the agents in Collaboration Stream – it ripples while it writes */
.ui-th-avatar { display: grid; flex: none; grid-template-columns: repeat(3, 3px); grid-auto-rows: 3px; gap: 1.5px; place-content: center; width: 16px; height: 16px; }
.ui-th-avatar i { border-radius: 0.75px; background: var(--th-c-purple); opacity: 0; }
.ui-th-avatar i[data-on] { opacity: 1; }
.ui-th-avatar[data-busy] i { animation: ui-th-pixel 1.2s ease-in-out infinite both; }
.ui-th-avatar[data-busy] i:not([data-on]) { opacity: 0.16; }
@keyframes ui-th-pixel { 50% { opacity: 0.35; } }
.ui-th-who__time { font-size: 12px; font-weight: 400; color: var(--faint); }
.ui-th-text { display: grid; gap: 10px; }
.ui-th-text p { margin: 0; }
/* The caret while it streams: soft, breathing rather than blinking */
.ui-th-caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -0.16em; border-radius: 1px; background: var(--ink); animation: ui-th-caret 1.1s ease-in-out infinite; }
.ui-th-caret--alone { margin-left: 0; }
.ui-th-stopped { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ui-th-stopped__mark { width: 7px; height: 7px; border-radius: 1.5px; background: var(--faint); }

/* ---------- Tools that ran together ---------- */
.ui-th-tools { display: flex; flex-direction: column; align-items: flex-start; }
.ui-th-tools > .ui-th-tools__head { margin-left: -8px; }
.ui-th-tools__head { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; color: var(--muted); transition: color 140ms ease, background-color 140ms ease; }
.ui-th-tools__head:hover { color: var(--text); background: var(--hover); }
.ui-th-tools__glyph { display: grid; flex: none; place-items: center; width: 14px; height: 14px; color: var(--muted); }
.ui-th-tools[data-state="done"] .ui-th-tools__glyph { color: var(--th-c-green); }
.ui-th-tools[data-state="failed"] .ui-th-tools__glyph { color: var(--th-c-red); }
.ui-th-tools__title { position: relative; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; animation: ui-th-fade 320ms ease both; }
/* While they run the words carry a slow sheen, like the Thinking State's */
.ui-th-tools__title[data-shimmer]::after { content: attr(data-text); content: attr(data-text) / ""; position: absolute; inset: 0; color: transparent; background: linear-gradient(90deg, transparent 38%, var(--card) 50%, transparent 62%) 100% 0 / 300% 100% no-repeat; -webkit-background-clip: text; background-clip: text; animation: ui-th-sweep 1.8s linear infinite; pointer-events: none; }
.ui-th-tools__chev { display: grid; flex: none; place-items: center; color: var(--faint); opacity: 0; transition: opacity 140ms ease, transform 240ms var(--th-out); }
.ui-th-tools__head:is(:hover, :focus-visible) .ui-th-tools__chev { opacity: 1; }
.ui-th-tools[data-open="true"] .ui-th-tools__chev { transform: rotate(90deg); }
/* The signature: once the last one is done the rows fold together into the one line above */
.ui-th-tools__wrap { display: grid; grid-template-rows: 1fr; width: 100%; opacity: 1; transition: grid-template-rows 460ms var(--th-out), opacity 300ms ease; }
.ui-th-tools[data-open="false"] .ui-th-tools__wrap { grid-template-rows: 0fr; opacity: 0; }
.ui-th-tools__list { min-height: 0; margin: 0 0 0 7px; padding: 0 0 0 12px; overflow: hidden; list-style: none; box-shadow: inset 1px 0 0 var(--line); }
.ui-th-tools[data-open="false"] .ui-th-tool { transform: translateY(-4px); }
.ui-th-tool { display: flex; align-items: center; gap: 8px; height: 28px; font-size: 13px; color: var(--text); transition: transform 460ms var(--th-out); }
.ui-th-tool__mark { display: grid; flex: none; place-items: center; width: 12px; height: 12px; color: var(--muted); }
.ui-th-tool[data-status="done"] .ui-th-tool__mark { color: var(--th-c-green); animation: ui-th-pop 320ms var(--th-out) both; }
.ui-th-tool[data-status="failed"] .ui-th-tool__mark { color: var(--th-c-red); }
.ui-th-tool__stop { width: 7px; height: 7px; border-radius: 1.5px; background: var(--faint); }
.ui-th-tool__icon { display: grid; flex: none; place-items: center; color: var(--faint); }
.ui-th-tool__label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-th-tool[data-status="running"] .ui-th-tool__label { color: var(--ink); }
.ui-th-tool__error { color: var(--muted); }
.ui-th-tool__time { flex: none; font-size: 12px; color: var(--faint); }

/* ---------- Cards inside an answer – the Tasks and Inbox look ---------- */
.ui-th-card { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 8px 8px 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); cursor: pointer; transition: box-shadow 140ms ease; animation: ui-th-in 380ms var(--th-out) both; }
.ui-th-card:hover { box-shadow: var(--card-shadow-hover); }
.ui-th-card + .ui-th-card { margin-top: -4px; }
.ui-th-ring { flex: none; }
.ui-th-task__main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ui-th-task__title { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-task__status { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-task__steps { flex: none; font-size: 12px; color: var(--faint); }
.ui-th-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--th-wait-bg); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--th-wait-fg); white-space: nowrap; }
.ui-th-files { margin-top: -2px; }

.ui-th-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease, filter 140ms ease; }
.ui-th-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-th-btn > svg { flex: none; color: var(--muted); }
.ui-th-btn--quiet { background: none; box-shadow: none; color: var(--text); }
.ui-th-btn--quiet:hover { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-th-btn--dark { background: var(--ink); box-shadow: none; color: var(--card); }
.ui-th-btn--dark:hover { box-shadow: none; filter: brightness(1.15); }
.ui-th-btn:active { transform: scale(0.97); }
.ui-th-link { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-th-link:hover { background: var(--chip); color: var(--ink); }
.ui-th-link > svg { flex: none; color: var(--muted); }
.ui-th-link--tight { height: 18px; margin-left: -2px; padding: 0 4px; font-size: 11px; }

/* Errors: one quiet line – the color only in its mark */
.ui-th-error { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-th-errmark { display: grid; flex: none; place-items: center; color: var(--th-c-red); }
.ui-th-error__text { flex: 1; min-width: 0; }
.ui-th-error__retry { margin-left: auto; }

/* ---------- Away: what happened since, where you left ---------- */
.ui-th-away { display: flex; flex-direction: column; gap: 6px; padding: 12px 8px 8px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); animation: ui-th-in 420ms var(--th-out) both; }
.ui-th-away__head { display: flex; align-items: baseline; gap: 8px; padding: 0 6px 2px; }
.ui-th-away__title { font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-th-away__counts { font-size: 12px; color: var(--muted); }
.ui-th-away__list { display: grid; margin: 0; padding: 0; list-style: none; }
.ui-th-away__row { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; text-align: left; color: var(--ink); transition: background-color 140ms ease; }
.ui-th-away__row:hover { background: var(--hover); }
.ui-th-away__row:focus-visible { outline-offset: -2px; }
.ui-th-away__dot { display: grid; flex: none; place-items: center; width: 14px; height: 14px; }
.ui-th-away__dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--th-c-amber); }
.ui-th-away__name { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-th-away__note { flex: 0 100 auto; min-width: 0; overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-away__row .ui-th-badge { margin-left: auto; }
.ui-th-away__links { display: flex; gap: 4px; padding: 2px 0 0; }
.ui-th-divider { display: flex; align-items: center; gap: 10px; margin: -4px 0; }
.ui-th-divider__line { flex: 1; height: 1px; background: var(--line); }
.ui-th-divider__label { flex: none; font-size: 12px; color: var(--muted); }

/* ---------- Connection banner and Jump pill ---------- */
/* A strip right under the head – the thread's top moves down with it, so nothing hides behind it */
.ui-th-banner-wrap { position: absolute; top: 8px; right: 0; left: 0; z-index: 4; display: flex; justify-content: center; pointer-events: none; }
.ui-th-banner-wrap > * { pointer-events: auto; }
.ui-th-banner { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 12px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 5%, var(--panel)); font-size: 13px; color: var(--text); white-space: nowrap; animation: ui-th-drop 240ms var(--th-out) both; }
.ui-th-banner:not(:has(.ui-th-banner__retry)) { padding-right: 12px; }
.ui-th-banner > .ui-as-spin { color: var(--muted); }
.ui-th-banner__ok { display: grid; place-items: center; color: var(--th-c-green); }
.ui-th-banner__count { font-size: 12px; color: var(--faint); }
.ui-th-banner__retry { height: 24px; padding: 0 8px; border-radius: 999px; }
.ui-th-jump { position: absolute; bottom: 12px; left: 50%; z-index: 3; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 12px; border-radius: 999px; background: var(--card); box-shadow: var(--card-shadow-hover); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transform: translateX(-50%); animation: ui-th-rise 260ms var(--th-out) both; transition: box-shadow 140ms ease; }
.ui-th-jump:hover { box-shadow: 0 0 0 0.5px var(--line-strong), 0 4px 12px -2px rgba(0, 0, 0, 0.12); }
.ui-th-jump > svg { flex: none; color: var(--muted); }
.ui-th-jump__count { font-weight: 400; color: var(--muted); }
.ui-th-jump__live { width: 6px; height: 6px; border-radius: 50%; background: var(--th-c-blue); animation: ui-th-live 1.4s ease-in-out infinite; }

/* ---------- Composer ---------- */
.ui-th-foot { flex: none; padding: 4px 24px 20px; }
.ui-th-composer { position: relative; display: flex; flex-direction: column; max-width: var(--th-col); margin: 0 auto; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--card); box-shadow: var(--card-shadow); cursor: text; transition: box-shadow 160ms ease; }
/* Typing in it: the edge firms up a little – the caret says the rest */
.ui-th-composer:focus-within { box-shadow: 0 0 0 0.5px var(--edge-active, var(--line-strong)), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 2px 6px -1px rgba(0, 0, 0, 0.06); }
.ui-th-input { display: block; width: 100%; min-height: 40px; max-height: 200px; margin: 0; padding: 0 4px; overflow-y: auto; border: 0; background: none; font: inherit; font-size: 14px; line-height: 20px; color: var(--ink); outline: none; resize: none; overscroll-behavior: contain; caret-color: var(--accent); }
.ui-th-input::placeholder { color: var(--placeholder); }
.ui-th-tools-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 28px; cursor: default; }
.ui-th-tools-row__group { display: flex; align-items: center; gap: 4px; }
.ui-th-icon { position: relative; display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 999px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease, transform 140ms var(--th-out); }
.ui-th-icon:hover, .ui-th-icon[aria-expanded="true"] { background: var(--chip); color: var(--ink); }
.ui-th-icon:active { transform: scale(0.94); }
.ui-th-icon--card { background: var(--card); box-shadow: var(--card-shadow); color: var(--ink); }
.ui-th-icon--card:hover { background: var(--card); box-shadow: var(--card-shadow-hover); }
/* Stop: a gray disc with the ink square – it reads apart from the dark send next to it */
.ui-th-stop { background: var(--chip-hover, var(--chip)); color: var(--ink); }
.ui-th-stop:hover { background: var(--line-strong); color: var(--ink); }
.ui-th-stop__square { width: 9px; height: 9px; border-radius: 2px; background: currentColor; }
.ui-th-send { display: grid; flex: none; place-items: center; width: 28px; height: 28px; margin-left: 2px; border-radius: 999px; background: var(--ink); color: var(--card); transition: background-color 160ms ease, color 160ms ease, transform 140ms var(--th-out), filter 140ms ease; }
.ui-th-send:hover { filter: brightness(1.15); }
.ui-th-send:active:not([aria-disabled]) { transform: scale(0.94); }
.ui-th-send[aria-disabled] { background: var(--chip); color: var(--faint); cursor: default; filter: none; }
/* Dictating: a live waveform and a timer between Discard and Done */
.ui-th-voice { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; animation: ui-th-fade 220ms ease both; }
.ui-th-voice__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--th-c-red); animation: ui-th-live 1.4s ease-in-out infinite; }
.ui-th-wave { display: flex; flex: 1; align-items: center; gap: 2px; min-width: 0; height: 20px; overflow: hidden; }
.ui-th-wave > i { flex: none; width: 2px; min-height: 3px; border-radius: 1px; background: var(--accent); transition: height 90ms ease-out; }
.ui-th-voice__time { flex: none; font-size: 12px; color: var(--muted); }
.ui-th-composer[data-recording] .ui-th-tools-row { justify-content: flex-start; }
.ui-th-composer__body { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 10px; cursor: text; }

/* ---------- Decision card: its own card, 8px above the composer – folds away with its gap ---------- */
.ui-th-dockwrap { display: grid; grid-template-rows: 1fr; width: min(calc(100% + 16px), calc(var(--th-col) + 16px)); margin: -8px 0 0 max(-8px, calc((100% - var(--th-col) - 16px) / 2)); opacity: 1; transition: grid-template-rows 420ms var(--th-out), opacity 260ms ease; cursor: default; }
.ui-th-dockwrap[data-mode="none"] { grid-template-rows: 0fr; opacity: 0; }
/* Room for the card's shadow inside the fold's clip */
.ui-th-dockwrap__inner { min-height: 0; overflow: hidden; padding: 8px 8px 0; }
.ui-th-dockwrap__inner > * { margin-bottom: 8px; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-th-dock { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px 6px; animation: ui-th-fade 260ms ease both; transition: background-color 400ms ease; }
.ui-th-dock[data-pulse] { background: var(--hover); }
.ui-th-dock__head { display: flex; align-items: center; gap: 8px; min-width: 0; height: 24px; padding: 0 4px; }
.ui-th-dock__task { min-width: 0; overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-dock__tools { display: flex; flex: none; align-items: center; gap: 4px; margin-left: auto; }
.ui-th-dock__pager { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.ui-th-dock__page { display: grid; place-items: center; width: 22px; height: 22px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-th-dock__page:hover { background: var(--chip); color: var(--ink); }
.ui-th-dock__q { margin: 0; padding: 0 4px; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-th-dock__facts { display: grid; gap: 2px; margin: 0; padding: 0 4px; }
.ui-th-dock__facts > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 20px; }
.ui-th-dock__facts dt { color: var(--muted); }
.ui-th-dock__facts dd { min-width: 0; margin: 0; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-dock__rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.ui-th-opt { display: flex; align-items: center; width: 100%; min-height: 36px; padding: 4px 8px 4px 4px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); text-align: left; color: var(--ink); transition: background-color 120ms ease; }
.ui-th-opt:hover, .ui-th-dock__rows:focus-within .ui-th-opt[aria-selected="true"], .ui-th-tile:hover .ui-th-tile__frame, .ui-th-tile:focus-visible .ui-th-tile__frame { background: var(--chip); }
.ui-th-dock :is(.ui-th-opt, .ui-th-tile):focus-visible { outline-offset: -2px; }
.ui-th-opt__row { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; }
.ui-th-opt__num { display: grid; flex: none; place-items: center; width: 22px; height: 22px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 12px; font-weight: 500; color: var(--muted); }
.ui-th-opt__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ui-th-opt__title { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }
.ui-th-opt__summary { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-tag { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--muted); white-space: nowrap; }
.ui-th-dock__tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ui-th-tile { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 0; border-radius: var(--aui-radius-lg, 10px); text-align: left; color: var(--ink); }
.ui-th-tile__frame { display: grid; place-items: center; height: 92px; padding: 6px; border-radius: var(--aui-radius-lg, 10px); background: var(--hover); box-shadow: inset 0 0 0 0.5px var(--line); transition: background-color 120ms ease; }
.ui-th-tile__frame { overflow: hidden; }
.ui-th-tile__frame > .ui-asw-wire { display: block; width: 100%; height: 100%; }
.ui-th-tile .ui-th-opt__row { gap: 6px; padding: 0 2px 2px; }
/* On a tile the tag sits in the frame's corner */
.ui-th-tile .ui-th-tag { position: absolute; top: 8px; right: 8px; background: var(--card); box-shadow: var(--card-shadow); }
/* Your own answer: the last row, a quiet field after the numbers */
.ui-th-own { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 2px 4px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); cursor: text; transition: background-color 120ms ease; }
.ui-th-own:hover, .ui-th-own:focus-within { background: var(--hover); }
.ui-th-own__input { flex: 1; min-width: 0; height: 28px; margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; caret-color: var(--accent); }
.ui-th-own__input::placeholder { color: var(--placeholder); }
.ui-th-send.ui-th-own__send { width: 24px; height: 24px; margin: 0; opacity: 0; pointer-events: none; transition: opacity 140ms ease, transform 140ms var(--th-out); }
.ui-th-own__send[data-shown] { opacity: 1; pointer-events: auto; }
/* Later: one slim line where the dock was */
.ui-th-dockmin { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 14px; font-size: 12px; color: var(--muted); animation: ui-th-fade 220ms ease both; }
.ui-th-dockmin__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--th-c-amber); }

/* Where it asked: one compact line – the question waits in the dock */
.ui-th-ask { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 28px; margin: -2px 0; padding: 0; font-size: 13px; text-align: left; color: var(--muted); }
.ui-th-ask:hover .ui-th-ask__q { color: var(--ink); }
.ui-th-ask__dot { flex: none; width: 6px; height: 6px; margin: 0 4px; border-radius: 50%; background: var(--th-c-amber); }
.ui-th-ask[data-state="answered"] .ui-th-ask__dot { background: var(--th-c-green); }
.ui-th-ask__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-th-ask__q { color: var(--text); transition: color 140ms ease; }
.ui-th-ask__state { flex: none; color: var(--faint); }
.ui-th-user__context { max-width: 80%; margin-right: 4px; overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Task tab, in the shell's work area ---------- */
.ui-th-tp { display: flex; flex-direction: column; gap: 20px; padding: 2px 4px 16px; }
.ui-th-tp .ui-th-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; font-weight: 500; white-space: nowrap; }
.ui-th-tp .ui-th-btn--dark { background: var(--ink); color: var(--card); }
.ui-th-tp .ui-th-btn--dark:hover { filter: brightness(1.15); }
.ui-th-tp .ui-th-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--th-wait-bg); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--th-wait-fg); white-space: nowrap; }
.ui-th-tp .ui-th-num { font-variant-numeric: tabular-nums; }
.ui-th-tp .ui-th-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ui-th-tp .ui-th-ring { flex: none; }
.ui-th-tp :focus-visible { outline-offset: -2px; }
.ui-th-tp__goal { margin: 0; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-th-tp__faint { color: var(--faint); }
.ui-th-tp__needs { display: flex; align-items: center; gap: 12px; min-height: 56px; margin: 0 -10px; padding: 8px 8px 8px 10px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-th-tp__needs-text { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.ui-th-tp__needs-q { font-size: 13px; line-height: 20px; color: var(--ink); }
.ui-th-tp__props { display: grid; gap: 2px; margin: 0; }
.ui-th-tp__props > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; min-height: 28px; }
.ui-th-tp__props dt { font-size: 12px; color: var(--muted); }
.ui-th-tp__props dd { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; color: var(--ink); }
.ui-th-tp__props dd > span:not(.ui-th-tp__faint) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-th-tp__section { display: flex; flex-direction: column; gap: 8px; }
.ui-th-tp__label { display: flex; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-th-tp__steps { --th-tray: color-mix(in srgb, var(--ink) 2%, var(--panel)); display: grid; margin: 0 -10px; padding: 6px 10px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--th-tray); }
.ui-th-tp__step { position: relative; display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 13px; color: var(--ink); }
.ui-th-tp__step:not(:last-child)::after { content: ""; position: absolute; top: 20px; bottom: -6px; left: 7px; width: 1px; background: var(--line); }
.ui-th-tp__mark { position: relative; z-index: 1; display: grid; flex: none; place-items: center; width: 15px; height: 15px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px var(--line-strong, rgba(0, 0, 0, 0.16)); background: var(--th-tray); color: var(--panel); }
.ui-th-tp__step[data-state="done"] .ui-th-tp__mark { background: var(--th-c-blue); box-shadow: none; }
.ui-th-tp__step:is([data-state="done"], [data-state="later"]) .ui-th-tp__step-label { color: var(--muted); }
.ui-th-tp__step[data-state="you"] .ui-th-tp__mark { background: color-mix(in srgb, var(--th-c-orange) 18%, var(--th-tray)); box-shadow: inset 0 0 0 1.5px var(--th-c-orange); }
.ui-th-tp__step[data-state="now"] .ui-th-tp__mark { background: color-mix(in srgb, var(--th-c-blue) 18%, var(--th-tray)); box-shadow: inset 0 0 0 1.5px var(--th-c-blue); }
.ui-th-tp__step-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-th-tp__note { display: grid; place-items: center; width: 18px; height: 18px; margin-left: auto; padding: 0 !important; }
/* Loading: the same column, messages and Task tab – gray bars in place of the words */
:is(.ui-th, .ui-th-tp) [data-skel] { pointer-events: none; }
.ui-as-loading.ui-th-skel { display: flex; flex-direction: column; gap: 24px; }
.ui-th-skel-line { display: flex; align-items: center; height: 1lh; min-width: 0; }
.ui-th-user[data-skel] .ui-th-user__bubble { display: flex; }
.ui-th-text[data-skel] p { display: grid; }
.ui-th-skel-open { display: flex; flex: none; align-items: center; height: 28px; padding: 0 10px; }
.ui-th-tp__goal[data-skel] { display: grid; }
.ui-th-tp__props[data-skel] dt, .ui-th-tp__props[data-skel] dd { display: flex; align-items: center; height: 28px; }
.ui-th-tp__label > .ui-th-skel-line { flex: 1; }
.ui-th-foot[data-loading] .ui-ccc__send { background: var(--ui-ccc-fill) !important; color: var(--ui-ccc-faint); cursor: default; }
.ui-th-tp__history { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ui-th-tp__history li { position: relative; padding-left: 16px; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-th-tp__history li::before { content: ""; position: absolute; top: 8px; left: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.ui-th-tp__history li:first-child { color: var(--ink); }
.ui-th-tp__decided { display: grid; margin: 0 -10px; padding: 2px 10px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-th-tp__decided li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-th-tp__decided li + li { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-th-tp__decided li > svg { flex: none; color: var(--th-c-green); }
.ui-th-tp__decided-text { display: grid; min-width: 0; }
.ui-th-tp__decided-q { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-tp__decided-a { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-tp__links { display: flex; justify-content: flex-end; }
.ui-th-tp__link { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--faint); transition: color 140ms ease, background-color 140ms ease; }
.ui-th-tp__link:hover { background: var(--chip); color: var(--text); }

/* Files: in a message and waiting in the composer */
.ui-th-uploads { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 0; padding: 0; list-style: none; cursor: default; }
/* The composer: the library's Chat Composer, as wide as the reading column; what only a thread needs sits just above */
.ui-th-foot__col { display: flex; flex-direction: column; gap: 8px; max-width: var(--th-col); margin: 0 auto; }
.ui-th-foot__col > .ui-ccc { width: 100%; max-width: none; }
.ui-th-above { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; padding: 0 2px; }
.ui-th-above > .ui-th-uploads { flex: 1; min-width: 0; margin: 0; }
.ui-th-above > .ui-th-voice { flex: 1; padding: 4px 6px; border-radius: calc(var(--aui-radius-lg, 10px) + 4px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-th-stop-pill { display: inline-flex; flex: none; align-items: center; gap: 7px; height: 28px; margin-left: auto; padding: 0 12px 0 10px; border-radius: 999px; background: var(--card); box-shadow: var(--card-shadow); font-size: 12.5px; font-weight: 500; color: var(--ink); animation: ui-th-fade 200ms ease both; transition: background-color 140ms ease; }
.ui-th-stop-pill:hover { background: var(--hover); }
.ui-th-file { position: relative; display: flex; align-items: center; gap: 8px; max-width: 280px; min-width: 0; height: 40px; padding: 0 10px 0 6px; overflow: hidden; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-th-file--up { padding-right: 4px; background: var(--hover); box-shadow: inset 0 0 0 0.5px var(--line); }
.ui-th-file--up:is([data-state="waiting"], [data-state="transcribing"]) { max-width: 380px; }
/* "Saved – will transcribe…" is the point of the chip: it wraps rather than cuts off */
.ui-th-file--up[data-state="waiting"] { height: auto; min-height: 40px; padding-block: 6px; }
.ui-th-file--up[data-state="waiting"] .ui-th-file__meta { white-space: normal; }
.ui-th-file__mark { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--chip); color: var(--muted); }
.ui-th-file__mark[data-kind="video"] { color: var(--th-c-pink); }
.ui-th-file__mark[data-kind="voice"] { color: var(--th-c-purple); }
.ui-th-file__text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ui-th-file__name { overflow: hidden; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-file__meta { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-th-file__meta > svg, .ui-th-file__meta > .ui-th-errmark { flex: none; }
.ui-th-file__x { display: grid; flex: none; place-items: center; width: 22px; height: 22px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-th-file__x:hover { background: var(--chip); color: var(--ink); }
.ui-th-file__bar { position: absolute; right: 10px; bottom: 0; left: 10px; height: 2px; overflow: hidden; border-radius: 1px; background: var(--line); }
.ui-th-file__bar > span { display: block; height: 100%; background: var(--th-c-blue); transform-origin: left; transition: transform 200ms linear; }
.ui-th-upring { flex: none; color: var(--text); }

/* The shell's buttons wait in the corners – the sidebar's on the left below 900px, the folded work area's on the right: the head steps aside */
.ui-as-app[data-panel="closed"] .ui-th-head { padding-right: 52px; }
/* The head is the shell's head row (--as-head-h), so it shares the icons' centerline at every width */
@container ui-as (max-width: 900px) {
  .ui-th-head { padding-left: 46px; padding-right: 52px; }
}

/* Phones: the column fills the width, the composer hugs the edges */
@container ui-th (max-width: 560px) {
  .ui-th-col { gap: 20px; padding: calc(var(--as-head-h, 48px) + 16px) 12px 24px; }
  .ui-th-foot { padding: 2px 12px 8px; }
  .ui-th-dock__tiles { gap: 6px; }
  .ui-th-user__bubble, .ui-th-user__files { max-width: 88%; }
  .ui-th-summary__item { padding: 0 6px; }
  .ui-th-divider__label { display: none; }
  .ui-th-banner { max-width: calc(100cqw - 104px); }
  /* On a phone the pill takes the top – the counts make room */
  .ui-th:has(.ui-th-banner) .ui-th-summary { visibility: hidden; }
  .ui-th-banner__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
@container ui-th (max-width: 400px) {
  .ui-th-head { gap: 4px; }
  .ui-th-file { max-width: 100%; }
  .ui-th-task__steps { display: none; }
  .ui-th-banner__count { display: none; }
}

@keyframes ui-th-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes ui-th-fade { from { opacity: 0; } }
@keyframes ui-th-drop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes ui-th-rise { from { opacity: 0; transform: translate(-50%, 6px); } }
@keyframes ui-th-pop { from { opacity: 0; transform: scale(0.4); } }
@keyframes ui-th-caret { 0%, 100% { opacity: 0.6; } 50% { opacity: 0.12; } }
@keyframes ui-th-live { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes ui-th-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-th-user, .ui-th-agent, .ui-th-card, .ui-th-away, .ui-th-dock, .ui-th-dockmin, .ui-th-banner, .ui-th-jump, .ui-th-voice, .ui-th-avatar i, .ui-th-tools__title, .ui-th-tool[data-status="done"] .ui-th-tool__mark { animation: none; }
  .ui-th-tools__wrap, .ui-th-dockwrap, .ui-th-tool, .ui-th-tools__chev, .ui-th-wave > i, .ui-th-file__bar > span { transition: none; }
  .ui-th-tools[data-open="false"] .ui-th-tool { transform: none; }
  .ui-th-tools__title[data-shimmer]::after { display: none; }
  .ui-th-caret { animation: none; opacity: 0.45; }
  .ui-th-jump__live, .ui-th-voice__dot { animation: none; }
}

/* Touch: every control at least 36px */
@media (pointer: coarse) {
  .ui-th-btn, .ui-th-summary__item { min-height: 36px; }
  .ui-th-opt { min-height: 40px; }
  .ui-th-icon, .ui-th-send { width: 36px; height: 36px; }
  .ui-th-tools-row { height: 36px; }
  .ui-th-file__x { width: 32px; height: 32px; }
}


.ui-agu, .ui-agu-panel {
  --ui-agu-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --agu-out: cubic-bezier(0.23, 1, 0.32, 1);
  --agu-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(0, 0, 0, 0.06)), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05));
  --agu-line-soft: rgba(0, 0, 0, 0.06);
  --agu-line: var(--aui-blue, #0190fe);
  --agu-warn: var(--aui-warning, #b25e00);
  --agu-warn-bg: #ff9c0024;
  --agu-c-purple: var(--aui-purple, #a651f0);
  --agu-c-orange: var(--aui-orange, #f28a2e);
  --agu-c-teal: var(--aui-teal, #13b3a0);
  --agu-c-blue: var(--aui-blue, #0190fe);
  --agu-c-amber: var(--aui-amber, #e8b000);
  --agu-c-pink: var(--aui-pink, #ee3e9e);
  --agu-c-green: var(--aui-green, #5fc88a);
  --agu-c-gray: rgba(0, 0, 0, 0.28);
}
:where(.dark, [data-theme="dark"]) :is(.ui-agu, .ui-agu-panel) {
  --ui-agu-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --agu-card-shadow: var(--aui-shadow-card, 0 0 0 0.5px var(--aui-border, rgba(255, 255, 255, 0.08)), 0 1px 2px 0 rgba(0, 0, 0, 0.3));
  --agu-line-soft: rgba(255, 255, 255, 0.07);
  --agu-line: var(--aui-blue, #4fb0fe);
  --agu-warn: var(--aui-warning, #ffb35c);
  --agu-warn-bg: #fb6a0026;
  --agu-c-purple: var(--aui-purple, #b98af0);
  --agu-c-orange: var(--aui-orange, #f2a15c);
  --agu-c-teal: var(--aui-teal, #4fc3b4);
  --agu-c-blue: var(--aui-blue, #4fb0fe);
  --agu-c-amber: var(--aui-amber, #e6c24d);
  --agu-c-pink: var(--aui-pink, #f06db5);
  --agu-c-green: var(--aui-green, #7dcf9f);
  --agu-c-gray: rgba(255, 255, 255, 0.3);
}
.ui-agu { position: relative; container: ui-agu / inline-size; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; background: var(--panel); }
.ui-agu-num { font-variant-numeric: tabular-nums; }
.ui-agu-faint { color: var(--faint); }
:is(.ui-agu, .ui-agu-panel) :focus-visible { outline: 2px solid var(--ui-agu-focus); outline-offset: 2px; }

.ui-agu-head { display: flex; flex: none; align-items: center; gap: 10px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-agu-title { margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-agu-head__month { font-size: 13px; color: var(--faint); }
.ui-agu-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ui-agu-page { display: grid; gap: 28px; max-width: 720px; margin: 0 auto; padding: 24px 24px 48px; }

.ui-agu-label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
.ui-agu-card { margin: 0; padding: 0; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--agu-card-shadow); }
.ui-agu-page > .ui-as-empty { margin-top: 0; }
.ui-agu-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ui-agu-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Spend ---------- */
.ui-agu-spend { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px 16px 0; overflow: hidden; }
.ui-agu-spend__sum { display: grid; gap: 4px; min-width: 0; }
.ui-agu-spend__amount { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0 0; }
.ui-agu-spend__value { font-size: 28px; font-weight: 500; line-height: 34px; letter-spacing: -0.4px; color: var(--ink); }
/* Rolling numbers: each changing digit rolls like an odometer – up from below as the money grows – fading at the edges */
.ui-agu-roll { position: relative; display: inline-block; white-space: nowrap; }
.ui-agu-roll__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ui-agu-roll__track { display: inline-flex; }
.ui-agu-roll__c { position: relative; display: inline-block; overflow: hidden; vertical-align: bottom; mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent); }
.ui-agu-roll__n { display: inline-block; }
.ui-agu-roll__n[data-in] { animation: ui-agu-roll-in-up 600ms var(--agu-out) both; }
.ui-agu-roll__n--out { position: absolute; inset: 0; animation: ui-agu-roll-out-up 600ms var(--agu-out) both; }
.ui-agu-roll__c[data-dir="down"] .ui-agu-roll__n[data-in] { animation-name: ui-agu-roll-in-down; }
.ui-agu-roll__c[data-dir="down"] .ui-agu-roll__n--out { animation-name: ui-agu-roll-out-down; }
@keyframes ui-agu-roll-in-up { from { transform: translateY(100%); opacity: 0; } }
@keyframes ui-agu-roll-out-up { to { transform: translateY(-100%); opacity: 0; } }
@keyframes ui-agu-roll-in-down { from { transform: translateY(-100%); opacity: 0; } }
@keyframes ui-agu-roll-out-down { to { transform: translateY(100%); opacity: 0; } }
.ui-agu-spend__budget { font-size: 13px; color: var(--muted); }
.ui-agu-spend__line { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; line-height: 20px; color: var(--muted); }
.ui-agu-spend__line[data-warn] { color: var(--agu-warn); }
.ui-agu-spend__line > svg { flex: none; }
/* A run just finished: its cost and task, for a moment */
.ui-agu-flash { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; max-width: 100%; padding: 1px 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: color-mix(in srgb, var(--agu-line) 12%, var(--card)); font-size: 12px; font-weight: 500; color: color-mix(in srgb, var(--agu-line) 80%, var(--ink)); animation: ui-agu-flash 2600ms var(--agu-out) both; }
.ui-agu-flash__task { min-width: 0; overflow: hidden; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }

.ui-agu-chart { position: relative; min-width: 0; margin: 0 -2px; border-radius: 6px; contain: inline-size; }
.ui-agu-page > * { min-width: 0; }
.ui-agu-chart:focus-visible { outline-offset: 2px; }
.ui-agu-chart svg { display: block; overflow: visible; }
.ui-agu-chart__base { stroke: var(--agu-line-soft); stroke-width: 1; }
.ui-agu-chart__budget line { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.ui-agu-chart__budget text, .ui-agu-chart__tick { font: 400 11px var(--font-sans, inherit); fill: var(--faint); }
.ui-agu-chart__area { fill: url(#ui-agu-fill); animation: ui-agu-fade 900ms var(--agu-out) 300ms both; }
.ui-agu-chart__line { fill: none; stroke: var(--agu-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; animation: ui-agu-draw 1100ms var(--agu-out) both; }
.ui-agu-chart__forecast { fill: none; stroke: var(--agu-line); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0.4; animation: ui-agu-fade 600ms ease 900ms both; }
.ui-agu-chart__today { fill: var(--agu-line); stroke: var(--card); stroke-width: 2; transition: cy 420ms var(--agu-out); }
.ui-agu-chart__pulse { fill: var(--agu-line); transform-box: fill-box; transform-origin: center; animation: ui-agu-pulse 2200ms ease-out 1100ms infinite; transition: cy 420ms var(--agu-out); }
.ui-agu-chart__cursor line { stroke: var(--faint); stroke-width: 1; opacity: 0.6; }
.ui-agu-chart__cursor circle { fill: var(--card); stroke: var(--agu-line); stroke-width: 2; }
.ui-agu-tip { position: absolute; z-index: 2; display: grid; gap: 1px; padding: 6px 9px; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 0.5px var(--agu-line-soft), 0 6px 16px -6px rgba(0, 0, 0, 0.18); font-size: 12px; line-height: 16px; color: var(--ink); white-space: nowrap; transform: translateY(-50%); pointer-events: none; }
.ui-agu-tip[data-flip] { transform: translate(-100%, -50%); }
.ui-agu-tip b { font-weight: 500; }

.ui-agu-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 -16px; box-shadow: inset 0 0.5px 0 var(--aui-border, var(--agu-line-soft)); }
.ui-agu-stats > div { display: grid; gap: 2px; padding: 12px 16px 14px; }
.ui-agu-stats > div + div { box-shadow: inset 0.5px 0 0 var(--aui-border, var(--agu-line-soft)); }
.ui-agu-stats dt { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-agu-stats dd { margin: 0; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); }

/* ---------- Where it went ---------- */
.ui-agu-seg { display: flex; gap: 2px; padding: 2px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--chip); }
.ui-agu-seg button { height: 24px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 12px; font-weight: 500; color: var(--muted); transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.ui-agu-seg button:hover { color: var(--ink); }
.ui-agu-seg button[aria-selected="true"] { background: var(--card); box-shadow: var(--agu-card-shadow); color: var(--ink); }
.ui-agu-seg button:focus-visible { outline-offset: -2px; }
.ui-agu-groups { padding: 4px; }
.ui-agu-group { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); text-align: left; font-size: 13px; transition: background-color 140ms ease; }
.ui-agu-group:hover { background: var(--hover); }
.ui-agu-group[aria-current] { background: color-mix(in srgb, var(--ink) 4%, var(--card)); }
.ui-agu-group:focus-visible { outline-offset: -2px; }
.ui-agu-groups li + li .ui-agu-group { box-shadow: 0 -0.5px 0 var(--aui-border, var(--agu-line-soft)); }
.ui-agu-group__mark { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--agu-tone); }
.ui-agu-group__name { flex: 0 0 150px; min-width: 0; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-agu-group__bar { flex: 1; min-width: 40px; height: 6px; border-radius: 3px; background: var(--agu-line-soft); overflow: hidden; }
.ui-agu-group__bar > span { display: block; height: 100%; border-radius: 3px; background: var(--agu-tone); transition: width 640ms var(--agu-out); animation: ui-agu-grow 700ms var(--agu-out) both; transform-origin: left; }
.ui-agu-group__amount { flex: none; width: 84px; white-space: nowrap; color: var(--ink); text-align: right; }
.ui-agu-group__share { flex: none; width: 34px; font-size: 12px; color: var(--faint); text-align: right; }
.ui-agu-group__change { flex: none; width: 52px; white-space: nowrap; font-size: 12px; color: var(--muted); text-align: right; }
.ui-agu-group__change[data-up] { color: var(--agu-warn); }
.ui-agu-group__chev { display: grid; flex: none; place-items: center; color: var(--faint); }

/* ---------- Worth a look ---------- */
.ui-agu-notes { padding: 2px 12px; }
.ui-agu-note { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; }
.ui-agu-note + .ui-agu-note { box-shadow: inset 0 0.5px 0 var(--aui-border, var(--agu-line-soft)); }
.ui-agu-note__icon { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: color-mix(in srgb, var(--ink) 4%, var(--card)); color: var(--muted); }
.ui-agu-note__icon[data-kind="spike"] { background: var(--agu-warn-bg); color: var(--agu-warn); }
.ui-agu-note__text { display: grid; flex: 1; min-width: 0; }
.ui-agu-note__line { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-agu-note__detail { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-agu-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--muted); white-space: nowrap; }
.ui-agu-badge[data-kind="spike"], .ui-agu-badge[data-kind="jump"] { background: var(--agu-warn-bg); color: var(--agu-warn); }
.ui-agu-btn { display: inline-flex; flex: none; align-items: center; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--card); box-shadow: var(--agu-card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); transition: box-shadow 140ms ease; }
.ui-agu-btn--icon { gap: 6px; padding-left: 8px; }
.ui-agu-btn--icon > svg { flex: none; color: var(--muted); }
.ui-agu-btn:hover { box-shadow: 0 0 0 0.5px var(--aui-border-strong, rgba(0, 0, 0, 0.1)), 0 2px 4px rgba(0, 0, 0, 0.06); }

/* ---------- Group panel ---------- */
.ui-agu-panel { display: flex; flex-direction: column; gap: 22px; padding: 4px 4px 16px; }
.ui-agu-panel--empty { display: grid; min-height: 240px; place-items: center; }
.ui-agu-panel__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ui-agu-panel__title { margin: 0; overflow: hidden; font-size: 15px; font-weight: 500; line-height: 22px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-agu-panel__sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: -14px; font-size: 13px; }
.ui-agu-panel__amount { font-size: 22px; font-weight: 500; line-height: 28px; color: var(--ink); }
.ui-agu-change { font-size: 12px; color: var(--muted); }
.ui-agu-change[data-up] { color: var(--agu-warn); }
.ui-agu-bars { display: flex; align-items: flex-end; gap: 2px; height: 72px; }
.ui-agu-bars__day { display: flex; flex: 1; align-items: flex-end; height: 100%; }
.ui-agu-bars__day > span { display: block; width: 100%; border-radius: 2px; background: var(--agu-tone); opacity: 0.75; transition: opacity 140ms ease, height 420ms var(--agu-out); }
.ui-agu-bars__day[data-future] > span { background: var(--agu-line-soft); opacity: 1; }
.ui-agu-bars__day[data-at] > span, .ui-agu-bars__day:last-child:not([data-future]) > span { opacity: 1; }
.ui-agu-bars__read { margin: 0; font-size: 12px; color: var(--muted); }
.ui-agu-panel .ui-agu-card { margin: 0 -8px; }
.ui-agu-tasks { padding: 2px 12px; }
.ui-agu-tasks li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ui-agu-tasks li + li { box-shadow: inset 0 0.5px 0 var(--aui-border, var(--agu-line-soft)); }
.ui-agu-tasks__text { display: grid; flex: 1; min-width: 0; }
.ui-agu-tasks__title { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-agu-tasks__runs { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-agu-tasks__cost { flex: none; font-size: 13px; color: var(--ink); }

/* ---------- Loading ---------- */
/* The same cards, rows and boxes with gray shapes in place of the data – each bar centered in its line, nothing moves when it lands */
:is(.ui-agu, .ui-agu-panel) [data-skel] { pointer-events: none; }
.ui-agu-skel-amount { align-items: center; height: 34px; }
.ui-agu-spend__line[data-skel] { height: 20px; }
/* The curve's box: 18px above, the plot, 22px for the dates – 168px like the chart */
.ui-agu-skel-chart { display: grid; grid-template-rows: 18px 128px 22px; }
.ui-agu-skel-chart > .ui-as-skel { grid-row: 2; }
.ui-agu-skel-ticks { display: flex; align-items: center; justify-content: space-between; }
.ui-agu-skel-stat { display: flex; align-items: center; height: 22px; }
.ui-agu-skel-end { display: flex; align-items: center; justify-content: flex-end; }
.ui-agu-skel-line { display: flex; align-items: center; height: 20px; }
.ui-agu-skel-meta { display: flex; align-items: center; height: 16px; }
.ui-agu-skel-title { display: flex; align-items: center; height: 22px; }
.ui-agu-skel-sum { align-items: center; height: 28px; }
/* The 12px read-out has the font's own line height, so the bar takes one line of it */
.ui-agu-skel-read { display: flex; align-items: center; height: 1lh; }
/* The day bars take the skeleton's gray instead of the group's tone */
.ui-agu-bars__day > .ui-as-skel { background: var(--chip-hover); opacity: 1; }

.ui-as-app[data-panel="closed"] .ui-agu-head { padding-right: 52px; }
@container ui-as (max-width: 900px) {
  .ui-agu-head { padding-left: 46px; padding-right: 52px; }
}
@container ui-agu (max-width: 620px) {
  .ui-agu-page { padding: 16px 16px 40px; gap: 24px; }
  .ui-agu-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-agu-stats > div:nth-child(3) { box-shadow: inset 0 0.5px 0 var(--aui-border, var(--agu-line-soft)); }
  .ui-agu-stats > div:nth-child(4) { box-shadow: inset 0.5px 0 0 var(--aui-border, var(--agu-line-soft)), inset 0 0.5px 0 var(--aui-border, var(--agu-line-soft)); }
  .ui-agu-group__name { flex: 1 1 auto; }
  .ui-agu-group__bar, .ui-agu-group__share { display: none; }
  .ui-agu-note { flex-wrap: wrap; }
  .ui-agu-note__text { flex-basis: calc(100% - 40px); }
  .ui-agu-note .ui-agu-badge { margin-left: 40px; }
  .ui-agu-note .ui-agu-btn { margin-left: auto; }
  .ui-agu-note .ui-agu-skel-badge { margin-left: 40px; }
  .ui-agu-note .ui-agu-skel-btn { margin-left: auto; }
}

@keyframes ui-agu-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ui-agu-fade { from { opacity: 0; } }
@keyframes ui-agu-pulse { 0% { transform: scale(1); opacity: 0.4; } 70%, 100% { transform: scale(3.2); opacity: 0; } }
@keyframes ui-agu-flash { 0% { opacity: 0; transform: translateY(4px); } 12%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes ui-agu-grow { from { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .ui-agu-chart__line, .ui-agu-chart__area, .ui-agu-chart__forecast, .ui-agu-group__bar > span, .ui-agu-roll__n[data-in] { animation: none; }
  .ui-agu-roll__n--out { display: none; }
  .ui-agu-chart__pulse { display: none; }
  .ui-agu-flash { animation: none; }
}
@media (pointer: coarse) {
  .ui-agu-btn, .ui-agu-seg button { min-height: 36px; }
}




/* Files overview – folders and file templates */

.ui-as-folders {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin-top: 16px;
}
.ui-as-folder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 14px 0 12px;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  text-align: left;
  text-decoration: none;
  transition: box-shadow 160ms ease;
}
.ui-as-folder-card:hover { box-shadow: var(--card-shadow-hover); }
.ui-as-folder-card__mark { flex: none; width: 26px; height: 26px; transition: transform 320ms var(--ease); }
.ui-as-folder-card:hover .ui-as-folder-card__mark { transform: translateY(-1px) scale(1.04); }
.ui-as-folder-card__text { display: grid; min-width: 0; }
.ui-as-folder-card__text b { overflow: hidden; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); white-space: nowrap; text-overflow: ellipsis; }

.ui-as-templates { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
/* Long names and owner lines stay on one line with an ellipsis; the full name is in the tooltip */
/* Clip with a little margin, so letters that reach past their box are not cut */
.ui-as-templates .ui-as-template__name { overflow: clip; overflow-clip-margin: 2px; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-templates .ui-as-template { grid-template-columns: minmax(0, 1fr); }
.ui-as-templates .ui-as-meta { max-width: 100%; white-space: nowrap; }
.ui-as-main .ui-as-templates.ui-as-file-grid .ui-as-meta { display: flex; align-items: center; gap: 0; min-width: 0; }
.ui-as-files-meta { overflow: hidden; min-width: 0; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-files-access { display: inline-flex; flex: none; align-items: center; gap: 4px; white-space: nowrap; }
.ui-as-files-access::before { content: "·"; margin: 0 4px; }

.ui-as-files-empty { margin-top: 16px; }

/* Loading: the same cards and grid, with gray lines in place of the text – nothing moves when the data lands */
.ui-as [data-skel] { pointer-events: none; }
.ui-as-folder-card__lines { display: grid; gap: 6px; min-width: 0; }
/* The name's and the meta line's own line heights (20px, 16px), each bar centered in its line */
.ui-as-files-skel-name { margin: 13px 0 5px; }
.ui-as-files-skel-meta { margin: 4px 0; }

/* List view: one folder per row */
.ui-as-folders[data-view="list"] { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ui-as-folders[data-view="list"] .ui-as-folder-card { height: 48px; }

/* Narrow panels: folders 4 → 2 → 1 per row */
@container ui-as-main (max-width: 760px) {
  .ui-as-folders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container ui-as-main (max-width: 760px) {
  .ui-as-folder-card { text-align: left; }
  .ui-as-folder-card__text { flex: 1; }
}
@container ui-as-main (max-width: 480px) {
  .ui-as-folders { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}


/* A single folder – breadcrumb, back link, header with actions and the empty drop area */

/* The path stays on top while the folder scrolls under it */
.ui-as-crumbs {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--as-head-h, 48px);
  padding: 0 16px;
  background: var(--panel);
  font-size: 13px;
  color: var(--muted);
}
/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
.ui-as-crumbs { transition: padding-left 420ms var(--ease); }
.ui-as-crumbs button { color: inherit; text-decoration: none; }
.ui-as-crumbs button:hover { color: var(--ink); }
.ui-as-crumbs i { font-style: normal; color: var(--faint); }
.ui-as-crumbs [aria-current] { overflow: hidden; min-width: 0; font-weight: 500; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }

.ui-as-page.ui-as-page--folder { padding-top: 12px; }
.ui-as-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.ui-as-back:hover { color: var(--ink); }

.ui-as-folder-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}
/* Long names wrap in the title, even without spaces */
/* It shares the line with the folder mark, also when the actions wrap below on narrow screens */
.ui-as-folder-head .ui-as-page-title { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
/* The folder of the chat composer, as tall as the title's capitals and centred on them */
.ui-as-folder-head__mark { flex: none; align-self: flex-start; width: 26px; height: 26px; margin: 3px -2px 0 0; }
.ui-as-folder-head__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ui-as-page--folder .ui-as-empty { margin-top: 20px; padding: 48px 24px 56px; }

/* The folder's files as cards */
/* Same cards and spacing as the templates on the Files page */
.ui-as-folder-files { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
/* Long names and dates stay on one line with an ellipsis; the full name is in the tooltip */
/* Clip with a little margin, so letters that reach past their box are not cut */
.ui-as-folder-files .ui-as-template__name { overflow: clip; overflow-clip-margin: 2px; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-folder-files .ui-as-template { grid-template-columns: minmax(0, 1fr); }
.ui-as-folder-files .ui-as-meta { max-width: 100%; white-space: nowrap; }
.ui-as-folder-meta { overflow: hidden; min-width: 0; white-space: nowrap; text-overflow: ellipsis; }

/* Loading: the same cards in the same grid, gray lines centred in the name's and the meta's line heights */
.ui-as-page--folder [data-skel] { pointer-events: none; }
.ui-as-folder-skel-name { display: flex; align-items: center; height: 20px; margin-top: 8px; }
.ui-as-folder-skel-meta { display: flex; align-items: center; height: 16px; }

/* Touch: the path, back link and small buttons grow to a comfortable 32px */
@media (pointer: coarse) {
  .ui-as-crumbs button, .ui-as-back { display: inline-flex; align-items: center; min-height: 32px; }
}

/* Narrow: the sidebar icon always sits in the corner; the actions move under the title */
@container ui-as (max-width: 900px) {
  .ui-as-crumbs { padding-left: 50px; }
  .ui-as-page.ui-as-page--folder { padding-top: 8px; }
  .ui-as-folder-head { flex-wrap: wrap; row-gap: 14px; }
}
@container ui-as (max-width: 600px) {
  .ui-as-crumbs { padding-right: 12px; }
  .ui-as-folder-head { margin-top: 18px; }
  .ui-as-folder-head__actions { width: 100%; margin-left: 0; }
  /* Share and Upload first, the "more" menu at the far end */
  .ui-as-folder-head__actions > .ui-as-anchor { order: 3; margin-left: auto; }
  .ui-as-page--folder .ui-as-empty { padding: 36px 18px 40px; }
}





/* Kanban: a bar on top, gray columns with white cards below – the board scrolls sideways when it's wider */
.ui-kbn { display: flex; flex-direction: column; height: 100%; min-height: 0; }
/* The modal is portaled next to the board, so it carries the focus colour too */
.ui-kbn, .ui-kbn-modal { --ui-kbn-focus: var(--aui-focus, rgba(0, 96, 226, 0.7)); }
:where(.dark, [data-theme="dark"]) :is(.ui-kbn, .ui-kbn-modal) { --ui-kbn-focus: var(--aui-focus, rgba(77, 141, 255, 0.8)); }
.ui-kbn__bar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; }
.ui-kbn__path { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ui-kbn__path i { font-style: normal; color: var(--faint); }
.ui-kbn__path b { font-weight: 500; color: var(--ink); }
.ui-kbn__star { width: 26px; height: 26px; }
.ui-kbn__star[aria-pressed="true"] { color: var(--aui-amber, #e8b000); }
.ui-kbn__star[aria-pressed="true"] path { fill: currentColor; }
.ui-kbn__tools { display: flex; flex: none; align-items: center; gap: 4px; }
.ui-kbn__tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 13px;
  color: var(--muted);
  transition: background-color 140ms ease, color 140ms ease;
}
.ui-kbn__tool:hover, .ui-kbn__tool[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.ui-kbn__tool[data-active] { color: var(--ink); }
.ui-kbn__menu .ui-as-menu { min-width: 208px; }
.ui-kbn__badge { display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--chip); font-size: 11px; color: var(--ink); }
/* Board / List: a pill on a gray track */
.ui-kbn__seg { display: inline-flex; gap: 2px; margin-left: 6px; padding: 3px; border-radius: calc(var(--aui-radius, 7px) + 3px); background: var(--chip); }
.ui-kbn__seg button { height: 26px; padding: 0 12px; border-radius: var(--aui-radius, 7px); font-size: 13px; color: var(--muted); transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.ui-kbn__seg button:hover { color: var(--ink); }
.ui-kbn__seg button[aria-checked="true"] { background: var(--card); box-shadow: var(--card-shadow); font-weight: 500; color: var(--ink); }

/* ---------- Board ---------- */
.ui-kbn__board { display: flex; flex: 1; gap: 10px; min-height: 0; padding: 0 12px 12px; overflow-x: auto; overscroll-behavior-x: contain; }
.ui-kbn-col {
  display: flex;
  flex: 1 0 272px;
  flex-direction: column;
  max-width: 340px;
  /* Long titles or labels never widen a column – every column keeps the same width */
  min-width: 0;
  min-height: 0;
  padding: 4px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 4px);
  background: var(--frame);
  transition: background-color 160ms ease;
}
.ui-kbn-col[data-over] { background: var(--chip); }
/* Head: the priority mark left, the name in quiet capitals in the middle, the count right */
.ui-kbn-col__head { display: grid; grid-template-columns: minmax(24px, auto) minmax(0, 1fr) minmax(24px, auto); align-items: center; height: 36px; padding: 0 6px; }
.ui-kbn-col__label { overflow: hidden; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-kbn-col__count { justify-self: end; min-width: 20px; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 11.5px; line-height: 18px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Room around the cards inside the scrolling list, so their shadow on hover isn't cut off at the edges */
.ui-kbn-col__cards { display: flex; flex: 1; flex-direction: column; gap: 6px; min-height: 0; margin: 0 -4px -4px; padding: 2px 4px 8px; overflow-y: auto; scrollbar-width: none; }
.ui-kbn-col__cards::-webkit-scrollbar { display: none; }
.ui-kbn-col__empty { margin: 6px 8px; font-size: 12.5px; color: var(--faint); }
/* Where a dragged card lands */
.ui-kbn-drop { display: block; flex: none; height: 2px; margin: -4px 6px; border-radius: 1px; background: var(--accent); }

/* Card */
.ui-kbn-card {
  cursor: pointer;
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 10px;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  cursor: grab;
  transition: box-shadow 160ms ease, opacity 160ms ease;
}
.ui-kbn-card:hover { box-shadow: var(--card-shadow-hover); }
/* The shell's blue ring, drawn on the card's edge so the scrolling column doesn't cut it off */
.ui-kbn-card:focus-visible { outline: 2px solid var(--ui-kbn-focus); outline-offset: -2px; }
.ui-kbn-card[data-dragging] { opacity: 0.4; }
.ui-kbn-card__title { display: flex; align-items: flex-start; gap: 8px; min-width: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-kbn-card__title > svg { flex: none; margin-top: 2px; color: var(--muted); }
/* Every card the same height: the title on one line, the detail always two lines tall – longer text ends in "…" */
.ui-kbn-card__title > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-kbn-card__text { display: -webkit-box; height: 38px; margin: 0 0 0 24px; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; font-size: 12.5px; line-height: 19px; color: var(--muted); }
.ui-kbn-card__text[data-empty] { color: var(--faint); }
.ui-kbn-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; margin: 2px 0 0 24px; font-size: 12.5px; color: var(--text); }
.ui-kbn-card__state { display: inline-flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.ui-kbn-card__state > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-kbn-card__counts { display: inline-flex; flex: none; align-items: center; margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-kbn-card__counts > span { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; }
.ui-kbn-card__counts > span:last-child { padding-right: 0; }
.ui-kbn-card__counts > span + span { box-shadow: -0.5px 0 0 var(--line-strong); }
/* Marks */
.ui-kbn-mark { flex: none; width: 15px; height: 15px; }
.ui-kbn-mark rect { fill: var(--line-strong); }
.ui-kbn-mark[data-tone="low"] rect[data-on] { fill: var(--aui-blue, #4fb0fe); }
.ui-kbn-mark[data-tone="medium"] rect[data-on] { fill: var(--aui-amber, #e8b000); }
.ui-kbn-mark[data-tone="high"] rect[data-on] { fill: var(--aui-red, #f04438); }
.ui-kbn-mark--done { color: var(--aui-success, #1e8a4f); }
.ui-kbn-status { flex: none; width: 13px; height: 13px; }
.ui-kbn-status[data-status="review"] { color: var(--aui-blue, #4fb0fe); }
.ui-kbn-status[data-status="progress"] { color: var(--aui-purple, #a651f0); }
.ui-kbn-status[data-status="attention"] { color: var(--aui-amber, #e8b000); }
.ui-kbn-status[data-status="fixed"] { color: var(--aui-success, #1e8a4f); }

/* ---------- List: no frame and no lines – each group under a gray, fully rounded head; rows get a soft fill on hover ---------- */
.ui-kbn__list { flex: 1; min-height: 0; padding: 0 12px 16px; overflow: auto; }
/* No issues at all: one empty state where the board or list sits, filling it */
.ui-kbn__none { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 0 12px 12px; }
.ui-kbn__none > .ui-as-empty { flex: 1; justify-content: center; margin-top: 0; }
.ui-kbn-group { display: flex; flex-direction: column; gap: 2px; }
.ui-kbn-group + .ui-kbn-group { margin-top: 14px; }
.ui-kbn-group__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; height: 34px; margin-bottom: 4px; padding: 0 8px 0 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 5px); background: linear-gradient(var(--frame), var(--frame)), var(--card); font-size: 12.5px; font-weight: 500; color: var(--ink); }
.ui-kbn-group__head .ui-kbn-col__count { margin-left: 2px; background: var(--chip); }
.ui-kbn-group .ui-kbn-col__empty { margin: 4px 12px; }
.ui-kbn-row { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 5px); cursor: pointer; font-size: 13px; transition: background-color 120ms ease; }
.ui-kbn-row:hover, .ui-kbn-row:focus-visible { background: var(--hover); }
.ui-kbn-row:focus-visible { outline-offset: -2px; }
.ui-kbn-group__label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Loading: the same cards and rows under the real column heads, gray bars in place of the text – nothing moves when the data lands */
.ui-kbn [data-skel] { pointer-events: none; }
/* Each bar centered in the line it stands in for, at that line's height */
.ui-kbn-skel-line { display: flex; align-items: center; min-width: 0; }
.ui-kbn-skel-text { display: flex; flex-direction: column; height: 38px; margin-left: 24px; }
.ui-kbn-skel-rows { display: flex; flex-direction: column; gap: 2px; }
.ui-kbn-skel-title { flex: none; max-width: 34%; }
.ui-kbn-row__id { flex: none; width: 40px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-kbn-row__title { flex: none; max-width: 34%; overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-kbn-row__text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
/* Status and counts in fixed columns, so they line up from row to row */
.ui-kbn-row__end { flex: none; width: 232px; margin-left: auto; }
.ui-kbn-row__end .ui-kbn-card__foot { justify-content: space-between; margin: 0; gap: 16px; }

/* Toolbar above the board: scope chips left, New issue right */
.ui-kbn__toolbar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 10px 14px; }
.ui-kbn__scopes { display: flex; gap: 4px; }
.ui-kbn__scopes button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-kbn__scopes button:hover { color: var(--ink); }
.ui-kbn__scopes button[aria-selected="true"] { background: var(--chip); box-shadow: none; font-weight: 500; color: var(--ink); }
.ui-kbn__scopes button span { font-size: 12px; font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-kbn__new { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 10px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--aui-primary, var(--ink)); font-size: 13px; font-weight: 500; color: var(--aui-on-primary, var(--card)); transition: opacity 140ms ease; }
.ui-kbn__new:hover { opacity: 0.88; }
/* A column's + shows while the pointer is on the column */
.ui-kbn-col__add { display: grid; flex: none; place-items: center; height: 26px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); color: var(--muted); opacity: 0; transition: opacity 140ms ease, background-color 140ms ease, color 140ms ease; }
.ui-kbn-col:hover .ui-kbn-col__add, .ui-kbn-col:focus-within .ui-kbn-col__add, .ui-kbn-col__add:focus-visible { opacity: 1; }
/* Touch screens have no hover – the + stays visible */
@media (hover: none) { .ui-kbn-col__add { opacity: 1; } }
.ui-kbn-col__add:hover { background: var(--chip); color: var(--ink); }

/* Create task: a window over the whole app on a soft scrim – fields left, details right */
.ui-kbn-modal { position: absolute; inset: 0; z-index: 70; display: flex; justify-content: center; align-items: center; padding: 24px 16px; background: rgba(0, 0, 0, 0.16); animation: ui-kbn-fade 180ms ease both; }
.ui-kbn-modal__box { display: flex; flex-direction: column; width: 100%; max-width: 720px; max-height: 100%; overflow: auto; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, 0 0 0 0.5px var(--line-strong), 0 24px 48px -12px rgba(0, 0, 0, 0.25)); animation: ui-kbn-in 240ms var(--ease) both; transition: max-width 280ms var(--ease); }
.ui-kbn-modal__box[data-wide] { max-width: 920px; }
.ui-kbn-modal__head { display: flex; align-items: center; gap: 4px; padding: 14px 12px 14px 18px; border-bottom: 1px solid var(--line-soft, var(--line)); }
.ui-kbn-modal__icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; margin-right: 8px; border-radius: 9px; background: var(--chip); color: var(--ink); }
.ui-kbn-modal__heading { display: grid; flex: 1; min-width: 0; }
.ui-kbn-modal__heading b { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--strong); }
.ui-kbn-modal__heading small { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-kbn-create { display: grid; grid-template-columns: minmax(0, 1fr) 248px; }
.ui-kbn-create__main { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
/* Title and description: the library's Text Field and Text Area – the title a touch bigger */
.ui-tfc__input.ui-kbn-create__title { font-size: 15px; font-weight: 500; }
.ui-tfc__input.ui-kbn-create__title::placeholder { font-weight: 400; }
@media (pointer: coarse) { .ui-tfc__input.ui-kbn-create__title { font-size: 16px; } }
.ui-kbn-create__attach { align-self: flex-start; margin-left: -8px; }
/* Details: a gray side with label and value per row */
.ui-kbn-create__side { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-left: 1px solid var(--line-soft, var(--line)); background: var(--frame); }
.ui-kbn-create__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding-left: 8px; }
.ui-kbn-create__row > span:first-child { flex: none; font-size: 12.5px; color: var(--muted); }
.ui-kbn-create__row .ui-kbn-props__value { max-width: 150px; }
.ui-kbn-create__row .ui-kbn-props__value[data-empty] { color: var(--muted); }
.ui-kbn-create__clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-kbn-modal__foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px 12px 18px; border-top: 1px solid var(--line-soft, var(--line)); }
.ui-kbn-modal__foot .ui-kbn-switch { margin-right: auto; }
.ui-kbn-modal__cancel { height: 32px; padding: 0 12px; border-radius: calc(var(--aui-radius, 7px) + 2px); font-size: 13px; color: var(--text); }
.ui-kbn-modal__cancel:hover { background: var(--hover); color: var(--ink); }
.ui-kbn-modal__create { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 14px; border-radius: calc(var(--aui-radius, 7px) + 2px); background: var(--aui-primary, var(--ink)); font-size: 13px; font-weight: 500; color: var(--aui-on-primary, var(--card)); transition: opacity 140ms ease; }
.ui-kbn-modal__create:hover { opacity: 0.88; }
.ui-kbn-modal__create kbd { padding: 0 5px; border-radius: var(--aui-radius-sm, 5px); background: rgba(255, 255, 255, 0.16); font: inherit; font-size: 11px; line-height: 18px; }
@container ui-as (max-width: 700px) {
  .ui-kbn-create { grid-template-columns: minmax(0, 1fr); }
  .ui-kbn-create__side { border-left: 0; border-top: 1px solid var(--line-soft, var(--line)); }
}
@keyframes ui-kbn-fade { from { opacity: 0; } }
@keyframes ui-kbn-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

/* ---------- An open issue ---------- */
.ui-kbn__crumb { color: inherit; }
.ui-kbn__crumb:hover { color: var(--ink); }
.ui-kbn__crumb-issue { overflow: hidden; max-width: 360px; text-overflow: ellipsis; }
.ui-kbn__crumb-issue span { font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-kbn__pos { margin-right: 4px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-kbn__tools .ui-as-icon-btn:disabled { opacity: 0.35; pointer-events: none; }
.ui-kbn-issue:focus { outline: none; }
.ui-kbn-issue { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) 288px; align-items: start; gap: 40px; min-height: 0; padding: 28px 32px 40px 48px; overflow-y: auto; }
.ui-kbn-issue__main { display: flex; flex-direction: column; min-width: 0; max-width: 720px; }
.ui-kbn-issue__title { display: block; width: 100%; padding: 0; border: 0; outline: 0; resize: none; overflow: hidden; background: none; overflow-wrap: anywhere; font: inherit; font-size: 24px; font-weight: 500; line-height: 32px; letter-spacing: -0.24px; color: var(--strong); }
.ui-kbn-issue__text { overflow-wrap: anywhere; width: 100%; min-height: 24px; margin-top: 10px; padding: 0; border: 0; outline: 0; resize: none; overflow: hidden; background: none; font: inherit; font-size: 14px; line-height: 22px; color: var(--text); }
.ui-kbn-issue__text::placeholder { color: var(--placeholder, var(--faint)); }
.ui-kbn-issue__actions { display: flex; gap: 2px; margin: 14px 0 0 -10px; }
.ui-kbn-issue__section { display: flex; flex-direction: column; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line-soft, var(--line)); }
.ui-kbn-issue__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; font-weight: 500; color: var(--ink); }
.ui-kbn-issue__sub { margin-left: auto; padding: 4px 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); font-size: 12.5px; font-weight: 400; color: var(--muted); }
.ui-kbn-issue__sub:hover { background: var(--hover); color: var(--ink); }
.ui-kbn-issue__add { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; height: 30px; margin-left: -8px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 13px; color: var(--muted); }
.ui-kbn-issue__add:hover { background: var(--hover); color: var(--ink); }
/* Sub-issues */
.ui-kbn-sub { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; margin: 0 -8px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 13.5px; color: var(--ink); cursor: pointer; }
.ui-kbn-sub:hover { background: var(--hover); }
.ui-kbn-sub input { position: absolute; opacity: 0; pointer-events: none; }
.ui-kbn-sub__ring { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: transparent; }
.ui-kbn-sub[data-done] .ui-kbn-sub__ring { box-shadow: none; color: var(--aui-success, #1e8a4f); }
.ui-kbn-sub[data-done] { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.ui-kbn-sub:has(input:focus-visible) { outline: 2px solid var(--ui-kbn-focus); outline-offset: -2px; }
.ui-kbn-sub__new { height: 34px; margin: 0 -8px; padding: 0 8px; border: 0; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); outline: 0; background: var(--hover); font: inherit; font-size: 13.5px; color: var(--ink); }
/* Activity */
.ui-kbn-log { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 16px; padding: 0; list-style: none; }
.ui-kbn-log__event { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.ui-kbn-log__event b, .ui-kbn-log__who b { font-weight: 500; color: var(--ink); }
.ui-kbn-log__comment { padding: 12px 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-kbn-log__who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ui-kbn-log__who span:last-child { color: var(--faint); }
.ui-kbn-log__comment p { margin: 6px 0 0 30px; font-size: 13.5px; line-height: 21px; color: var(--text); }
.ui-kbn-avatar { display: grid; flex: none; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); font-size: 9.5px; font-weight: 600; color: var(--accent); }
.ui-kbn-reply { padding: 12px 10px 8px 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-kbn-reply:focus-within { box-shadow: var(--card-shadow-hover); }
.ui-kbn-reply textarea { display: block; width: 100%; padding: 0; border: 0; outline: 0; resize: none; background: none; font: inherit; font-size: 13.5px; line-height: 21px; color: var(--ink); }
.ui-kbn-reply textarea::placeholder { color: var(--placeholder, var(--faint)); }
.ui-kbn-reply__bar { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.ui-kbn-reply__send { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--aui-primary, var(--ink)); color: var(--aui-on-primary, var(--card)); transition: opacity 140ms ease; }
.ui-kbn-reply__send:disabled { background: var(--chip); color: var(--faint); cursor: default; }
/* Details card */
.ui-kbn-props { position: sticky; top: 0; display: flex; flex-direction: column; padding: 14px 8px 12px; border-radius: calc(var(--aui-radius-lg, 10px) + 4px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-kbn-props__title { padding: 0 8px 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.ui-kbn-props dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; }
/* Long values end in "…" inside the card; the full value is in the tooltip */
:is(.ui-kbn-props dd, .ui-kbn-create__row) > .ui-as-anchor { min-width: 0; max-width: 100%; }
.ui-kbn-props__labels > .ui-as-anchor { flex: none; }
.ui-kbn-props dl > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; padding: 0 0 0 8px; }
.ui-kbn-props dt { flex: none; font-size: 13px; color: var(--muted); }
.ui-kbn-props dd { display: flex; justify-content: flex-end; min-width: 0; margin: 0; }
.ui-kbn-props__value { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 30px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); font-size: 13px; color: var(--ink); white-space: nowrap; }
.ui-kbn-props__value:hover, .ui-kbn-props__value[aria-expanded="true"] { background: var(--hover); }
.ui-kbn-props__value .ui-kbn-avatar { width: 20px; height: 20px; font-size: 8.5px; }
.ui-kbn-props__value > svg { flex: none; color: var(--muted); }
.ui-kbn-props__labels { flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 0; }
.ui-kbn-label { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 12px; line-height: 18px; color: var(--text); }
.ui-kbn-props__plus { width: 26px; height: 26px; }
.ui-kbn-props__meta { margin-top: 10px; padding: 10px 8px 0; border-top: 1px solid var(--line-soft, var(--line)); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* Narrow: the bar wraps under the path, the board scrolls sideways with fixed-width columns, list rows drop details */
@container ui-as (max-width: 900px) {
  .ui-kbn__bar { padding-left: 52px; }
  .ui-kbn-issue { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 8px 20px 32px; }
  .ui-kbn-props { position: static; order: -1; }
  .ui-kbn-col { flex: 0 0 264px; }
}
@container ui-as (max-width: 600px) {
  /* The path's row (the 26px star sets its height) in the middle of a head row – on the sidebar icon's centerline; the tools wrap below */
  .ui-kbn__bar { flex-wrap: wrap; height: auto; padding: calc((var(--as-head-h, 48px) - 26px) / 2) 8px 8px 52px; row-gap: 8px; }
  .ui-kbn__tools { width: 100%; }
  .ui-kbn__seg { margin-left: auto; }
  .ui-kbn__board { padding: 0 8px 8px; }
  .ui-kbn__toolbar { padding: 0 8px 8px; }
  .ui-kbn__scopes button span { display: none; }
  .ui-kbn-col { flex-basis: 248px; }
  .ui-kbn__list { padding: 0 6px 8px; }
  .ui-kbn__none { padding: 0 8px 8px; }
  .ui-kbn-row__text, .ui-kbn-row__end .ui-kbn-card__counts, .ui-kbn-row__end .ui-kbn-skel-counts { display: none; }
  .ui-kbn-row__end { width: auto; }
  .ui-kbn-row__title, .ui-kbn-skel-title { flex: 1; max-width: none; }
}
/* Touch: every control at least 32px tall */
@media (pointer: coarse) {
  .ui-kbn__star, .ui-kbn__tools .ui-as-icon-btn, .ui-kbn-props__plus, .ui-kbn-modal__head .ui-as-icon-btn { width: 32px; height: 32px; }
  .ui-kbn__tool, .ui-kbn__scopes button, .ui-kbn__new, .ui-kbn-col__add, .ui-kbn-modal__cancel, .ui-kbn-modal__create, .ui-kbn-props__value, .ui-kbn-issue__add { height: 32px; }
  .ui-kbn__seg button { height: 30px; }
  .ui-kbn-issue__sub { padding: 8px 10px; }
}


/* CRM: path and tabs on the panel, the table as its own white layer below */
.ui-as-crm { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 0 0 12px; }
.ui-as-crm__top { display: flex; flex: none; align-items: center; gap: 6px; height: var(--as-head-h, 48px); padding: 0 16px 0 20px; }
.ui-as-crm__path { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ui-as-crm__path i { font-style: normal; color: var(--faint); }
.ui-as-crm__view {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  margin-left: -6px;
  padding: 0 6px;
  border-radius: var(--aui-radius, 7px);
  font-weight: 500;
  color: var(--ink);
  transition: background-color 140ms ease;
}
.ui-as-crm__view:hover { background: var(--hover); }
.ui-as-crm__star { width: 26px; height: 26px; }
.ui-as-crm__star[aria-pressed="true"] { color: var(--aui-amber, #e8b000); }
.ui-as-crm__star[aria-pressed="true"] path { fill: currentColor; }

.ui-as-crm__tabs { display: flex; flex: none; align-items: center; gap: 4px; padding: 0 14px 12px; }
.ui-as-crm__sep { width: 1px; height: 18px; margin: 0 6px; background: var(--line); }
.ui-as-crm__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: calc(var(--aui-radius, 7px) + 2px);
  font-size: 13px;
  color: var(--muted);
  transition: background-color 140ms ease, color 140ms ease;
}
.ui-as-crm__tab:hover { color: var(--ink); background: var(--hover); }
.ui-as-crm__tablist { display: flex; align-items: center; gap: 4px; }
/* The focus ring sits inside the tab, so the sideways-scrolling bar on narrow screens doesn't cut it off */
.ui-as-crm__tabs :focus-visible { outline-offset: -2px; }
.ui-as-crm__tab[aria-selected="true"] { background: var(--chip); color: var(--ink); font-weight: 500; }

/* The table as a white layer with a thin edge, inset from the panel */
.ui-as-crm__table {
  flex: 1;
  min-height: 0;
  margin: 0 12px;
  overflow: auto;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as .ui-as-crm__table .ui-dtc { --ui-dtc-shadow: none; padding: 0; border-radius: 0; background: transparent; }
/* The tab above already names the table – no title row; the column heads start the layer */
.ui-as-crm__table .ui-dtc__head { display: none; }
/* A line under the last row, so the table ends cleanly before "Add row" */
.ui-as-crm__table .ui-dtc__card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }

.ui-as-crm__table > * { animation: ui-as-rise 380ms var(--ease) both; }

/* Empty: the view's empty state in the middle of the white layer */
.ui-as-crm__table > .ui-as-empty[data-bare] { justify-content: center; min-height: 100%; padding: 32px 24px; }

/* Loading: the Data Table's rows and cells drawn with the same sizes – 36px heads, 40px rows under hairlines, the 44px last row –
   with gray bars in place of the values, so nothing moves when the data lands */
.ui-as-crm [data-skel] { pointer-events: none; }
.ui-as-crm__skel { width: 100%; min-width: 0; overflow: hidden; font-size: 13px; line-height: 20px; }
.ui-as-crm__skel-scroll { overflow-x: auto; scrollbar-width: thin; }
.ui-as-crm__skel-table { width: 100%; min-width: 600px; border-collapse: collapse; table-layout: fixed; }
.ui-as-crm__skel-table th,
.ui-as-crm__skel-table td { height: 40px; padding: 0 12px; border-top: 0.5px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; overflow: hidden; }
.ui-as-crm__skel-table th { height: 36px; padding: 0 6px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--text); }
.ui-as-crm__skel-table .ui-as-crm__skel-select { padding: 0; }
.ui-as-crm__skel-th { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; }
.ui-as-crm__skel-icon { display: grid; color: var(--muted); }
.ui-as-crm__skel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A bar centered in the cell's 20px line; the name's logo and bar 8px apart like the real ones */
.ui-as-crm__skel-line { display: flex; align-items: center; min-width: 0; height: 20px; }
.ui-as-crm__skel-name { gap: 8px; }
.ui-as-crm__skel-foot { min-height: 44px; border-top: 0.5px solid var(--line); }
@media (hover: none) and (pointer: coarse) {
  .ui-as-crm__skel-table td { height: 44px; }
  /* The real last row holds a 36px button on touch */
  .ui-as-crm__skel-foot { min-height: 52px; }
}

/* Company mark on a small white tile */
.ui-as-crm__logo {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.ui-as-crm__logo svg { width: 64%; height: 64%; }
/* No mark: the first letter on the same tile */
.ui-as-crm__logo b { font-size: 11px; font-weight: 500; line-height: 1; color: #525252; }
.ui-as-crm__tab-logo { display: grid; flex: none; place-items: center; width: 18px; height: 18px; border-radius: 5px; }
.ui-as-crm__tab-logo svg { width: 11px; height: 11px; }
/* A contact's initials in the logo spot */
.ui-as-crm__avatar { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--accent-soft); font-size: 7.5px; font-weight: 600; line-height: 1; color: var(--accent); }

/* Touch: the small controls grow to a comfortable 32px */
@media (pointer: coarse) {
  .ui-as-crm__star, .ui-as-crm__tabs .ui-as-icon-btn { width: 32px; height: 32px; }
  .ui-as-crm__view { height: 32px; }
}

/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
.ui-as-crm__top { transition: padding-left 420ms var(--ease); }

/* Narrow: the views scroll sideways, the table scrolls inside its layer */
@container ui-as (max-width: 900px) {
  .ui-as-crm__top { padding-left: 52px; }
  .ui-as-crm__tabs { position: relative; overflow-x: auto; scrollbar-width: none; }
  .ui-as-crm__tabs::-webkit-scrollbar { display: none; }
  .ui-as-crm__tabs > *, .ui-as-crm__tablist > * { flex: none; }
  .ui-as-crm__table .ui-dtc__table, .ui-as-crm__skel-table { min-width: 880px; }
}
@container ui-as (max-width: 600px) {
  .ui-as-crm { padding-bottom: 6px; }
  .ui-as-crm__top { padding-right: 8px; }
  .ui-as-crm__tabs { padding: 0 8px 10px; }
  .ui-as-crm__table { margin: 0 6px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); }
}


/* Inbox: a list on the left, the item in a centered reading column on the right */
/* The Task panel sits in the shell's work area, outside .ui-ib – it shares the tints; the artifacts' viewers are the App Shell's */
.ui-ib, .ui-ib-task {
  --ui-ib-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --ib-rec-bg: #008ff519;
  --ib-rec-fg: #006dcbf2;
  --ib-wait-bg: #ff9c0029;
  --ib-wait-fg: var(--aui-warning, #b25e00);
  --ib-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* Accents – clear, soft, only ever small fills: glyphs and marks; text stays gray and black */
  --ib-c-purple: var(--aui-purple, #a651f0);
  --ib-c-green: var(--aui-green, #5fc88a);
  --ib-c-orange: var(--aui-orange, #f28a2e);
  --ib-c-blue: var(--aui-blue, #0190fe);
}
.ui-ib {
  --ib-list-w: 320px;
  position: relative;
  display: grid;
  grid-template-columns: var(--ib-list-w) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
:where(.dark, [data-theme="dark"]) :is(.ui-ib, .ui-ib-task) {
  --ui-ib-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --ib-rec-bg: #0077ff3a;
  --ib-rec-fg: var(--aui-info, #4fb0fe);
  --ib-wait-bg: #fb6a0025;
  --ib-wait-fg: var(--aui-warning, #ffb35c);
  /* A touch lighter and calmer on the dark panel */
  --ib-c-purple: var(--aui-purple, #b98af0);
  --ib-c-green: var(--aui-green, #7dcf9f);
  --ib-c-orange: var(--aui-orange, #f2a15c);
  --ib-c-blue: var(--aui-blue, #4fb0fe);
}
.ui-ib-num { font-variant-numeric: tabular-nums; }
.ui-ib-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.ui-ib :focus-visible { outline: 2px solid var(--ui-ib-focus); outline-offset: 2px; }

/* ---------- List ---------- */
.ui-ib-list { display: flex; flex-direction: column; min-width: 0; min-height: 0; box-shadow: inset -0.5px 0 0 var(--line); }
.ui-ib-list__head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-ib-list__title { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0; font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); }
.ui-ib-list__count { font-size: 13px; font-weight: 400; color: var(--faint); }
/* Open / Done: two quiet tabs, the active one a gray fill */
.ui-ib-seg { display: flex; flex: none; gap: 2px; }
.ui-ib-seg button { height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-ib-seg button:hover { color: var(--ink); }
.ui-ib-seg button[aria-selected="true"] { background: var(--chip); color: var(--ink); }

.ui-ib-rows { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 16px; outline: none; }
.ui-ib-rows__empty { margin: 0; padding: 10px 12px; font-size: 13px; line-height: 20px; color: var(--muted); }
/* Rows fold away once answered */
.ui-ib-row-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 280ms var(--ib-out), opacity 200ms ease; }
.ui-ib-row-wrap[data-gone] { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
.ui-ib-row-wrap > .ui-ib-row { min-height: 0; }
.ui-ib-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 6px;
  align-items: start;
  column-gap: 12px;
  height: 56px;
  padding: 10px 12px;
  overflow: hidden;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  cursor: pointer;
  transition: background-color 140ms ease, opacity 200ms ease;
}
.ui-ib-row:hover { background: var(--hover); }
.ui-ib-row[aria-selected="true"] { background: var(--chip); }
.ui-ib .ui-ib-row:focus-visible { outline-offset: -2px; }
.ui-ib-row[data-sending] { opacity: 0.55; }
.ui-ib-row__glyph { display: grid; place-items: center; height: 20px; color: var(--faint); }
/* Each kind its color, the same in the list and over the question: decision purple, pick blue, approval green, question orange */
:is(.ui-ib-row__glyph, .ui-ib-meta__glyph)[data-kind="decision"] { color: var(--ib-c-purple); }
:is(.ui-ib-row__glyph, .ui-ib-meta__glyph)[data-kind="pick"] { color: var(--ib-c-blue); }
:is(.ui-ib-row__glyph, .ui-ib-meta__glyph)[data-kind="approval"] { color: var(--ib-c-green); }
:is(.ui-ib-row__glyph, .ui-ib-meta__glyph)[data-kind="question"] { color: var(--ib-c-orange); }
:is(.ui-ib-row__glyph, .ui-ib-meta__glyph)[data-kind="done"] { color: var(--ib-c-green); }
.ui-ib-meta__glyph { display: grid; flex: none; place-items: center; width: 14px; height: 16px; }
.ui-ib-row__text { display: flex; flex-direction: column; min-width: 0; }
.ui-ib-row__q { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-row__meta { display: flex; gap: 6px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.ui-ib-row__meta i { font-style: normal; color: var(--faint); }
.ui-ib-row__task { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-ib-row__meta .ui-ib-num { flex: none; }
.ui-ib-dot { width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--accent); opacity: 0; transform: scale(0.4); transition: opacity 240ms ease, transform 240ms var(--ib-out); }
.ui-ib-dot[data-on] { opacity: 1; transform: none; }

/* ---------- Detail ---------- */
.ui-ib-detail { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.ui-ib-col { box-sizing: border-box; width: 100%; max-width: 640px; margin: 0 auto; padding: clamp(40px, 11vh, 104px) 40px 64px; animation: ui-ib-in 420ms var(--ib-out) both; }
.ui-ib-meta { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-ib-meta__text { display: flex; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-meta__text i { font-style: normal; color: var(--faint); }
.ui-ib-q { margin: 10px 0 0; font-size: 24px; font-weight: 500; line-height: 32px; letter-spacing: -0.24px; color: var(--ink); text-wrap: balance; overflow-wrap: anywhere; }
.ui-ib-q:focus { outline: none; }
/* A focus target, not a control: the focus lands here after sending, without a ring */
.ui-ib .ui-ib-q:focus-visible { outline: none; }
.ui-ib-context { display: -webkit-box; margin: 12px 0 0; overflow: hidden; font-size: 14px; line-height: 22px; color: var(--text); -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-wrap: pretty; }
.ui-ib-answer { margin-top: 32px; }
.ui-ib-answer:empty { display: none; }

/* Badges: the only color – Recommended and Approval */
.ui-ib-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); font-size: 11px; font-weight: 500; line-height: 18px; white-space: nowrap; }
.ui-ib-badge[data-tone="rec"] { background: var(--ib-rec-bg); color: var(--ib-rec-fg); }
.ui-ib-badge[data-tone="approval"] { background: var(--ib-wait-bg); color: var(--ib-wait-fg); }

/* decision: numbered option rows in one card */
.ui-ib-options { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ib-opt { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); text-align: left; color: var(--ink); transition: background-color 140ms ease; }
.ui-ib-opt:hover { background: var(--hover); }
.ui-ib-opt[aria-checked="true"] { background: var(--chip); }
.ui-ib .ui-ib-opt:focus-visible { outline-offset: -2px; }
.ui-ib-opt__num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--aui-radius-sm, 5px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 11px; line-height: 20px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
.ui-ib-opt[aria-checked="true"] .ui-ib-opt__num { background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-ib-opt__body { display: flex; flex-direction: column; min-width: 0; }
.ui-ib-opt__head { display: flex; align-items: center; gap: 8px; min-width: 0; height: 20px; }
.ui-ib-opt__title { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-opt__sum { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-opt__more { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 320ms var(--ib-out), opacity 220ms ease; }
.ui-ib-opt__more[data-open] { grid-template-rows: 1fr; opacity: 1; }
.ui-ib-opt__more-in { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ui-ib-opt__line { display: flex; gap: 8px; font-size: 12px; line-height: 18px; color: var(--muted); }
.ui-ib-opt__line:first-child { margin-top: 8px; }
.ui-ib-opt__line > b { flex: none; width: 8px; font-weight: 500; color: var(--faint); text-align: center; }

/* pick: wireframes side by side */
.ui-ib-variants { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 6px; margin: -6px; }
.ui-ib-variant { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 6px 6px 8px; border-radius: var(--aui-radius-lg, 10px); text-align: left; color: var(--ink); transition: background-color 140ms ease; }
.ui-ib-variant:hover { background: var(--hover); }
.ui-ib-variant[aria-checked="true"] { background: var(--chip); }
.ui-ib-variant__thumb { display: block; overflow: hidden; border-radius: 6px; background: var(--card); box-shadow: var(--card-shadow); }
.ui-ib-variant__label { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 2px; }
.ui-ib-variant__num { display: grid; flex: none; place-items: center; width: 18px; height: 18px; border-radius: var(--aui-radius-sm, 5px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 11px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-ib-variant[aria-checked="true"] .ui-ib-variant__num { background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-ib-variant__title { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }

/* approval: what happens, as plain lines */
.ui-ib-facts { margin: 0; padding: 4px 16px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ib-fact { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 12px; align-items: center; min-height: 40px; }
.ui-ib-fact + .ui-ib-fact { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-ib-fact dt { font-size: 13px; line-height: 20px; color: var(--muted); }
.ui-ib-fact dd { display: -webkit-box; margin: 0; padding: 10px 0; overflow: hidden; font-size: 13px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* question: a free answer with suggestions */
.ui-ib-free { display: flex; flex-direction: column; gap: 12px; }
.ui-ib-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-ib-chip { height: 28px; max-width: 100%; padding: 0 10px; overflow: hidden; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); background: var(--chip); font-size: 13px; color: var(--text); white-space: nowrap; text-overflow: ellipsis; transition: background-color 140ms ease, color 140ms ease; }
.ui-ib-chip:hover { background: var(--chip-hover); color: var(--ink); }
.ui-ib-chip[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 0 0 0.5px var(--line-strong); }

/* The reply field, Later and Send */
.ui-ib-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.ui-ib-reply { box-sizing: border-box; flex: 1; min-width: 0; height: 32px; padding: 0 12px; border: 0; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--card); box-shadow: var(--card-shadow); font: inherit; font-size: 13px; line-height: 20px; color: var(--ink); outline: none; transition: box-shadow 140ms ease; }
.ui-ib-reply::placeholder { color: var(--placeholder); }
.ui-ib-reply:hover { box-shadow: var(--card-shadow-hover); }
/* Typing in a field: no ring – the caret shows where you are, the field only firms up its edge a little */
.ui-ib .ui-ib-reply:focus-visible, .ui-ib .ui-ib-reply:focus { outline: none; box-shadow: var(--card-shadow-hover); }
.ui-ib-reply--area { flex: none; height: 88px; padding: 10px 12px; resize: none; }
.ui-ib-actions { display: flex; flex: none; align-items: center; gap: 8px; margin-left: auto; }
.ui-ib-actions--start { margin-left: 0; }
.ui-ib-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease, filter 140ms ease, opacity 140ms ease; }
.ui-ib-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-ib-btn > svg { flex: none; color: var(--muted); }
.ui-ib-btn:has(> svg:first-child) { padding-left: 8px; }
.ui-ib-btn--quiet { background: none; box-shadow: none; color: var(--text); }
.ui-ib-btn--quiet:hover { background: var(--chip); box-shadow: none; color: var(--ink); }
.ui-ib-btn--send { background: var(--aui-primary, var(--ink)); box-shadow: none; color: var(--aui-on-primary, var(--card)); }
.ui-ib-btn--send:hover { box-shadow: none; filter: brightness(1.15); }
.ui-ib-btn--send[aria-disabled] { opacity: 0.4; cursor: default; filter: none; }
.ui-ib-btn:active:not([aria-disabled]) { transform: scale(0.97); }

/* Sent: the answer area turns into a confirmation, a check draws itself */
.ui-ib-sent { display: flex; align-items: flex-start; gap: 12px; margin-top: 32px; animation: ui-ib-fade 240ms ease both; }
.ui-ib-sent__mark { flex: none; width: 24px; height: 24px; overflow: visible; }
.ui-ib-sent__ring { fill: var(--chip); stroke: none; transform-origin: center; animation: ui-ib-pop 420ms var(--ib-out) both; }
.ui-ib-sent__tick { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ui-ib-draw 420ms var(--ib-out) 160ms forwards; }
.ui-ib-sent__text { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.ui-ib-sent__text b { font-size: 13px; font-weight: 500; line-height: 20px; color: var(--ink); animation: ui-ib-rise 360ms var(--ib-out) 120ms both; }
.ui-ib-sent__text span { overflow: hidden; font-size: 13px; line-height: 20px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; animation: ui-ib-rise 360ms var(--ib-out) 200ms both; }

/* Done: what you chose and when */
.ui-ib-done { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; }
.ui-ib-context--done { margin: -16px 0 0; }
.ui-ib-chosen { border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; line-height: 20px; }
.ui-ib-chosen__row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 14px; }
.ui-ib-chosen__row > svg { flex: none; color: var(--ib-c-green); }
.ui-ib-chosen__row[data-declined] > svg { color: var(--muted); }
.ui-ib-chosen__body { display: flex; align-items: flex-start; gap: 14px; padding: 0 16px 14px 40px; margin-top: -6px; }
.ui-ib-chosen__thumb { flex: none; width: 96px; overflow: hidden; border-radius: 6px; box-shadow: var(--card-shadow); }
.ui-ib-chosen__thumb .ui-asw-wire { display: block; width: 100%; height: auto; }
.ui-ib-chosen__lines { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ui-ib-chosen__lines .ui-ib-opt__line:first-child { margin-top: 0; }
.ui-ib-chosen__sum { font-size: 13px; line-height: 20px; color: var(--text); }
.ui-ib-chosen__sum + .ui-ib-opt__line { margin-top: 4px; }
.ui-ib-chosen__fact { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; font-size: 12px; line-height: 20px; }
.ui-ib-chosen__fact > span:first-child { color: var(--muted); }
.ui-ib-chosen__fact > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-ib-chosen__words { font-size: 13px; line-height: 20px; color: var(--text); }
/* Since then: a few plain lines and what came out of it */
.ui-ib-since { display: flex; flex-direction: column; gap: 8px; }
.ui-ib-since__list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ui-ib-since__list li { position: relative; padding-left: 16px; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-ib-since__list li::before { content: ""; position: absolute; top: 9px; left: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.ui-ib-since .ui-asw-files { margin-top: 4px; }
.ui-ib-chosen__label { flex: 1; min-width: 0; overflow: hidden; font-weight: 500; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-chosen__when { flex: none; font-size: 12px; color: var(--muted); }

/* Nothing left */
.ui-ib-center { display: grid; flex: 1; place-items: center; padding: 40px 24px 80px; }
.ui-ib-caught { display: flex; flex-direction: column; align-items: center; text-align: center; animation: ui-ib-in 480ms var(--ib-out) both; }
.ui-ib-caught__mark { width: 36px; height: 36px; }
.ui-ib-caught__title { margin: 16px 0 0; font-size: 15px; font-weight: 500; line-height: 24px; color: var(--ink); }
.ui-ib-caught__title:focus { outline: none; }
.ui-ib .ui-ib-caught__title:focus-visible { outline: none; }
.ui-ib-caught__text { margin: 2px 0 20px; font-size: 13px; line-height: 20px; color: var(--muted); }

/* ---------- Task panel – in the shell's work area on the right ---------- */
.ui-ib-task { display: flex; flex-direction: column; gap: 20px; padding: 2px 4px 16px; }
.ui-ib-task__goal { margin: 0; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-ib-task__faint { color: var(--faint); }
.ui-ib-task__props { display: grid; gap: 2px; margin: 0; }
.ui-ib-task__props > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; min-height: 28px; }
.ui-ib-task__props dt { font-size: 12px; color: var(--muted); }
.ui-ib-task__props dd { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: 13px; color: var(--ink); }
.ui-ib-task__props dd > span:not(.ui-ib-task__faint) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-task__props dd > svg { flex: none; color: var(--muted); }
.ui-ib-ring { flex: none; color: var(--muted); }
.ui-ib-task__section { display: flex; flex-direction: column; gap: 8px; }
.ui-ib-task__label { display: flex; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--muted); }
/* Steps: ticked circles, the next one an empty ring – the one waiting for you says so */
/* The plan on its own light gray tray that reaches out past the column – the steps stay in line with the rest */
.ui-ib-steps { --ib-tray: color-mix(in srgb, var(--ink) 2%, var(--panel)); display: grid; margin: 0 -10px; padding: 6px 10px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--ib-tray); }
.ui-ib-steps .ui-ib-step__mark { background-color: var(--ib-tray); }
.ui-ib-step { position: relative; display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 13px; color: var(--ink); }
.ui-ib-step:not(:last-child)::after { content: ""; position: absolute; top: 20px; bottom: -6px; left: 7px; width: 1px; background: var(--line); }
.ui-ib-step__mark { position: relative; z-index: 1; display: grid; flex: none; place-items: center; width: 15px; height: 15px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px var(--line-strong, rgba(0, 0, 0, 0.16)); background: var(--panel); color: var(--panel); }
/* Done steps filled blue; the one it is on keeps its ring and gets a light, opaque fill of the same color – orange when it waits on you, blue while it runs */
.ui-ib-step[data-state="done"] .ui-ib-step__mark { background: var(--ib-c-blue); box-shadow: none; }
.ui-ib-step[data-state="done"] .ui-ib-step__label { color: var(--muted); }
.ui-ib-step[data-state="you"] .ui-ib-step__mark { background: color-mix(in srgb, var(--ib-c-orange) 18%, var(--ib-tray, var(--panel))); box-shadow: inset 0 0 0 1.5px var(--ib-c-orange); }
.ui-ib-step[data-state="now"] .ui-ib-step__mark { background: color-mix(in srgb, var(--ib-c-blue) 18%, var(--ib-tray, var(--panel))); box-shadow: inset 0 0 0 1.5px var(--ib-c-blue); }
.ui-ib-step[data-state="later"] .ui-ib-step__label { color: var(--muted); }
.ui-ib-step__label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ib-step__note { flex: none; margin-left: auto; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--ib-wait-bg); font-size: 11px; font-weight: 500; line-height: 18px; color: var(--ib-wait-fg); }
/* Decided: what you answered before, for this task */
/* Decided on a white card with the hairline stroke, reaching out like the steps */
.ui-ib-decided { display: grid; gap: 0; margin: 0 -10px; padding: 2px; list-style: none; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ib-decided__row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); text-align: left; transition: background-color 120ms ease; }
.ui-ib-decided__row:hover { background: var(--hover); }
.ui-ib-decided__row:focus-visible { outline-offset: -2px; }
.ui-ib-decided__row > svg { flex: none; color: var(--ib-c-green); }
.ui-ib-decided__text { display: grid; min-width: 0; }
.ui-ib-decided__q { overflow: hidden; font-size: 13px; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.ui-ib-decided__a { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }

/* Phones: the list, or the item with a back button */
.ui-ib[data-narrow] { grid-template-columns: minmax(0, 1fr); }
.ui-ib[data-narrow] .ui-ib-list { box-shadow: none; }
.ui-ib-back { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; height: var(--as-head-h, 48px); padding: 0 12px; background: var(--panel); }
.ui-ib-back .ui-ib-btn { padding-left: 6px; }
.ui-ib[data-narrow] .ui-ib-col { padding: 12px 20px 40px; }
.ui-ib[data-narrow] .ui-ib-q { font-size: 20px; line-height: 28px; letter-spacing: -0.2px; }
.ui-ib[data-narrow] .ui-ib-answer, .ui-ib[data-narrow] .ui-ib-sent { margin-top: 24px; }
.ui-ib[data-narrow] .ui-ib-foot { flex-wrap: wrap; }
.ui-ib[data-narrow] .ui-ib-reply:not(.ui-ib-reply--area) { flex-basis: 100%; }
.ui-ib[data-narrow] .ui-ib-variants { gap: 2px; margin: -4px; }
.ui-ib[data-narrow] .ui-ib-variant { padding: 4px 4px 6px; }
.ui-ib[data-narrow] .ui-ib-variant__num { display: none; }
.ui-ib[data-narrow] .ui-ib-fact { grid-template-columns: 60px minmax(0, 1fr); }

/*
 * The shell's buttons wait in the corners – the sidebar's on the left, the folded work area's on the right: the heads
 * step aside for them. The heads are the shell's head row (--as-head-h), so they share the buttons' centerline
 */
@container ui-as (max-width: 900px) {
  .ui-ib-list__head { padding-left: 46px; }
  .ui-ib-back { padding-left: 42px; }
  .ui-as-app[data-panel="closed"] .ui-ib[data-narrow] .ui-ib-list__head { padding-right: 52px; }
}

/* Loading: the same rows, column and panel – gray bars in place of the text */
:is(.ui-ib, .ui-ib-task) [data-skel] { pointer-events: none; }
.ui-ib-skel-line { display: flex; align-items: center; min-width: 0; }
.ui-ib-skel-q { display: flex; align-items: center; height: 32px; }
.ui-ib[data-narrow] .ui-ib-skel-q { height: 28px; }
.ui-ib-context.ui-ib-skel-context { display: grid; }
.ui-ib-foot > .ui-ib-skel-reply { flex: 1; min-width: 0; }
.ui-ib[data-narrow] .ui-ib-foot > .ui-ib-skel-reply { flex-basis: 100%; }
.ui-ib-skel-goal { display: grid; }
.ui-ib-task__props[data-skel] dd { height: 20px; }

@keyframes ui-ib-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes ui-ib-fade { from { opacity: 0; } }
@keyframes ui-ib-rise { from { opacity: 0; transform: translateY(3px); } }
@keyframes ui-ib-pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes ui-ib-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-ib-col, .ui-ib-caught, .ui-ib-sent, .ui-ib-sent__ring, .ui-ib-sent__text b, .ui-ib-sent__text span { animation: none !important; }
  .ui-ib-sent__tick { animation: none !important; stroke-dashoffset: 0; }
  .ui-ib-row-wrap, .ui-ib-opt__more, .ui-ib-dot { transition: none; }
}

/* Touch: every control at least 36px, no shortcut hints */
@media (pointer: coarse) {
  .ui-ib-btn, .ui-ib-seg button, .ui-ib-chip { min-height: 36px; }
  .ui-ib-reply:not(.ui-ib-reply--area) { height: 40px; }
}


/* Workflow Builder: the canvas fills the page, the run panel slides up under it; palette, toolbar, minimap and settings float on top */
.ui-wf {
  --ui-wf-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --wf-dot: rgba(0, 0, 0, 0.16);
  --wf-edge: rgba(0, 0, 0, 0.2);
  --wf-port: rgba(0, 0, 0, 0.22);
  --wf-field: var(--aui-subtle, rgba(0, 0, 0, 0.025));
  --wf-set: rgba(0, 96, 226, 0.05);
  --wf-set-ring: rgba(0, 96, 226, 0.26);
  --wf-set-tile: rgba(0, 96, 226, 0.1);
  --wf-warn: var(--aui-danger, #c4320a);
  --wf-warn-bg: color-mix(in srgb, var(--aui-red, #f04438) 5.5%, transparent);
  --wf-warn-ring: color-mix(in srgb, var(--aui-red, #f04438) 28%, transparent);
  --wf-warn-tile: color-mix(in srgb, var(--aui-red, #f04438) 10%, transparent);
  --wf-ok: var(--aui-success, #1e8a4f);
  --wf-ok-bg: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent);
  --wf-run: var(--accent);
  --wf-out: cubic-bezier(0.23, 1, 0.32, 1);
  --wf-well: var(--aui-subtle, rgba(0, 0, 0, 0.035));
  --wf-card-well: var(--aui-subtle, rgba(0, 0, 0, 0.028));
  --wf-well-hover: rgba(0, 0, 0, 0.06);
  --wf-accent-hover: rgba(0, 96, 226, 0.13);
  --wf-violet: var(--aui-purple, #a651f0);
  --wf-violet-bg: color-mix(in srgb, var(--aui-purple, #a651f0) 10%, transparent);
  --wf-gray: rgba(0, 0, 0, 0.5);
  --wf-amber: var(--aui-warning, #b25e00);
  --wf-amber-bg: color-mix(in srgb, var(--aui-orange, #f28a2e) 10%, transparent);
  --wf-green: var(--aui-success, #1e8a4f);
  --wf-green-bg: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent);
  --wf-tip: rgba(0, 0, 0, 0.88);
  --wf-tip-ink: #fcfcfc;
  --wf-float: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 4px 16px -4px rgba(0, 0, 0, 0.08);
  --mono: var(--aui-font-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
:where(.dark, [data-theme="dark"]) .ui-wf {
  --ui-wf-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --wf-dot: rgba(255, 255, 255, 0.12);
  --wf-edge: rgba(255, 255, 255, 0.22);
  --wf-port: rgba(255, 255, 255, 0.26);
  --wf-field: var(--aui-subtle, rgba(255, 255, 255, 0.04));
  --wf-set: color-mix(in srgb, var(--aui-blue, #4fb0fe) 8%, transparent);
  --wf-set-ring: color-mix(in srgb, var(--aui-blue, #4fb0fe) 34%, transparent);
  --wf-set-tile: color-mix(in srgb, var(--aui-blue, #4fb0fe) 16%, transparent);
  --wf-warn: var(--aui-red, #ff6b5f);
  --wf-warn-bg: color-mix(in srgb, var(--aui-red, #ff6b5f) 8%, transparent);
  --wf-warn-ring: color-mix(in srgb, var(--aui-red, #ff6b5f) 34%, transparent);
  --wf-warn-tile: color-mix(in srgb, var(--aui-red, #ff6b5f) 16%, transparent);
  --wf-ok: var(--aui-green, #5fc88a);
  --wf-ok-bg: color-mix(in srgb, var(--aui-green, #7dcf9f) 14%, transparent);
  --wf-run: var(--accent);
  --wf-well: var(--aui-subtle, rgba(255, 255, 255, 0.05));
  --wf-card-well: var(--aui-subtle, rgba(255, 255, 255, 0.04));
  --wf-well-hover: rgba(255, 255, 255, 0.08);
  --wf-accent-hover: color-mix(in srgb, var(--aui-blue, #4fb0fe) 22%, transparent);
  --wf-violet: var(--aui-purple, #b98af0);
  --wf-violet-bg: color-mix(in srgb, var(--aui-purple, #b98af0) 16%, transparent);
  --wf-gray: rgba(255, 255, 255, 0.55);
  --wf-amber: var(--aui-orange, #f2a15c);
  --wf-amber-bg: color-mix(in srgb, var(--aui-orange, #f2a15c) 14%, transparent);
  --wf-green: var(--aui-green, #5fc88a);
  --wf-green-bg: color-mix(in srgb, var(--aui-green, #7dcf9f) 14%, transparent);
  --wf-tip: #2c2c30;
  --wf-tip-ink: rgba(255, 255, 255, 0.9);
  --wf-float: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 4px 16px -4px rgba(0, 0, 0, 0.5);
}

/* ---------- Header: the path and the actions ---------- */
/* Menus in the header open below it, over the page */
/* Floating on the canvas: the path in a white bar, Publish as its own button right beside it – the bar gives way first when space runs out */
/* The 36px path and Publish sit on the shell's head-row centerline, level with its corner icons */
.ui-wf-top { position: absolute; top: calc((var(--as-head-h, 48px) - 36px) / 2); left: 10px; right: 10px; z-index: 8; display: flex; align-items: center; justify-content: flex-start; gap: 8px; pointer-events: none; }
.ui-wf-top > * { pointer-events: auto; }
.ui-wf-path { display: flex; flex: 0 1 auto; align-items: center; gap: 2px; min-width: 0; height: 36px; padding: 0 4px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--wf-float); }
.ui-wf-publish { flex: none; height: 36px; padding: 0 12px; border-radius: calc(var(--aui-radius, 7px) + 3px); }
.ui-wf[data-narrow] .ui-wf-publish { width: 36px; padding: 0; gap: 0; }
.ui-wf[data-narrow] .ui-wf-publish span { display: none; }
.ui-wf-path > i { flex: none; padding: 0 2px; font-style: normal; font-weight: 400; color: var(--faint); }
.ui-wf-path > .ui-as-anchor { display: flex; min-width: 0; }
.ui-wf-path .ui-as-menu { min-width: 232px; }
.ui-wf-crumb { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 260px; height: 28px; padding: 0 6px 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-wf-crumb:hover, .ui-wf-crumb[aria-expanded="true"] { background: var(--hover); }
.ui-wf-crumb > svg { flex: none; color: var(--faint); }
.ui-wf-crumb__text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-wf-logo { display: grid; flex: none; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--ink); font-size: 10px; font-weight: 500; color: var(--panel); }
.ui-wf-plan, .ui-wf-env { flex: none; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; }
.ui-wf-plan { background: var(--accent-soft); color: var(--accent); }
.ui-wf-env { background: var(--chip); color: var(--muted); }

/* Buttons: white with the card's hairline, one dark primary */
.ui-wf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; transition: box-shadow 140ms ease, background-color 140ms ease, opacity 140ms ease; }
.ui-wf-btn:hover { box-shadow: var(--card-shadow-hover); }
.ui-wf-btn:disabled { opacity: 0.6; cursor: default; }
.ui-wf-btn > svg { color: var(--muted); }
.ui-wf-btn--primary { background: var(--button); box-shadow: none; color: var(--aui-on-primary, #fcfcfc); }
:where(.dark, [data-theme="dark"]) .ui-wf-btn--primary { color: var(--aui-on-primary, #111113); }
.ui-wf-btn--primary > svg { color: inherit; }
.ui-wf-btn--primary:hover { background: var(--button-hover); box-shadow: none; }
.ui-wf-btn--quiet { align-self: flex-start; margin-left: -8px; background: none; box-shadow: none; color: var(--muted); }
.ui-wf-btn--quiet:hover { background: var(--hover); box-shadow: none; color: var(--ink); }

/* ---------- Canvas ---------- */
.ui-wf__area { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.ui-wf-vp {
  position: absolute;
  inset: 0;
  overflow: hidden;
  outline: none;
  touch-action: none;
  user-select: none;
  background-color: var(--panel);
  /* Small dots that keep their size at every zoom – the spacing and position follow the canvas (set inline) */
  background-image: radial-gradient(circle at 1px 1px, var(--wf-dot) 0.7px, transparent 1.05px);
  background-size: 20px 20px;
  cursor: default;
}
.ui-wf-vp[data-tool="hand"] { cursor: grab; }
.ui-wf-vp[data-tool="comment"] { cursor: crosshair; }
.ui-wf-vp[data-panning] { cursor: grabbing; }
.ui-wf-world { position: absolute; top: 0; left: 0; width: 0; height: 0; transform-origin: 0 0; }
.ui-wf-edges { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.ui-wf-edge { fill: none; stroke: var(--wf-edge); stroke-width: 1.25; transition: stroke 140ms ease; }
.ui-wf-edge[data-selected] { stroke: var(--accent); stroke-width: 1.6; }
/* A wide invisible twin of each curve takes the click */
.ui-wf-edge-hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
.ui-wf-edge-hit:hover + .ui-wf-edge:not([data-selected]) { stroke: var(--muted); }
/* A focused edge: no box outline (it would be the curve's bounding box) – the curve itself thickens with a soft accent halo */
.ui-wf-edge-hit:focus { outline: none; }
.ui-wf-edge-hit:focus-visible { stroke: var(--accent-soft); stroke-width: 8; }
.ui-wf-edge-hit:focus-visible + .ui-wf-edge { stroke: var(--accent); stroke-width: 2.2; }
.ui-wf-vp:is([data-tool="hand"], [data-panning], [data-wiring]) .ui-wf-edge-hit { cursor: inherit; }
/* The connection being dragged: dashed while it follows the pointer, solid once it snaps to an input */
.ui-wf-edge--draft { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.ui-wf-edge--draft[data-snapped] { stroke-dasharray: none; }
/* A run draws the curve it takes in accent, from its start to its end */
/* A branch's Yes / No sits on its curve, on a solid chip so the line doesn't run through the text */
.ui-wf-edge-tag { position: absolute; padding: 1px 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--card); box-shadow: var(--card-shadow); translate: -50% -50%; font-size: 10px; font-weight: 500; line-height: 14px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); white-space: nowrap; pointer-events: none; }
.ui-wf-edge--lit { stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ui-wf-draw 520ms var(--ease) forwards; }
@keyframes ui-wf-draw { to { stroke-dashoffset: 0; } }

/* Kinds: one quiet colour each – only the tag above the card, the trace and the impulse wear it */
.ui-wf-node[data-kind="trigger"], .ui-wf-flow[data-kind="trigger"], .ui-wf-arrive[data-from="trigger"] { --kind: var(--accent); --kind-bg: var(--accent-soft); }
.ui-wf-node[data-kind="agent"], .ui-wf-flow[data-kind="agent"], .ui-wf-arrive[data-from="agent"] { --kind: var(--wf-violet); --kind-bg: var(--wf-violet-bg); }
.ui-wf-node[data-kind="tool"], .ui-wf-flow[data-kind="tool"], .ui-wf-arrive[data-from="tool"] { --kind: var(--wf-gray); --kind-bg: var(--chip); }
.ui-wf-node[data-kind="logic"], .ui-wf-flow[data-kind="logic"], .ui-wf-arrive[data-from="logic"] { --kind: var(--wf-amber); --kind-bg: var(--wf-amber-bg); }
.ui-wf-node[data-kind="action"], .ui-wf-flow[data-kind="action"], .ui-wf-arrive[data-from="action"] { --kind: var(--wf-green); --kind-bg: var(--wf-green-bg); }

/* Node: a kind tag above, then a white card – header (tile, title, status chip) and two detail lines; every card the same size */
.ui-wf-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 272px;
  height: 110px;
  padding: 12px 12px 4px;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  cursor: grab;
  transition: box-shadow 160ms ease, opacity 200ms ease;
}
.ui-wf-node:hover { box-shadow: var(--card-shadow-hover); }
.ui-wf-vp[data-panning] .ui-wf-node, .ui-wf-vp[data-tool="hand"] .ui-wf-node { cursor: inherit; }
.ui-wf-node[data-off] { opacity: 0.55; }
/* Selected: a hairline accent ring, no glow */
.ui-wf-node[data-selected] { box-shadow: 0 0 0 1px var(--accent), 0 1px 2px rgba(0, 0, 0, 0.05); }
.ui-wf-node:focus-visible { outline: 2px solid var(--ui-wf-focus); outline-offset: 2px; }
.ui-wf-node__kind { position: absolute; bottom: calc(100% + 6px); left: 0; padding: 2px 6px; border-radius: var(--aui-radius-sm, 5px); background: var(--kind-bg); font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--kind); white-space: nowrap; }
.ui-wf-node__head { display: flex; align-items: center; gap: 8px; min-width: 0; height: 24px; }
.ui-wf-node__head > b { flex: 1; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--strong); }
.ui-wf-node__tile { display: grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--chip); color: var(--text); }
.ui-wf-node__tile[data-tone="set"] { background: var(--wf-set-tile); color: var(--accent); }
.ui-wf-node__tile[data-tone="warn"] { background: var(--wf-warn-tile); color: var(--wf-warn); }
/* The status chip: quiet gray; red-tinted when something is missing, green with a check once its step is done */
.ui-wf-node__chip { display: inline-flex; flex: none; align-items: center; gap: 4px; max-width: 120px; height: 20px; padding: 0 6px; border-radius: var(--aui-radius-sm, 5px); background: var(--chip); font-size: 11px; font-weight: 500; line-height: 16px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-wf-node__chip[data-tone="warn"] { background: var(--wf-warn-tile); color: var(--wf-warn); }
.ui-wf-node__chip[data-tone="done"] { background: var(--wf-ok-bg); color: var(--wf-ok); animation: ui-wf-swap 420ms var(--wf-out) both; }
.ui-wf-node__chip .ui-wf-spin { width: 11px; height: 11px; color: var(--accent); }
@keyframes ui-wf-swap { from { opacity: 0; transform: translateY(3px); } }
.ui-wf-node__line { flex: none; overflow: hidden; height: 18px; padding-left: 32px; font-size: 12.5px; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.ui-wf-node__line[data-warn] { color: var(--wf-warn); }
.ui-wf-node__mono { overflow: hidden; font-family: var(--mono); font-size: 11px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
/* The well: a light gray inner panel 4px in from the card's edges, holding the mono line or the chips */
.ui-wf-node__well { display: flex; flex: none; align-items: center; min-width: 0; height: 36px; margin: 0 -8px; padding: 6px 8px; border-radius: calc(var(--aui-radius-lg, 10px) - 3px); background: var(--wf-card-well); }
/* 3px of room around the chips, so overflow: hidden doesn't cut off their hairline and shadow */
.ui-wf-node__chips, .ui-wf-node__files { display: flex; gap: 4px; min-width: 0; margin: -3px; padding: 3px; overflow: hidden; }
/* On the gray well, chips are white with the card's hairline so they still stand out */
.ui-wf-node__well .ui-wf-file { background: var(--card); box-shadow: var(--card-shadow); }
/* File chips, as in Collaboration Stream: soft gray, radius 7, a two-gray icon; hover darkens; picked ones take the accent tint with an × */
.ui-wf-file { display: inline-flex; flex: none; align-items: center; gap: 5px; min-width: 0; max-width: 100%; height: 24px; padding: 0 8px 0 7px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); background: var(--wf-well); font-size: 12px; line-height: 18px; color: var(--text); white-space: nowrap; transition: background-color 140ms ease, color 140ms ease; }
.ui-wf-file > svg { flex: none; color: var(--muted); }
.ui-wf-file__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
button.ui-wf-file:hover:not(:disabled) { background: var(--wf-well-hover); color: var(--ink); }
button.ui-wf-file:active:not(:disabled) { transform: scale(0.98); }
.ui-wf-file:is([aria-pressed="true"], [data-picked]) { padding-right: 6px; background: var(--accent-soft); color: var(--accent); }
.ui-wf-file:is([aria-pressed="true"], [data-picked]) > svg { color: var(--accent); }
button.ui-wf-file[aria-pressed="true"]:hover:not(:disabled) { background: var(--wf-accent-hover); color: var(--accent); }
.ui-wf-file:disabled { cursor: default; }
.ui-wf-node__tag { display: inline-flex; flex: none; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); background: var(--card); box-shadow: var(--card-shadow); font-size: 12px; line-height: 18px; color: var(--text); white-space: nowrap; }
.ui-wf-node__tag[data-model] { background: linear-gradient(var(--kind-bg), var(--kind-bg)), var(--card); color: var(--kind); }

/* A run, after the snippet's play: the impulse arrives with a soft glow at the input, then a trace runs once round the card */
.ui-wf-arrive { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; opacity: 0; animation: ui-wf-arrive 700ms cubic-bezier(0.2, 0, 0.25, 1) forwards; }
.ui-wf-arrive::before { content: ""; position: absolute; top: 0; left: 50%; width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, var(--kind) 0%, transparent 66%); filter: blur(9px); opacity: 0.22; transform: translate(-50%, -50%); }
@keyframes ui-wf-arrive { 22% { opacity: 1; } 100% { opacity: 0; } }
.ui-wf-node[data-arrived] .ui-wf-port--in { animation: ui-wf-port-glow 700ms var(--wf-out) both; }
@keyframes ui-wf-port-glow { 0%, 28% { background: var(--kind-arrive, var(--accent)); box-shadow: 0 0 0 1.5px var(--kind-arrive, var(--accent)), 0 0 8px var(--kind-arrive, var(--accent)); scale: 1.4; } }
.ui-wf-node[data-arrived="trigger"] { --kind-arrive: var(--accent); }
.ui-wf-node[data-arrived="agent"] { --kind-arrive: var(--wf-violet); }
.ui-wf-node[data-arrived="tool"] { --kind-arrive: var(--wf-gray); }
.ui-wf-node[data-arrived="logic"] { --kind-arrive: var(--wf-amber); }
.ui-wf-node[data-arrived="action"] { --kind-arrive: var(--wf-green); }
/* Three overlapping dashes of different lengths: their opacity adds up in the middle and fades out at head and tail */
.ui-wf-trace { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ui-wf-trace__seg { fill: none; stroke: var(--kind); stroke-linecap: round; opacity: 0; }
.ui-wf-trace__seg--1 { stroke-dasharray: 0.22 0.78; animation: ui-wf-trace1 1500ms linear forwards; }
.ui-wf-trace__seg--2 { stroke-dasharray: 0.14 0.86; animation: ui-wf-trace2 1500ms linear forwards; }
.ui-wf-trace__seg--3 { stroke-dasharray: 0.06 0.94; animation: ui-wf-trace3 1500ms linear forwards; }
.ui-wf-trace__line { stroke-width: 1; }
.ui-wf-trace__line.ui-wf-trace__seg--1 { stroke-opacity: 0.18; }
.ui-wf-trace__line.ui-wf-trace__seg--2 { stroke-opacity: 0.24; }
.ui-wf-trace__line.ui-wf-trace__seg--3 { stroke-opacity: 0.32; }
.ui-wf-trace__glow { filter: blur(4px); }
.ui-wf-trace__glow .ui-wf-trace__seg { stroke-width: 3.5; stroke-opacity: 0.1; }
@keyframes ui-wf-trace1 { 0% { stroke-dashoffset: 0.11; opacity: 0; } 18%, 80% { opacity: 1; } 100% { stroke-dashoffset: -0.89; opacity: 0; } }
@keyframes ui-wf-trace2 { 0% { stroke-dashoffset: 0.07; opacity: 0; } 18%, 80% { opacity: 1; } 100% { stroke-dashoffset: -0.93; opacity: 0; } }
@keyframes ui-wf-trace3 { 0% { stroke-dashoffset: 0.03; opacity: 0; } 18%, 80% { opacity: 1; } 100% { stroke-dashoffset: -0.97; opacity: 0; } }
/* The impulse along an edge: a gradient stretch of the curve in the sender's colour (drawn by FlowTrail) */
.ui-wf-flow__line { fill: none; stroke-width: 1.6; stroke-linecap: round; }
.ui-wf-flow__stop { stop-color: var(--kind); }
/* While the run follows the running node, the view glides */
.ui-wf-vp[data-follow] .ui-wf-world { transition: transform 600ms var(--wf-out); }
.ui-wf-vp[data-follow] { transition: background-position 600ms var(--wf-out); }

.ui-wf-done { display: grid; flex: none; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--wf-ok-bg); color: var(--wf-ok); animation: ui-as-pop 260ms var(--ease) both; }
.ui-wf-done[data-failed] { background: var(--wf-warn-tile); color: var(--wf-warn); }
/* Read by screen readers only */
.ui-wf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Chips in the well give way before they overflow: a long name ends in "…", more than three become "+N" */
.ui-wf-node__well .ui-wf-file, .ui-wf-node__tag { flex: 0 1 auto; min-width: 0; max-width: 132px; }
.ui-wf-node__tag[data-model] { flex: none; }
.ui-wf-node__tag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-wf-node__tag > svg { flex: none; }
.ui-wf-node__more { display: inline-flex; flex: none; align-items: center; height: 24px; padding: 0 7px; border-radius: calc(var(--aui-radius-sm, 5px) + 2px); background: var(--card); box-shadow: var(--card-shadow); font-size: 12px; line-height: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Ports: the input in the middle of the top edge, outputs on the bottom edge – a free one ends in a blue + below it */
.ui-wf-port { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px var(--wf-port); transition: box-shadow 140ms ease, background-color 140ms ease, scale 160ms var(--ease); }
.ui-wf-port--in { top: -4px; left: 132px; }
.ui-wf-out { position: absolute; top: 100%; width: 0; height: 0; }
.ui-wf-out > .ui-wf-port { top: -4px; left: -4px; cursor: crosshair; }
/* A bigger, invisible target round the output dot, to start dragging a connection */
.ui-wf-port--out::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.ui-wf-port--out:hover { box-shadow: 0 0 0 1px var(--accent); scale: 1.25; }
.ui-wf-out__label { position: absolute; top: 3px; left: 7px; font-size: 10px; font-weight: 500; line-height: 14px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
/* A 16px dot inside a transparent 6px border – the border is the larger hit area (::after is the tooltip, so it can't be) */
.ui-wf-add { position: absolute; top: 8px; left: -14px; display: grid; place-items: center; box-sizing: content-box; width: 16px; height: 16px; border: 6px solid transparent; border-radius: 50%; background: var(--accent) padding-box; color: #fff; transition: transform 160ms var(--ease); }
.ui-wf-add::before { content: ""; position: absolute; bottom: 100%; left: 7.5px; width: 1px; height: 10px; background: var(--wf-edge); }
.ui-wf-add:hover, .ui-wf-add[aria-expanded="true"] { transform: scale(1.12); }
.ui-wf-add:focus-visible { outline-offset: 2px; }
/* While a connection is dragged: every input that can take it rings in accent, the one it snaps to fills */
.ui-wf-node[data-wire] .ui-wf-port--in { background: var(--accent-soft); box-shadow: 0 0 0 1.5px var(--accent); scale: 1.3; }
.ui-wf-node[data-wire="snap"] { box-shadow: 0 0 0 1px var(--accent), 0 1px 2px rgba(0, 0, 0, 0.05); }
.ui-wf-node[data-wire="snap"] .ui-wf-port--in { background: var(--accent); scale: 1.5; }
.ui-wf-vp[data-wiring], .ui-wf-vp[data-wiring] .ui-wf-node { cursor: crosshair; }
/* Small dark tooltips for the + and the toolbar */
.ui-wf-add[data-tip]:is(:hover, :focus-visible)::after, :is(.ui-wf-tb, .ui-wf-comment) [data-tip]:is(:hover, :focus-visible)::after {
  content: attr(data-tip);
  position: absolute;
  inset: auto;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50% 0;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--wf-tip);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: pre;
  color: var(--wf-tip-ink);
  pointer-events: none;
  animation: ui-wf-fade 140ms ease both;
}
/* The +'s tooltip goes below it, out of the curve's way */
.ui-wf-add[data-tip]:is(:hover, :focus-visible)::after { top: calc(100% + 6px); bottom: auto; }

/* A comment on the canvas */
/* Comments: closed, a pin – round with one squarer corner at the bottom left, pointing at its spot; open, a card */
.ui-wf-pin { position: absolute; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50% 50% 50% 4px; background: var(--card); box-shadow: var(--card-shadow); translate: 0 -100%; font-size: 10px; font-weight: 500; letter-spacing: 0.2px; color: var(--accent); transition: box-shadow 140ms ease, scale 160ms var(--ease); animation: ui-as-pop 220ms var(--ease) both; }
.ui-wf-pin:hover { box-shadow: var(--card-shadow-hover); scale: 1.06; }
.ui-wf-pin:focus-visible { outline-offset: 2px; }
.ui-wf-pin { cursor: grab; touch-action: none; }
.ui-wf-pin:active { cursor: grabbing; }
.ui-wf-pin--small { position: static; flex: none; width: 20px; height: 20px; font-size: 9px; translate: none; animation: none; box-shadow: none; background: var(--accent-soft); }
.ui-wf-comment { position: absolute; display: flex; flex-direction: column; width: 240px; border-radius: var(--aui-radius-lg, 10px); background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, var(--wf-float)); translate: 0 -28px; animation: ui-wf-pop 180ms var(--ease) both; }
.ui-wf-comment__head { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px 0 6px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-wf-comment__who { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; height: 28px; padding: 0 6px 0 2px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); text-align: left; }
.ui-wf-comment__who:hover { background: var(--hover); }
.ui-wf-comment__who b { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; color: var(--strong); }
.ui-wf-comment__who small { flex: none; font-size: 12px; color: var(--faint); }
.ui-wf-comment__act { position: relative; display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); }
.ui-wf-comment__act:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.ui-wf-comment__act:disabled { opacity: 0.35; cursor: default; }
.ui-wf-comment textarea { width: 100%; padding: 8px 10px 10px; border: 0; outline: 0; resize: none; background: none; font: inherit; font-size: 13px; line-height: 20px; color: var(--ink); user-select: text; }
.ui-wf-comment textarea::placeholder { color: var(--placeholder); }
.ui-wf-comment__foot { display: flex; justify-content: flex-end; gap: 6px; padding: 0 8px 8px; }
.ui-wf-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; pointer-events: none; }
.ui-wf-empty > * { pointer-events: auto; }

/* ---------- Palette ---------- */
.ui-wf-pal {
  position: absolute;
  /* Under the path bar, in the same column */
  top: 56px;
  bottom: 10px;
  left: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: 216px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--wf-float);
  animation: ui-wf-in-left 260ms var(--ease) both;
}
.ui-wf-pal__top { display: flex; flex: none; align-items: center; justify-content: space-between; height: 40px; padding: 0 6px 0 14px; font-size: 13px; font-weight: 500; color: var(--strong); }
.ui-wf-pal__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 6px; scrollbar-width: thin; }
.ui-wf-pal__groups { display: flex; flex-direction: column; }
.ui-wf-pal__group + .ui-wf-pal__group { margin-top: 6px; padding-top: 6px; box-shadow: inset 0 0.5px 0 var(--line); }
.ui-wf-pal__head { display: flex; align-items: center; gap: 6px; height: 28px; margin: 0; padding: 0 8px; font-size: 10px; font-weight: 500; line-height: 16px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.ui-wf-pal__head span { color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-wf-pal__item { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; text-align: left; color: var(--ink); cursor: pointer; transition: background-color 120ms ease; }
/* Drag an item out to place it; on touch a sideways drag picks it up, an up-and-down one scrolls the list */
.ui-wf-pal__item[data-drag] { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* The node card under the pointer while an item is dragged – scaled like the canvas */
.ui-wf-ghost { position: absolute; z-index: 10; width: 0; height: 0; transform-origin: 0 0; pointer-events: none; transition: opacity 120ms ease; }
.ui-wf-ghost .ui-wf-node { cursor: grabbing; box-shadow: var(--card-shadow-hover), 0 10px 24px -10px rgba(0, 0, 0, 0.2); }
.ui-wf-ghost:not([data-over]) { opacity: 0.5; }
.ui-wf-pal__item:hover, .ui-wf-pal__item:focus-visible { background: var(--hover); }
.ui-wf-pal__item:focus-visible { outline-offset: -2px; }
.ui-wf-pal__icon { display: grid; flex: none; place-items: center; width: 18px; color: var(--muted); }
.ui-wf-pal__text { display: grid; min-width: 0; }
.ui-wf-pal__label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-wf-pal__desc { display: none; overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-wf-pal__none { margin: 8px; font-size: 13px; color: var(--muted); }
/* What an item does, beside it */
.ui-wf-tip { position: absolute; z-index: 9; width: max-content; max-width: 220px; padding: 7px 10px; border-radius: 8px; background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, var(--wf-float)); translate: 0 -50%; font-size: 12px; line-height: 16px; color: var(--text); pointer-events: none; animation: ui-wf-fade 160ms ease both; }

/* The picker at a free output's + */
.ui-wf-picker { position: absolute; z-index: 9; display: flex; flex-direction: column; width: 240px; max-height: 340px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--aui-overlay, var(--card)); box-shadow: var(--aui-shadow-popover, var(--wf-float)); animation: ui-wf-pop 200ms var(--ease) both; }
.ui-wf-picker__search { display: flex; flex: none; align-items: center; gap: 8px; height: 40px; padding: 0 12px; box-shadow: inset 0 -0.5px 0 var(--line); color: var(--faint); }
.ui-wf-picker__search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); }
.ui-wf-picker__search input::placeholder { color: var(--placeholder); }
.ui-wf-picker__search:focus-within { box-shadow: inset 0 -1px 0 var(--line-strong); }
.ui-wf-picker__list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px 6px; }

/* ---------- Toolbar and minimap ---------- */
.ui-wf-tb { position: absolute; bottom: 14px; left: 50%; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: var(--aui-radius-lg, 10px); background: var(--card); box-shadow: var(--wf-float); translate: -50% 0; }
/* The toolbar centres in the free canvas between the palette (226px) and the settings (330px) */
.ui-wf__area[data-palette] .ui-wf-tb { left: calc(50% + 113px); }
.ui-wf__area[data-settings] .ui-wf-tb { left: calc(50% - 165px); }
.ui-wf__area[data-palette][data-settings] .ui-wf-tb { left: calc(50% - 52px); }
.ui-wf-tb__btn { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-wf-tb__btn:hover { background: var(--hover); color: var(--ink); }
.ui-wf-tb__btn[aria-pressed="true"] { background: var(--chip); color: var(--ink); }
.ui-wf-tb__add[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.ui-wf-tb__sep { width: 0.5px; height: 16px; margin: 0 4px; background: var(--line-strong); }
.ui-wf-tb__zoom { position: relative; width: 44px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-wf-tb__zoom:hover { background: var(--hover); color: var(--ink); }
.ui-wf-tb__run, .ui-wf-tb__run:hover { background: var(--wf-run); color: #fff; }
.ui-wf-tb__run:hover:not(:disabled) { filter: brightness(1.06); }
.ui-wf-tb__run:disabled { opacity: 0.6; cursor: default; }

/* Loading: the same cards in the same places, bars where the words go */
.ui-wf [data-skel] { pointer-events: none; }
.ui-wf-skel-world { position: absolute; top: 0; left: 0; width: 0; height: 0; }
.ui-wf-skel-kind { display: flex; align-items: center; height: 20px; }
.ui-wf-skel-title { display: flex; flex: 1; align-items: center; min-width: 0; height: 20px; }
.ui-wf-skel-line { display: flex; align-items: center; }

/* ---------- Run panel ---------- */
.ui-wf-run { position: relative; flex: none; display: flex; flex-direction: column; height: 0; overflow: hidden; background: var(--panel); box-shadow: inset 0 0.5px 0 var(--line-strong); opacity: 0; transition: height 340ms var(--ease), opacity 240ms ease; }
.ui-wf-run[data-open] { height: var(--run-h); opacity: 1; }
.ui-wf[data-resizing] :is(.ui-wf-run, .ui-wf-set) { transition: none; }
.ui-wf[data-resizing] { cursor: row-resize; user-select: none; }
.ui-wf-run__grip { position: absolute; top: 0; left: 0; right: 0; z-index: 2; height: 6px; cursor: row-resize; touch-action: none; }
.ui-wf-run__grip::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: transparent; transition: background-color 140ms ease; }
.ui-wf-run__grip:hover::after, .ui-wf[data-resizing] .ui-wf-run__grip::after { background: var(--edge-active); }
.ui-wf-run__grip:focus-visible { outline-offset: -2px; }
.ui-wf-run__head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 10px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-wf-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ui-wf-tabs::-webkit-scrollbar { display: none; }
.ui-wf-tabs button { position: relative; display: inline-flex; flex: none; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); transition: background-color 140ms ease, color 140ms ease; }
.ui-wf-tabs button:hover { color: var(--ink); }
.ui-wf-tabs button[aria-selected="true"] { background: var(--chip); color: var(--ink); }
.ui-wf-tabs button:focus-visible { outline-offset: -2px; }
.ui-wf-tabs__count { min-width: 16px; padding: 0 4px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--wf-warn-tile); font-size: 11px; line-height: 16px; text-align: center; color: var(--wf-warn); }
.ui-wf-run__body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 6px 8px; }
.ui-wf-run__body .ui-as-empty[data-bare] { padding: 20px 16px; }
.ui-wf-run__pad { padding: 6px 6px 0; }
.ui-wf-run__foot { display: flex; flex: none; justify-content: center; padding: 8px; box-shadow: inset 0 0.5px 0 var(--line); }
/* A run and its steps: rows of one height, figures on the right in fixed columns */
.ui-wf-runs__run + .ui-wf-runs__run { margin-top: 2px; }
.ui-wf-runs__head, .ui-wf-step__row, .ui-wf-list__row {
  display: grid;
  grid-template-columns: 16px auto minmax(0, max-content) auto minmax(0, 1fr) 64px 96px;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  font-size: 13px;
  text-align: left;
  color: var(--ink);
  transition: background-color 120ms ease;
}
.ui-wf-runs__head { grid-template-columns: 16px 12px auto auto minmax(0, 1fr) 64px 160px; }
.ui-wf-runs__head > svg { color: var(--faint); transition: rotate 200ms var(--ease); }
.ui-wf-runs__head[aria-expanded="true"] > svg { rotate: 90deg; }
.ui-wf-runs__head b { font-weight: 500; color: var(--strong); }
.ui-wf-runs__id { color: var(--faint); font-variant-numeric: tabular-nums; }
.ui-wf-runs__head:hover, .ui-wf-step__row:hover, .ui-wf-list__row:hover { background: var(--hover); }
.ui-wf-runs__head:focus-visible, .ui-wf-step__row:focus-visible, .ui-wf-list__row:focus-visible { outline-offset: -2px; }
.ui-wf-steps { margin: 0; padding: 0 0 0 20px; list-style: none; }
.ui-wf-step { animation: ui-wf-rise 320ms var(--ease) both; }
.ui-wf-step__row { grid-template-columns: 16px minmax(0, max-content) auto auto minmax(0, 1fr) 64px 96px; }
.ui-wf-step__row > .ui-wf-badge { grid-column: 3; }
.ui-wf-step__row > .ui-wf-count { grid-column: 4; }
.ui-wf-step__row > .ui-wf-step__time { grid-column: 6; }
.ui-wf-step__row > .ui-wf-step__cost { grid-column: 7; }
.ui-wf-step__mark { display: grid; place-items: center; width: 16px; height: 16px; color: var(--accent); }
.ui-wf-step__mark > svg { color: var(--wf-warn); }
.ui-wf-step__mark > .ui-wf-spin { color: var(--accent); }
/* A failed step's message under its row: in the warning colour, wrapped at any point, two lines at most (all of it in the tooltip) */
.ui-wf-step__error { display: -webkit-box; margin: -2px 10px 6px 32px; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; font-size: 12px; line-height: 16px; color: var(--wf-warn); }
.ui-wf-list__row--error .ui-wf-list__meta { color: var(--wf-warn); }
.ui-wf-step__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-wf-step__time { grid-column: 6; font-size: 12px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-wf-step__cost { grid-column: 7; overflow: hidden; font-size: 12px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.ui-wf-runs__head .ui-wf-step__cost { color: var(--text); }
.ui-wf-badge { flex: none; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; line-height: 16px; color: var(--muted); }
.ui-wf-count { flex: none; padding: 0 5px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 11px; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-wf-spin { width: 14px; height: 14px; }
.ui-wf-list { margin: 0; padding: 0; list-style: none; }
.ui-wf-list__row { grid-template-columns: 16px minmax(0, max-content) minmax(0, 1fr) auto; }
.ui-wf-list__row > svg { color: var(--muted); }
.ui-wf-list__meta { min-width: 0; overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-wf-tag { padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.ui-wf-tag[data-tone="ok"] { background: var(--wf-ok-bg); color: var(--wf-ok); }
.ui-wf-tag[data-tone="warn"] { background: var(--wf-warn-tile); color: var(--wf-warn); }
/* Timeline: each step's share of the run as a quiet bar */
.ui-wf-timeline { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ui-wf-timeline li { display: grid; grid-template-columns: 160px minmax(0, 1fr) 64px; align-items: center; gap: 12px; height: 30px; padding: 0 10px 0 8px; font-size: 13px; color: var(--ink); }
.ui-wf-timeline__track { position: relative; height: 8px; border-radius: 4px; background: var(--wf-field); }
.ui-wf-timeline__track i { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--faint); transition: background-color 200ms ease; }
.ui-wf-timeline li[data-state="running"] i { background: var(--accent); }
.ui-wf-timeline li[data-state="waiting"] { color: var(--faint); }
.ui-wf-timeline li[data-state="waiting"] i { background: var(--chip); }

/* ---------- Node settings ---------- */
.ui-wf-set {
  position: absolute;
  /* Full height – nothing floats above it on the right; with the run panel open it ends above it */
  top: 10px;
  right: 10px;
  bottom: calc(10px + var(--run-space, 0px));
  transition: bottom 340ms var(--ease);
  z-index: 7;
  display: flex;
  flex-direction: column;
  width: 320px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  outline: none;
  background: var(--card);
  box-shadow: var(--wf-float);
  animation: ui-wf-in-right 260ms var(--ease) both;
}
.ui-wf-set__head { display: flex; flex: none; align-items: center; gap: 2px; height: 52px; padding: 0 8px 0 12px; box-shadow: inset 0 -0.5px 0 var(--line); }
.ui-wf-set__head .ui-wf-node__tile { width: 28px; height: 28px; margin-right: 8px; }
.ui-wf-set__title { display: grid; flex: 1; min-width: 0; }
.ui-wf-set__title b { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; color: var(--strong); }
.ui-wf-set__title small { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-wf-set__body { display: flex; flex: 1; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 14px 14px 16px; }
.ui-wf-set__about { margin: 0; font-size: 13px; line-height: 20px; color: var(--text); }
.ui-wf-note { display: flex; gap: 8px; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--wf-warn-bg); font-size: 12px; line-height: 16px; color: var(--wf-warn); }
.ui-wf-note > svg { flex: none; margin-top: 1px; }
.ui-wf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ui-wf-field__label, .ui-wf-label { font-size: 12px; font-weight: 500; line-height: 16px; color: var(--text); }
.ui-wf-label { display: block; font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.ui-wf-run__pad .ui-wf-label { margin-bottom: 6px; }
.ui-wf-field__label small { margin-left: 4px; font-size: 12px; font-weight: 400; color: var(--faint); }
.ui-wf-group { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; box-shadow: inset 0 0.5px 0 var(--line); }
.ui-wf-input { width: 100%; min-width: 0; height: 32px; padding: 0 10px; border: 0; border-radius: calc(var(--aui-radius, 7px) + 1px); outline: 0; background: var(--wf-field); box-shadow: inset 0 0 0 0.5px var(--line-strong); font: inherit; font-size: 13px; color: var(--ink); transition: box-shadow 140ms ease; }
.ui-wf-input[data-mono] { font-family: var(--mono); font-size: 12px; }
/* Text inputs are the library's Text Field, tinted like the inspector's selects and text areas */
.ui-wf-text { min-width: 0; }
.ui-wf-text:is(.ui-tfc, .ui-tac) { --ui-tfc-surface: var(--wf-field); --ui-tac-surface: var(--wf-field); }
.ui-wf-mono:is(.ui-tfc__input, .ui-tac__input) { font-family: var(--mono); font-size: 12px; }
.ui-wf-input--area { height: auto; min-height: 88px; padding: 7px 10px; resize: vertical; line-height: 20px; }
.ui-wf-input::placeholder { color: var(--placeholder); }
/* Typing in a field: no ring – the caret shows where you are, the hairline only firms up a little */
.ui-wf-input:focus, .ui-wf-input:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
/* A select is a button: its ring shows for the keyboard only, as the shell's accent ring */
button.ui-wf-input:focus:not(:focus-visible) { box-shadow: inset 0 0 0 0.5px var(--line-strong); }
button.ui-wf-input:focus-visible { outline: 2px solid var(--ui-wf-focus); outline-offset: 2px; box-shadow: inset 0 0 0 0.5px var(--line-strong); }
.ui-wf-select { display: flex; min-width: 0; }
.ui-wf-select .ui-as-menu { min-width: 220px; }
/* Selects: the library's Select, tinted like the text fields next to them */
.ui-wf-pick { min-width: 0; }
/* Switches: the library's Switch, small, at the start of their row */
.ui-wf-switch { align-self: flex-start; }
.ui-wf-pick.ui-selc { --ui-selc-surface: var(--wf-field); }
/* Connections in the settings: where each output goes, and Connect to… */
.ui-wf-conns { display: flex; flex-direction: column; gap: 4px; }
.ui-wf-conn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 2px 0 10px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--wf-field); box-shadow: inset 0 0 0 0.5px var(--line); font-size: 13px; color: var(--ink); }
.ui-wf-conn > svg { flex: none; color: var(--muted); }
.ui-wf-conn > span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-wf-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.ui-wf-cond { display: grid; grid-template-columns: minmax(0, 1.3fr) 92px minmax(0, 1fr) 28px; align-items: center; gap: 6px; }
.ui-wf-cond .ui-as-icon-btn:disabled { opacity: 0.35; cursor: default; }
/* Radios: a ring that fills in accent */
.ui-wf-radios { display: flex; flex-direction: column; gap: 2px; }
.ui-wf-radios button { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; margin-left: -6px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; color: var(--ink); }
.ui-wf-radios button:hover { background: var(--hover); }
.ui-wf-radio { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow 160ms ease; }
.ui-wf-radios [aria-checked="true"] .ui-wf-radio { box-shadow: inset 0 0 0 4px var(--accent); }
/* Chips: gray outlines; picked ones tinted accent with an × */
.ui-wf-chips { display: flex; flex-wrap: wrap; gap: 4px; transition: opacity 200ms ease; }
.ui-wf-chips[data-off] { opacity: 0.45; }
.ui-wf-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 12px; color: var(--text); transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
.ui-wf-chip[data-mono] { font-family: var(--mono); font-size: 11px; }
.ui-wf-chip:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.ui-wf-chip[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 0.5px var(--wf-set-ring); color: var(--accent); padding-right: 6px; }
.ui-wf-chip:disabled { cursor: default; }
/* Switch */
/* JSON: mono on a light gray fill */
.ui-wf-code { margin: 0; padding: 10px 12px; overflow: auto; border-radius: calc(var(--aui-radius-lg, 10px) - 2px); background: var(--wf-field); box-shadow: inset 0 0 0 0.5px var(--line); font-family: var(--mono); font-size: 11.5px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); user-select: text; }
.ui-wf-code:focus-visible { outline-offset: 2px; }

/* The toast sits above the floating toolbar */
.ui-wf__area > .ui-as-toast { bottom: 64px; }

/* Phones: the palette and the settings become sheets from the bottom over a soft scrim */
.ui-wf-scrim { position: absolute; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.16); animation: ui-wf-fade 200ms ease both; }
:where(.dark, [data-theme="dark"]) .ui-wf-scrim { background: rgba(0, 0, 0, 0.45); }
.ui-wf-pal[data-sheet], .ui-wf-set[data-sheet] { top: auto; right: 8px; bottom: 8px; left: 8px; z-index: 7; width: auto; max-height: min(72%, 560px); animation: ui-wf-in-up 300ms var(--ease) both; }
.ui-wf-set[data-sheet] { height: min(72%, 560px); }
.ui-wf-pal[data-sheet] .ui-wf-pal__item { height: 48px; }
.ui-wf-pal[data-sheet] .ui-wf-pal__desc { display: block; }
.ui-wf-pal[data-sheet] .ui-wf-pal__icon { width: 30px; height: 30px; border-radius: 8px; background: var(--chip); }
.ui-wf[data-narrow] .ui-wf-tb { bottom: 10px; max-width: calc(100% - 16px); }
.ui-wf[data-narrow] :is(.ui-wf-tb__comment, .ui-wf-tb__zoom) { display: none; }
.ui-wf[data-narrow] .ui-wf-picker { right: 8px; left: 8px !important; width: auto; }
.ui-wf[data-narrow] .ui-wf-runs__head { grid-template-columns: 16px 12px auto auto minmax(0, 1fr) 0 auto; }
/* On a phone a step keeps its name readable: the kind badge and the counter step aside, time and cost stay */
.ui-wf[data-narrow] .ui-wf-step__row { grid-template-columns: 16px minmax(0, 1fr) 0 0 0 52px 76px; }
.ui-wf[data-narrow] .ui-wf-step__row > :is(.ui-wf-badge, .ui-wf-count) { display: none; }
.ui-wf[data-narrow] :is(.ui-wf-count, .ui-wf-runs__head .ui-wf-step__time, .ui-wf-runs__head .ui-wf-list__meta) { display: none; }
.ui-wf[data-narrow] .ui-wf-tabs button span:not(.ui-wf-tabs__count) { display: none; }
.ui-wf[data-narrow] .ui-wf-timeline li { grid-template-columns: 96px minmax(0, 1fr) 56px; }
/* Narrow: the App Shell's sidebar button sits in the top left corner – the path bar starts after it */
@container ui-as (max-width: 900px) {
  .ui-wf-top { left: 52px; }
}
@container ui-as (max-width: 720px) {
  .ui-wf-path > .ui-wf-path__org, .ui-wf-path > i:first-of-type { display: none; }
  .ui-wf-env { display: none; }
}
@container ui-as (max-width: 480px) {
  .ui-wf-path > i, .ui-wf-path > .ui-as-anchor:nth-child(3) { display: none; }
}

@keyframes ui-wf-fade { from { opacity: 0; } }
@keyframes ui-wf-pop { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
@keyframes ui-wf-rise { from { opacity: 0; transform: translateY(4px); } }
@keyframes ui-wf-in-left { from { opacity: 0; transform: translateX(-8px); } }
@keyframes ui-wf-in-right { from { opacity: 0; transform: translateX(8px); } }
@keyframes ui-wf-in-up { from { opacity: 0; transform: translateY(16px); } }

/* Reduced motion: no light travelling round the card – a steady accent ring shows the running step instead */
@media (prefers-reduced-motion: reduce) {
  .ui-wf-trace, .ui-wf-flow, .ui-wf-arrive { display: none; }
  .ui-wf-node[data-arrived] .ui-wf-port--in { animation: none; }
  .ui-wf-node[data-run="running"] { box-shadow: 0 0 0 1px var(--kind), 0 1px 2px rgba(0, 0, 0, 0.05); }
  .ui-wf-edge--lit { animation: none; stroke-dashoffset: 0; }
  .ui-wf-run { transition: none; }
}

/* Touch: every control at least 36px, fields at 16px so phones don't zoom in */
@media (pointer: coarse) {
  .ui-wf-tb__btn, .ui-wf-set__head .ui-as-icon-btn, .ui-wf-pal__top .ui-as-icon-btn, .ui-wf-run__head .ui-as-icon-btn, .ui-wf-cond .ui-as-icon-btn { width: 36px; height: 36px; }
  .ui-wf-btn, .ui-wf-crumb, .ui-wf-publish, .ui-wf-tabs button, .ui-wf-radios button, .ui-wf-switch { min-height: 36px; }
  .ui-wf-pal__item, .ui-wf-runs__head, .ui-wf-step__row, .ui-wf-list__row { height: 40px; }
  .ui-wf-chip { height: 32px; padding: 0 10px; }
  .ui-wf-chips .ui-wf-file { height: 32px; padding-inline: 10px 11px; }
  .ui-wf-input { height: 40px; font-size: 16px; }
  .ui-wf-input[data-mono], .ui-wf-picker__search input, .ui-wf-comment textarea { font-size: 16px; }
  .ui-wf-picker__search { height: 44px; }
  .ui-wf-add { top: 4px; left: -18px; border-width: 10px; }
  .ui-wf-run__grip { height: 14px; }
  .ui-wf-comment__act, .ui-wf-pin { width: 36px; height: 36px; }
}


/* Evals: header with prompt, version and model, then cards on the panel */
.ui-ev {
  --ui-ev-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  --ev-pass: var(--aui-success, #1e8a4f);
  --ev-pass-soft: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent);
  --ev-partial: var(--aui-warning, #b25e00);
  --ev-partial-dot: var(--aui-amber, #e8b000);
  --ev-partial-soft: color-mix(in srgb, var(--aui-amber, #e8b000) 13%, transparent);
  --ev-fail: var(--aui-red, #f04438);
  --ev-fail-soft: color-mix(in srgb, var(--aui-red, #f04438) 9%, transparent);
  --ev-run: var(--aui-blue, #4fb0fe);
  --ev-run-soft: color-mix(in srgb, var(--aui-blue, #0190fe) 10%, transparent);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
:where(.dark, [data-theme="dark"]) .ui-ev {
  --ui-ev-focus: var(--aui-focus, rgba(77, 141, 255, 0.8));
  --ev-pass: var(--aui-green, #5fc88a);
  --ev-pass-soft: color-mix(in srgb, var(--aui-green, #7dcf9f) 12%, transparent);
  --ev-partial: var(--aui-amber, #e6c24d);
  --ev-partial-soft: color-mix(in srgb, var(--aui-amber, #e6c24d) 13%, transparent);
  --ev-fail: var(--aui-red, #ff6b5f);
  --ev-fail-soft: color-mix(in srgb, var(--aui-red, #ff6b5f) 13%, transparent);
  --ev-run: var(--aui-blue, #4fb0fe);
  --ev-run-soft: color-mix(in srgb, var(--aui-blue, #4fb0fe) 15%, transparent);
}

/* The bar stays on top while the page scrolls under it */
.ui-ev__head { position: sticky; top: 0; z-index: 6; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; background: var(--panel); }
.ui-ev__title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-ev__path { display: flex; flex: 0 1 auto; align-items: center; gap: 8px; min-width: 0; margin: 0 4px 0 0; font-size: 13px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.ui-ev__path i { font-style: normal; color: var(--faint); }
/* Long names stay on one line: the title and the model give way first, the full text is in their title */
.ui-ev__path b { min-width: 0; overflow: hidden; font-weight: 500; text-overflow: ellipsis; color: var(--ink); }
.ui-ev__chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-ev__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 2px);
  background: var(--chip);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.ui-ev__chip:not(.ui-ev__chip--btn) { flex: 0 10 auto; min-width: 96px; }
.ui-ev__chip > svg { flex: none; }
.ui-ev__chip--btn { flex: none; }
.ui-ev__chip:not(.ui-ev__chip--btn) { font-family: var(--aui-font-mono, ui-monospace, "SF Mono", Menlo, monospace); font-size: 12px; }
.ui-ev__chip--btn { font-weight: 500; color: var(--ink); transition: background-color 140ms ease; }
.ui-ev__chip--btn:hover, .ui-ev__chip--btn[aria-expanded="true"] { background: var(--chip-hover); }
.ui-ev__current { font-weight: 400; color: var(--muted); }
.ui-ev__actions { display: flex; flex: none; align-items: center; gap: 12px; }
.ui-ev__meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Thin progress line under the header while a run is going */
.ui-ev__progress { position: absolute; left: 16px; right: 16px; bottom: 0; height: 2px; border-radius: 1px; overflow: hidden; background: var(--line); opacity: 0; transition: opacity 300ms ease; }
.ui-ev__progress[data-on] { opacity: 1; }
.ui-ev__progress i { display: block; height: 100%; border-radius: 1px; background: var(--ev-run); transition: width 200ms var(--ease); }

/* Two columns for the chart and the diff; the test cases span both below */
.ui-ev__content {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-rows: auto auto minmax(380px, 1fr);
  gap: 12px;
  padding: 12px 16px 16px;
}
.ui-ev__card { border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ev__cap { font-size: 12.5px; line-height: 18px; color: var(--muted); }

.ui-ev__stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ui-ev__stat { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 10px; padding: 14px 16px; }
.ui-ev__stat .ui-ev__cap { grid-column: 1 / -1; }
.ui-ev__stat strong { font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.ui-ev__stat small { margin-left: 1px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--faint); }
.ui-ev__delta { font-size: 12px; font-weight: 500; color: var(--ev-fail); font-variant-numeric: tabular-nums; }
.ui-ev__delta[data-good] { color: var(--ev-pass); }
.ui-ev__delta span { font-weight: 400; color: var(--faint); }

/* Library chart flat, with the same edge as the cards; its plot grows with the row */
.ui-ev .ui-ev__chart.ui-kpic {
  --ui-kpic-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
}
/* Without a prompt change to show, the chart takes the full width */
.ui-ev .ui-ev__chart--wide.ui-kpic { grid-column: 1 / -1; }
.ui-ev .ui-ev__chart .ui-kpic__chart { flex: 1; grid-template-rows: minmax(140px, 1fr) 20px; }
/* The chart's title and figure in the same sizes as the stat cards – like the Analytics screen */
.ui-ev .ui-ev__chart .ui-kpic__title { font-size: 12.5px; font-weight: 400; line-height: 18px; color: var(--muted); }
.ui-ev .ui-ev__chart .ui-kpic__value { margin-top: 10px; font-size: 20px; line-height: 28px; }
.ui-ev .ui-ev__chart .ui-kpic__footer { font-size: 12px; }

/* Inline Diff next to the chart: one white card as tall as the chart – its label inside on top like the chart's title,
   room under the text, the buttons at the bottom without a line above them */
.ui-ev .ui-ev__diff.ui-dfc { display: flex; flex-direction: column; align-self: stretch; padding: 14px 0 0; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-ev .ui-ev__diff .ui-dfc__label { margin: 0 16px 4px; font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-ev .ui-ev__diff .ui-dfc__card { display: flex; flex: 1; flex-direction: column; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: none; box-shadow: none; }
.ui-ev .ui-ev__diff .ui-dfc__body { flex: 1; padding: 6px 16px 20px; }
.ui-ev .ui-ev__diff .ui-dfc__foot { border-top: 0; }
.ui-ev .ui-ev__diff .ui-dfc__text { font-size: 13px; line-height: 1.6; }

/* Test cases: the table scrolls inside its card, so the row always fits the screen */
/* Full width, with the same room above it as a section in the other screens (38px from the content above) */
/* Not clipped, so the table card's edge shows all round */
.ui-ev__cases { position: relative; display: flex; flex-direction: column; grid-column: 1 / -1; min-height: 0; margin-top: 26px; }
.ui-ev__cases-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; height: 32px; margin-bottom: 10px; padding-left: 2px; }
.ui-ev__cases-head h2 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); }
.ui-ev__cases-head h2 span { font-weight: 400; color: var(--muted); }
/* One white card like the invoices in Settings / Billing: a quiet head row, then rows split by hairlines – it scrolls inside */
.ui-ev__scroll { position: absolute; inset: 42px 0 0; overflow: auto; overscroll-behavior: contain; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
/* No cases at all: the empty state fills the table's place; a filter with no match: centered on the panel */
.ui-ev__cases > .ui-as-empty { position: absolute; inset: 42px 0 0; justify-content: center; margin-top: 0; }
/* A new prompt: only the test cases, filling the page */
.ui-ev__content[data-empty] { grid-template-rows: minmax(380px, 1fr); }
.ui-ev__content[data-empty] .ui-ev__cases { margin-top: 0; }
/* Pages of 50 cases under the table */
.ui-ev__pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 8px 10px; box-shadow: inset 0 0.5px 0 var(--line); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-ev__pager span { margin-right: 6px; }
.ui-ev__pager button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: calc(var(--aui-radius-sm, 5px) + 3px); color: var(--muted); }
.ui-ev__pager button:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.ui-ev__pager button:disabled { opacity: 0.4; cursor: default; }
.ui-ev__table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.ui-ev__table th {
  position: sticky;
  z-index: 1;
  top: 0;
  height: 40px;
  padding: 0 12px;
  background: var(--card);
  box-shadow: inset 0 -0.5px 0 var(--line);
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  color: var(--muted);
}
.ui-ev__table th:nth-child(1) { width: 30%; padding-left: 18px; }
.ui-ev__table th:nth-child(2) { width: 22%; }
.ui-ev__table th:nth-child(4) { width: 112px; }
.ui-ev__table th:nth-child(5) { width: 80px; padding-right: 18px; text-align: right; }
.ui-ev__table td { height: 48px; padding: 0 12px; background: var(--card); color: var(--ink); transition: background-color 140ms ease; }
.ui-ev__table tbody tr + tr td { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-ev__table td:first-child { padding-left: 18px; }
.ui-ev__table td:last-child { padding-right: 18px; }
.ui-ev__in { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-ev__table tbody tr { cursor: pointer; }
.ui-ev__table tbody tr:hover td { background: color-mix(in srgb, var(--card), var(--ink) 2.5%); }
.ui-ev__table tbody tr[aria-selected="true"] td { background: color-mix(in srgb, var(--card), var(--ink) 4%); }
.ui-ev__table tbody tr[data-state="running"] td { background: linear-gradient(var(--ev-run-soft), var(--ev-run-soft)), var(--card); }
.ui-ev__table tbody tr:focus-visible { outline: 2px solid var(--ui-ev-focus); outline-offset: -2px; }
.ui-ev__table tbody tr[data-state="queued"] td { color: var(--faint); }
.ui-ev__trunc { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-ev__soft { color: var(--muted); }
.ui-ev__id { flex: none; font-family: var(--aui-font-mono, ui-monospace, "SF Mono", Menlo, monospace); font-size: 11.5px; color: var(--faint); }
.ui-ev__num { text-align: right; color: var(--muted) !important; font-variant-numeric: tabular-nums; }

/* Score pill – pass, partial, fail, or the run state */
.ui-ev__pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  animation: ui-ev-pop 320ms var(--ease) both;
}
.ui-ev__pill > i:not(.ui-ev__spin) { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ui-ev__pill > span { font-weight: 400; opacity: 0.75; font-variant-numeric: tabular-nums; }
.ui-ev__pill[data-v="pass"] { background: var(--ev-pass-soft); color: var(--ev-pass); }
.ui-ev__pill[data-v="partial"] { background: var(--ev-partial-soft); color: var(--ev-partial); }
.ui-ev__pill[data-v="fail"] { background: var(--ev-fail-soft); color: var(--ev-fail); }
.ui-ev__pill[data-v="queued"] { background: var(--chip); color: var(--faint); font-weight: 400; animation: none; }
.ui-ev__pill[data-v="running"] { background: var(--ev-run-soft); color: var(--ev-run); animation: none; }
.ui-ev__spin { width: 10px; height: 10px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ui-ev-spin 700ms linear infinite; }
@keyframes ui-ev-pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes ui-ev-spin { to { transform: rotate(1turn); } }

/* Selected case: input, expected, last version's output against this one's */
.ui-ev__input { margin: -4px 0 0; font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink); }
.ui-ev__field { display: grid; gap: 4px; }
.ui-ev__field p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.ui-ev__foot { display: flex; align-items: center; gap: 6px; margin-top: auto; font-size: 12px; color: var(--faint); }

/* Loading: the same cards, chart box, diff card and table, gray shapes in place of the data – nothing moves when it lands */
.ui-ev [data-skel] { pointer-events: none; }
/* Each bar centered in the line of what it stands in for: the 20px figure's 28px line, a table cell's 20px line */
.ui-ev__skel-num { display: flex; align-items: center; height: 28px; }
.ui-ev__skel-ghost { position: relative; }
.ui-ev__skel-ghost > span { visibility: hidden; }
.ui-ev__skel-ghost > .ui-as-skel { position: absolute; top: 50%; left: 0; translate: 0 -50%; }
.ui-ev__delta.ui-ev__skel-ghost > .ui-as-skel { right: 0; left: auto; }
.ui-ev__skel-cell { display: flex; align-items: center; gap: 8px; min-width: 0; height: 20px; }
.ui-ev__skel-cell--end { justify-content: flex-end; }
/* The KPI Chart's box: title, figure, plot with y and x labels, footer – the same paddings and rows as the library chart here */
.ui-ev__chart-skel { display: flex; flex-direction: column; min-width: 0; }
.ui-ev__chart-skel--wide { grid-column: 1 / -1; }
.ui-ev__chart-skel-body { display: flex; flex: 1; flex-direction: column; padding: 14px 16px 12px; }
.ui-ev__chart-skel-body > .ui-ev__cap { display: block; }
.ui-ev__skel-value { margin-top: 10px; }
.ui-ev__chart-skel-grid { display: grid; flex: 1; grid-template-columns: auto 1fr; grid-template-rows: minmax(140px, 1fr) 20px; column-gap: 10px; row-gap: 8px; margin-top: 20px; }
.ui-ev__chart-skel-y { display: flex; flex-direction: column; justify-content: space-between; }
.ui-ev__chart-skel-plot { display: flex; align-items: flex-end; gap: 6px; min-width: 0; }
.ui-ev__chart-skel-plot > .ui-as-skel { flex: 1 1 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ui-ev__chart-skel-x { display: flex; grid-column: 2; align-items: center; justify-content: space-between; }
.ui-ev__chart-skel-foot { display: flex; align-items: center; height: 36.5px; padding: 0 16px; border-top: 0.5px solid var(--line); }
/* The Inline Diff's card: label, the prompt's 20.8px lines, the footer with its buttons */
.ui-ev__diff-skel { display: flex; flex-direction: column; align-self: stretch; min-width: 0; padding-top: 14px; }
.ui-ev__diff-skel-label { display: flex; align-items: center; height: 18px; margin: 0 16px 4px; }
.ui-ev__diff-skel-body { flex: 1; padding: 6px 16px 20px; }
.ui-ev__diff-skel-line { display: flex; align-items: center; height: 20.8px; }
.ui-ev__diff-skel-foot { display: flex; align-items: center; justify-content: space-between; min-height: 44.5px; padding: 8px 8px 8px 16px; border-top: 0.5px solid var(--line); }
.ui-ev__diff-skel-btns { display: flex; gap: 8px; }

/* Touch: the version chip, Run and the page buttons grow to a comfortable 32px */
@media (pointer: coarse) {
  .ui-ev__chip--btn { height: 32px; }
  .ui-ev__pager button { width: 32px; height: 32px; }
}

/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
.ui-ev__head { transition: padding-left 420ms var(--ease); }

/* Narrow panels: one column; table and detail get their own height */
@container ui-as-main (max-width: 1000px) {
  .ui-ev__content { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .ui-ev__cases { height: 440px; }
}
@container ui-as-main (max-width: 820px) {
  .ui-ev__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-ev__table { min-width: 720px; }
}
@container ui-as-main (max-width: 560px) {
  .ui-ev__stats { gap: 8px; }
  .ui-ev__stat { padding: 12px; }
  .ui-ev__stat strong { font-size: 19px; }
  .ui-ev__cases-head { flex-wrap: wrap; }
  .ui-ev__scroll, .ui-ev__cases > .ui-as-empty { top: 84px; }
}
@container ui-as (max-width: 900px) {
  .ui-ev__head { padding-left: 52px; }
  .ui-ev__meta { display: none; }
}
@container ui-as (max-width: 600px) {
  /* Title next to the sidebar icon, version, model and Run on a row below */
  /* The 20px title in the middle of a head row – on the sidebar icon's centerline */
  .ui-ev__head { flex-wrap: wrap; row-gap: 10px; height: auto; padding: calc((var(--as-head-h, 48px) - 20px) / 2) 8px 12px 52px; }
  .ui-ev__path { line-height: 20px; }
  /* Version, model and Run share the second row, so Run doesn't sit alone on a third one */
  .ui-ev__title { display: contents; }
  .ui-ev__title h1 { width: 100%; margin-right: 0; }
  .ui-ev__head { column-gap: 8px; }
  .ui-ev__chip:not(.ui-ev__chip--btn) { flex: 1 1 0; max-width: max-content; }
  .ui-ev__actions { margin-left: auto; }
  .ui-ev__content { gap: 8px; padding: 8px 8px 8px; }
}


/* Revenue dashboard: a header, then rows of white cards on the panel */
.ui-as-rev { display: flex; flex-direction: column; min-height: 100%; }
/* The bar stays on top while the page scrolls under it */
.ui-as-rev__head { position: sticky; top: 0; z-index: 6; display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; background: var(--panel); }
.ui-as-rev__path { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: 13px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.ui-as-rev__path i { font-style: normal; color: var(--faint); }
.ui-as-rev__path b { font-weight: 500; color: var(--ink); }
.ui-as-rev__actions { display: flex; align-items: center; gap: 6px; }
.ui-as-rev__period { border-radius: calc(var(--aui-radius, 7px) + 2px); }

.ui-as-rev__content { display: flex; flex: 1; flex-direction: column; gap: 12px; padding: 0 16px 16px; }
.ui-as-rev__card {
  padding: 14px 16px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
/* Card titles: small and quiet, the figures carry the card */
.ui-as-rev__cap {
  align-self: flex-start;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--muted);
}

.ui-as-rev__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ui-as-rev__stat { display: flex; flex-direction: column; gap: 10px; }
.ui-as-rev__stat-row { display: flex; align-items: flex-end; justify-content: space-between; }
.ui-as-rev__stat strong {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ui-as-rev__stat em { font-size: 12px; font-style: normal; font-weight: 500; letter-spacing: 0; color: var(--aui-success, #1e8a4f); white-space: nowrap; }
.ui-as-rev__stat em[data-tone="bad"] { color: var(--aui-red, #f04438); }
.ui-as-rev__stat em[data-tone="flat"] { color: var(--muted); }
/* Long labels stay on one line – the full label on hover; figures never shorten, they wrap under each other */
.ui-as-rev__stat .ui-as-rev__cap { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-rev__stat strong { flex-wrap: wrap; min-width: 0; }
.ui-as-rev__minibars { flex: none; }
.ui-as-rev__minibars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.ui-as-rev__minibars i { width: 5px; border-radius: 2px; background: var(--line); }
.ui-as-rev__minibars i:last-child { background: var(--faint); }

.ui-as-rev__row { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: stretch; }
/* Every row as tall as its content – on a tall screen the room left over stays below the cards */
.ui-as-rev__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Library charts flat, with the same edge as the other cards */
.ui-as-rev .ui-as-rev__chart.ui-kpic {
  --ui-kpic-shadow: var(--card-shadow);
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
}

/* The charts' titles and figures in the same sizes as the stat cards above */
.ui-as-rev .ui-as-rev__chart .ui-kpic__title { font-size: 12.5px; font-weight: 400; line-height: 18px; color: var(--muted); }
.ui-as-rev .ui-as-rev__chart .ui-kpic__value { margin-top: 10px; font-size: 20px; line-height: 28px; }
.ui-as-rev .ui-as-rev__chart .ui-kpic__footer { font-size: 12px; }

/* Its plot fills the card next to the breakdown, at a steady height */
.ui-as-rev .ui-as-rev__chart--tall.ui-kpic { display: flex; flex-direction: column; }
.ui-as-rev .ui-as-rev__chart--tall .ui-kpic__chart { flex: 1; grid-template-rows: minmax(180px, 1fr) 20px; }

.ui-as-rev__breakdown { display: flex; flex-direction: column; }
.ui-as-rev__breakdown ul { display: flex; flex-direction: column; margin: 12px -6px 0; padding: 0; list-style: none; }
.ui-as-rev__breakdown li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  font-size: 13px;
}
.ui-as-rev__breakdown li:nth-child(even) { background: var(--hover); }
.ui-as-rev__breakdown li span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-as-rev__breakdown li b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.ui-as-rev__spark { width: 40px; height: 14px; overflow: visible; }
.ui-as-rev__spark polyline { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ui-as-rev__spark[data-tone="up"] polyline { stroke: var(--aui-success, #1e8a4f); }
.ui-as-rev__spark[data-tone="down"] polyline { stroke: var(--aui-red, #f04438); }
.ui-as-rev__spark[data-tone="flat"] polyline { stroke: var(--faint); }

.ui-as-rev__products { display: flex; flex-direction: column; gap: 14px; }
.ui-as-rev__product { display: flex; flex-direction: column; gap: 7px; }
.ui-as-rev__product > span { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.ui-as-rev__product-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-rev__product b { flex: none; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.ui-as-rev__product i { display: block; height: 6px; border-radius: 3px; background: var(--aui-blue, #4fb0fe); }

/* Empty: one empty state fills the page under the header; inside a card it sits in the card's middle */
.ui-as-rev__content > .ui-as-empty { flex: 1; justify-content: center; margin-top: 0; }
.ui-as-rev__card > .ui-as-empty[data-bare] { flex: 1; justify-content: center; padding: 20px 0; }

/* Loading: the same cards, rows and chart boxes with gray shapes in place of the figures – nothing moves when the data lands */
.ui-as-rev [data-skel] { pointer-events: none; }
/* A bar centered in the line it stands in for, at that line's own height */
.ui-as-rev__skel-line { display: flex; align-items: center; min-width: 0; height: 1lh; }
.ui-as-rev__skel-figure { position: relative; }
.ui-as-rev__skel-figure > span { visibility: hidden; }
.ui-as-rev__skel-figure > .ui-as-skel { position: absolute; top: 50%; left: 0; translate: 0 -50%; }
/* A KPI Chart's sizes: its padding, the figure's 28px line, a 124px plot (180px next to the breakdown) with 16px axis lines, the footer row */
.ui-as-rev__skel-chart { display: flex; flex-direction: column; padding: 0; container-type: inline-size; }
.ui-as-rev__skel-body { padding: 14px 16px 12px; }
.ui-as-rev__skel-title { margin: 0; overflow: hidden; font-size: 12.5px; font-weight: 400; line-height: 18px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ui-as-rev__skel-value { display: flex; margin: 10px 0 0; font-size: 20px; line-height: 28px; }
.ui-as-rev__skel-plotarea { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 124px 16px; column-gap: 10px; row-gap: 8px; margin-top: 20px; }
.ui-as-rev__skel-chart[data-tall] .ui-as-rev__skel-plotarea { grid-template-rows: minmax(180px, 1fr) 20px; }
.ui-as-rev__skel-yaxis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; margin: -8px 0; font-size: 11px; line-height: 16px; }
.ui-as-rev__skel-xaxis { position: relative; grid-column: 2; font-size: 11px; line-height: 16px; }
.ui-as-rev__skel-xaxis > span { position: absolute; top: 0; translate: -50% 0; }
.ui-as-rev__skel-xaxis > span:first-child { translate: none; }
.ui-as-rev__skel-xaxis > span:last-child { translate: -100% 0; }
.ui-as-rev__skel-foot { margin: 0; padding: 10px 16px; border-top: 0.5px solid var(--line); font-size: 12px; line-height: 16px; color: var(--muted); }
@container (max-width: 360px) {
  .ui-as-rev__skel-body { padding: 12px 12px 10px; }
  .ui-as-rev__skel-plotarea { grid-template-rows: 112px 16px; column-gap: 8px; }
  .ui-as-rev__skel-foot { padding: 10px 12px; }
}

/* Touch: the header buttons grow to a comfortable 32px */
@media (pointer: coarse) {
  .ui-as-rev__period { min-height: 32px; }
}

/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
.ui-as-rev__head { transition: padding-left 420ms var(--ease); }

/* Narrow panels: stat cards 4 → 2, the rows stack */
@container ui-as-main (max-width: 900px) {
  .ui-as-rev__row { grid-template-columns: minmax(0, 1fr); }
  .ui-as-rev__row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-as-rev__row--3 > .ui-as-rev__products { grid-column: 1 / -1; }
}
@container ui-as-main (max-width: 820px) {
  .ui-as-rev__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container ui-as-main (max-width: 560px) {
  .ui-as-rev__row--3 { grid-template-columns: minmax(0, 1fr); }
  .ui-as-rev__stats { gap: 8px; }
  .ui-as-rev__stat { gap: 10px; padding: 12px; }
  .ui-as-rev__stat strong { flex-wrap: wrap; gap: 0 6px; font-size: 19px; }
  .ui-as-rev__minibars { display: none; }
}
@container ui-as (max-width: 900px) {
  .ui-as-rev__head { padding-left: 52px; }
}
@container ui-as (max-width: 600px) {
  /* Title next to the sidebar icon, on its centerline (the 20px title in the middle of a head row); the actions on a row below */
  .ui-as-rev__head { flex-wrap: wrap; row-gap: 10px; height: auto; padding: calc((var(--as-head-h, 48px) - 20px) / 2) 8px 12px 52px; }
  .ui-as-rev__path { line-height: 20px; }
  .ui-as-rev__actions { flex-wrap: wrap; gap: 6px 4px; width: calc(100% + 44px); margin-left: -44px; }
  .ui-as-rev__actions > :last-child { margin-left: auto; }
  .ui-as-rev__actions button { white-space: nowrap; }
  .ui-as-rev__content { gap: 8px; padding: 0 8px 8px; }
}


/* Integrations – centered column, two-column rows grouped in sections */

.ui-as-integrations {
  width: min(957px, calc(100% - 64px));
  margin: 0 auto;
  padding: 40px 0 64px;
}
.ui-as-integrations__bar {
  position: sticky;
  top: 0;
  z-index: 5;
  /* A little wider than the column, so nothing scrolling underneath peeks out at its sides */
  /* More room above once it sticks to the top edge; the margin keeps the resting position as before */
  margin: 14px -16px 0;
  padding: 26px 16px 12px;
  background: var(--panel);
}
/* Soft fade below the bar, so rows dissolve instead of being cut by a line */
.ui-as-integrations__bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 32px;
  background: linear-gradient(to bottom, var(--panel), transparent);
  pointer-events: none;
}

.ui-as-int-section { margin-top: 38px; }
.ui-as-int-section + .ui-as-int-section { margin-top: 46px; }
.ui-as-int-section__title {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}

.ui-as-int-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 32px;
  margin-top: 12px;
}

.ui-as-int-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  transition: background-color 140ms ease;
}
.ui-as-int-row:hover { background: var(--subtle); }

/* Logo tile: brand color behind white marks, or white with a thin edge */
.ui-as-int-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as-int-logo svg { width: 17px; height: 17px; }
/* No logo: the first letter instead */
.ui-as-int-logo__letter { font-size: 13px; line-height: 1; font-weight: 500; color: var(--text); }
.ui-as-int-logo__letter[data-tile] { color: #fff; }
.ui-as-int-more__logos .ui-as-int-logo__letter { font-size: 10px; }

.ui-as-int-row__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ui-as-int-row__name { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 14px; line-height: 19px; font-weight: 500; color: var(--ink); }
/* Clip with a little margin, so letters that reach past their box are not cut */
.ui-as-int-row__label { overflow: clip; overflow-clip-margin: 2px; min-width: 0; white-space: nowrap; text-overflow: ellipsis; }
.ui-as-int-row__badge { display: grid; flex: none; color: var(--faint); }
.ui-as-int-row__desc { overflow: hidden; font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

.ui-as-int-add {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 3px);
  background: var(--card);
  box-shadow: var(--card-shadow);
  color: var(--text);
  transition: box-shadow 140ms ease, background-color 160ms ease, color 160ms ease;
}
.ui-as-int-add:hover { box-shadow: 0 0 0 1px var(--line-strong), var(--shadow); color: var(--ink); }
.ui-as-int-add svg:not(.ui-as-spin) { animation: ui-as-pop 260ms var(--ease); }
/* Connected: a dark tile with a check */
.ui-as-int-add[data-state="on"] { background: var(--ink); box-shadow: none; color: var(--on-ink); }
.ui-as-int-add[data-state="on"]:hover { background: var(--ink-hover); color: var(--on-ink); }
.ui-as-int-empty { margin-top: 24px; }

/* Loading: the same sections, grid and 58px rows, with gray bars centered in each text line */
.ui-as [data-skel] { pointer-events: none; }
/* The title's 20px line, the bar centered in it */
.ui-as-int-skel-title { display: flex; align-items: center; height: 20px; }
.ui-as-int-skel-text { gap: 0; }
.ui-as-int-skel-text > :first-child { margin: 4.5px 0; }
.ui-as-int-skel-text > :last-child { margin: 7px 0 5px; }

.ui-as-request { width: 260px; padding: 14px; }
.ui-as-request form { display: grid; gap: 6px; }
.ui-as-request b { font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-as-request form > span { font-size: 12.5px; color: var(--muted); }
/* The tool name: the library's Text Field */
.ui-as-request__field { margin: 6px 0 4px; }

/* Touch: the connect buttons and Request grow to a comfortable 32px */
@media (pointer: coarse) {
  .ui-as-int-add { width: 32px; height: 32px; }
}

/* "… and more" with three logos stacked like a pill */
.ui-as-int-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin-top: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: calc(var(--aui-radius, 7px) + 3px);
  font-size: 13px;
  color: var(--text);
  transition: background-color 140ms ease;
}
.ui-as-int-more:hover { background: var(--chip); }
.ui-as-int-more > svg { color: var(--faint); }
.ui-as-int-more__logos {
  display: flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-as-int-more__logos .ui-as-int-logo { width: 20px; height: 20px; border-radius: 6px; box-shadow: 0 0 0 0.5px var(--line-strong); }
.ui-as-int-more__logos .ui-as-int-logo + .ui-as-int-logo { margin-left: 3px; }
.ui-as-int-more__logos .ui-as-int-logo svg { width: 12px; height: 12px; }

/* Narrow panels: one column of rows, the bar wraps */
@container ui-as-main (max-width: 760px) {
  .ui-as-int-grid { grid-template-columns: minmax(0, 1fr); }
}
@container ui-as (max-width: 900px) {
  .ui-as-integrations { width: calc(100% - 48px); }
}
@container ui-as (max-width: 600px) {
  .ui-as-integrations { width: calc(100% - 32px); padding: 52px 0 48px; }
  .ui-as-integrations__bar { margin: 8px -12px 0; padding: 18px 12px 10px; }
  .ui-as-int-section { margin-top: 30px; }
  .ui-as-int-section + .ui-as-int-section { margin-top: 36px; }
  .ui-as-int-more { flex-wrap: wrap; text-align: left; }
  /* Tabs and Request on one line, the search below */
  .ui-as-integrations__bar .ui-as-toolbar__right { display: contents; }
  .ui-as-integrations__bar .ui-as-anchor { margin-left: auto; }
}




/* Settings / General – rows in cards like Settings / Profile, the company context as a field of its own */
.ui-sg { max-width: 760px; margin: 0 auto; }

.ui-sg-head { margin-top: 36px; }
.ui-sg-head h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sg-head p { max-width: 620px; margin: 2px 0 0; font-size: 13px; line-height: 20px; color: var(--muted); }

.ui-sg-card { position: relative; margin-top: 12px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-as-page-sub + .ui-sg-card { margin-top: 24px; }

.ui-sg-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 60px; padding: 10px 12px 10px 16px; }
.ui-sg-row + .ui-sg-row { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sg-label { display: grid; min-width: 0; }
.ui-sg-label b { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sg-label small { font-size: 12px; line-height: 16px; color: var(--muted); }
/* Long names, addresses and links wrap instead of pushing the control out */
.ui-sg-label b, .ui-sg-label small { overflow-wrap: anywhere; }
/* Buttons never squeeze into an ellipsis next to a long label */
.ui-sg-row > :is(button, .ui-buttonc, .ui-as-anchor), .ui-sg-control > :is(button, .ui-buttonc) { flex: none; }
.ui-sg-control { display: flex; flex: none; align-items: center; gap: 8px; min-width: 0; }

/* Fields: the library's Text Field at a fixed width – 32px, a hairline that only firms up on focus (no ring) */
.ui-sg-field { flex: none; width: 260px; }

/* The icon: the first letter until there is a picture; a small × to remove it */
.ui-sg-icon { position: relative; display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--logo-bg, #fff); box-shadow: inset 0 0 0 0.5px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.06); font-size: 14px; font-weight: 500; color: var(--ink); }
.ui-sg-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.ui-sg-icon__remove { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--card); box-shadow: var(--card-shadow); color: var(--muted); }
.ui-sg-icon__remove:hover { color: var(--ink); }
/* A 32px target around the small × */
.ui-sg-icon__remove::before { content: ""; position: absolute; inset: -7px; }
.ui-sg-icon__remove:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; box-shadow: var(--card-shadow); color: var(--ink); }

/* Company context: a calm writing field; a count and a button to give it more room */

/* Danger zone: the same card, the action in red; confirming asks for the name */
.ui-sg-danger { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border-radius: calc(var(--aui-radius, 7px) + 1px); box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--aui-red, #f04438) 35%, transparent); font-size: 13px; font-weight: 500; color: var(--aui-red, #f04438); transition: background-color 140ms ease, opacity 140ms ease; }
.ui-sg-danger:hover { background: color-mix(in srgb, var(--aui-red, #f04438) 6%, transparent); }
.ui-sg-danger:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; box-shadow: inset 0 0 0 0.5px rgba(220, 38, 38, 0.35); }
.ui-sg-danger--solid { padding: 0 12px; background: var(--aui-red, #f04438); box-shadow: none; color: #fff; }
.ui-sg-danger--solid:hover { background: var(--aui-danger, #c4320a); }
.ui-sg-danger:disabled { opacity: 0.4; cursor: default; }
.ui-sg-danger--solid:disabled:hover { background: var(--aui-red, #f04438); }
.ui-sg-confirm { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 12px 12px 14px 16px; box-shadow: inset 0 0.5px 0 var(--line); animation: ui-as-rise 260ms var(--ease) both; }
.ui-sg-confirm label { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.ui-sg-confirm b { font-weight: 500; color: var(--ink); }
:where(.dark, [data-theme="dark"]) .ui-sg-danger:not(.ui-sg-danger--solid) { color: var(--aui-red, #ff6b5f); }

/* A list that lost its last focusable row takes the focus itself – ringed like a field */
.ui-sg-card[tabindex="-1"]:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; box-shadow: var(--card-shadow); }

/* Narrow: each control goes under its label, full width */
@container ui-as-main (max-width: 600px) {
  .ui-sg-row, .ui-sg-confirm { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .ui-sg-field { width: 100%; }
  .ui-sg-danger { justify-content: center; }
  .ui-sg-confirm .ui-sg-control > * { flex: 1; justify-content: center; }
}


/* Settings / Teams */
.ui-smb { max-width: 880px; margin: 0 auto; }
.ui-smb-tabs { margin-top: 24px; }
.ui-smb-panel { display: flex; flex-direction: column; animation: ui-as-rise 380ms var(--ease) both; }

/* Three numbers in one card, split by hairlines */
.ui-smb-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-smb-stats > div { display: grid; gap: 2px; padding: 14px 16px; }
.ui-smb-stats > div + div { box-shadow: inset 0.5px 0 0 var(--line); }
.ui-smb-stats span { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-smb-stats b { font-size: 20px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--strong); }
.ui-smb-stats b i { font-size: 13px; font-style: normal; font-weight: 400; color: var(--muted); }
.ui-smb-stats small { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-smb-seats { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--chip); overflow: hidden; }
.ui-smb-seats i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* A note in the accent's tint, its link underlined */
.ui-smb-note { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; padding: 10px 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--accent-soft); font-size: 13px; line-height: 20px; color: var(--accent); }
.ui-smb-note svg { flex: none; margin-top: 2px; }
.ui-smb-note button { font-weight: 500; color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.ui-smb-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 28px; }
.ui-smb-toolbar__end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ui-smb-count { font-size: 13px; color: var(--muted); }

.ui-smb-invite { width: 300px; padding: 14px; }
.ui-smb-invite form { display: grid; gap: 6px; }
.ui-smb-invite b { font-size: 13px; font-weight: 500; color: var(--strong); }
.ui-smb-invite form > span:not([class]) { font-size: 12px; color: var(--muted); }
/* The email: the library's Text Field */
.ui-smb-field { margin-top: 6px; }
.ui-smb-invite__roles { display: flex; gap: 4px; margin: 4px 0 6px; padding: 2px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--chip); }
.ui-smb-invite__roles button { flex: 1; height: 26px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 12px; color: var(--muted); }
.ui-smb-invite__roles button[aria-checked="true"] { background: var(--card); box-shadow: var(--card-shadow); color: var(--ink); }
.ui-smb-invite__roles button:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; box-shadow: var(--card-shadow); }

/* Bulk bar for picked rows */
.ui-smb-bulk { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 6px 6px 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); box-shadow: inset 0 0 0 0.5px var(--line); font-size: 13px; animation: ui-as-rise 260ms var(--ease) both; }
/* Its menu opens over the table, not under it */
.ui-smb-bulk { position: relative; z-index: 11; }
.ui-smb-bulk b { margin-right: 6px; font-weight: 500; color: var(--strong); }
.ui-smb-bulk__btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) - 1px); background: var(--card); box-shadow: var(--card-shadow); font-size: 13px; color: var(--ink); }
.ui-smb-bulk__btn[data-danger] { color: var(--aui-red, #f04438); }
.ui-smb-bulk__clear { margin-left: auto; height: 28px; padding: 0 8px; border-radius: calc(var(--aui-radius, 7px) - 1px); font-size: 13px; color: var(--muted); }
.ui-smb-bulk__clear:hover { background: var(--hover); color: var(--ink); }

/* The table: one card, rows split by hairlines */
.ui-smb-table { margin-top: 12px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-smb-tr { display: grid; grid-template-columns: 36px minmax(0, 1fr) 120px 110px 120px 36px; align-items: center; gap: 8px; min-height: 56px; padding: 0 10px 0 14px; transition: background-color 140ms ease; }
.ui-smb-tr + .ui-smb-tr { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-smb-tr:not(.ui-smb-tr--head):hover, .ui-smb-tr[data-picked] { background: var(--hover); }
.ui-smb-tr--head { min-height: 40px; font-size: 12px; color: var(--muted); }
.ui-smb-tr > span { display: flex; align-items: center; min-width: 0; }
/* Checkboxes: the library's Checkbox */

.ui-smb-person { gap: 10px; }
.ui-smb-person__text { display: grid; flex: 1; min-width: 0; }
.ui-smb-person__text b { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); white-space: nowrap; }
.ui-smb-person__text b > span { overflow: hidden; text-overflow: ellipsis; }
.ui-smb-person__text b > :is(i, em) { flex: none; }
.ui-smb-team .ui-smb-person__text b { display: block; overflow: hidden; text-overflow: ellipsis; }
.ui-smb-person__text b i { font-style: normal; font-weight: 400; color: var(--muted); }
.ui-smb-person__text b em { margin-left: 4px; padding: 1px 6px; border-radius: calc(var(--aui-radius-sm, 5px) - 1px); background: var(--chip); font-size: 11px; font-style: normal; font-weight: 500; color: var(--muted); }
.ui-smb-person__text small { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-smb-avatar { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: hsl(var(--h) 70% 94%); font-size: 11px; font-weight: 500; color: hsl(var(--h) 45% 38%); }
:where(.dark, [data-theme="dark"]) .ui-smb-avatar { background: hsl(var(--h) 30% 22%); color: hsl(var(--h) 60% 78%); }

/* Role and plan: quiet buttons that open a menu */
.ui-smb-pick { display: inline-flex; align-items: center; gap: 6px; height: 28px; margin-left: -8px; padding: 0 8px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font-size: 13px; color: var(--text); transition: background-color 140ms ease, color 140ms ease; }
.ui-smb-pick:hover, .ui-smb-pick[aria-expanded="true"] { background: var(--chip); color: var(--ink); }
.ui-smb-pick:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; }
.ui-smb-pick svg { color: var(--muted); }
.ui-smb-pick--chip { height: 24px; margin-left: 0; padding: 0 6px 0 8px; gap: 4px; background: var(--chip); font-size: 12px; font-weight: 500; }
.ui-smb-pick--chip[data-plan="Business"] { background: var(--accent-soft); color: var(--accent); }
.ui-smb-pick--chip[data-plan="Business"] svg { color: inherit; }

.ui-smb-usage { gap: 8px; }
.ui-smb-usage__bar { display: block; flex: none; width: 56px; height: 4px; border-radius: 2px; background: var(--chip); overflow: hidden; }
.ui-smb-usage__bar i { display: block; height: 100%; border-radius: inherit; background: var(--faint); }
.ui-smb-usage__bar[data-high] i { background: #d97506; }
.ui-smb-usage small { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
/* Empty: in the table's place, at its distance */
.ui-smb .ui-as-empty { margin-top: 12px; }

/* Teams */
.ui-smb-team { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 10px 0 14px; }
.ui-smb-team + .ui-smb-team { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-smb-team:hover { background: var(--hover); }
.ui-smb-team__mark { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--chip); font-size: 12px; font-weight: 500; color: var(--text); }
.ui-smb-faces { display: flex; align-items: center; }
.ui-smb-faces .ui-smb-avatar { width: 26px; height: 26px; box-shadow: 0 0 0 2px var(--card); }
.ui-smb-faces .ui-smb-avatar + .ui-smb-avatar { margin-left: -6px; }
.ui-smb-faces__more { margin-left: 6px; font-size: 12px; color: var(--muted); }

/* Loading: the same stats, table and team rows, gray shapes in place of the data – faces overlap like the real ones */
.ui-smb [data-skel] { pointer-events: none; }
.ui-smb-skel-face { box-shadow: 0 0 0 2px var(--card); }
.ui-smb-skel-face + .ui-smb-skel-face { margin-left: -6px; }
/* Where the row's ⋯ sits */
.ui-smb-skel-more { flex: none; width: 28px; }

/* Narrow: search on its own line, plan and usage give way */
@container ui-as-main (max-width: 760px) {
  .ui-smb-stats { grid-template-columns: minmax(0, 1fr); }
  .ui-smb-stats > div + div { box-shadow: inset 0 0.5px 0 var(--line); }
  .ui-smb-toolbar { flex-wrap: wrap; }
  .ui-smb-toolbar .ui-as-search { flex: 1 1 100%; width: auto !important; order: -1; }
  .ui-smb-tr { grid-template-columns: 28px minmax(0, 1fr) 92px 36px; }
  .ui-smb-tr > :nth-child(4), .ui-smb-tr > :nth-child(5) { display: none; }
}


.ui-sm .ui-sg-card + .ui-sg-card { margin-top: 8px; }
.ui-sm-mark { display: grid; flex: none; place-items: center; width: 15px; height: 15px; }
.ui-sm-mark svg { width: 100%; height: 100%; }

/* The model pickers: the model's mark in front */
/* Model and access: the library's Select at a fixed width */
.ui-sm-pick { width: 200px; }

/* How Auto works: a gray block inside the card, the pick sliding between three providers */
.ui-sm-auto { display: flex; align-items: center; gap: 32px; margin: 0 12px 12px 16px; padding: 18px 20px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); }
.ui-sm-auto__text { flex: 1; min-width: 0; }
.ui-sm-auto__text b { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sm-auto__text p { max-width: 400px; margin: 2px 0 10px; font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-sm-auto__text ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ui-sm-auto__text li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; line-height: 18px; color: var(--text, var(--ink)); }
.ui-sm-auto__text li svg { flex: none; color: var(--muted); }
/* The Model Wheel: shorter than on its own, the model in the middle on a white card */
.ui-sm-wheel { flex: none; width: 240px; margin: -14px 0; }
.ui-sm-wheel .ui-mw { height: 196px; --ui-mw-fill: var(--card); --ui-mw-ink: var(--strong); --ui-mw-mark: var(--strong); --ui-mw-muted: var(--faint); }
.ui-sm-wheel .ui-mw-fill { box-shadow: var(--card-shadow); }
.ui-sm-wheel .ui-mw-row { font-size: 14px; }
.ui-sm-wheel .ui-mw-row svg { width: 16px; height: 16px; }
.ui-sm-auto + .ui-sg-row { box-shadow: inset 0 0.5px 0 var(--line); }
/* Loading: a gray wheel at the wheel's height – the pick in the middle, a model above and below */
.ui-sm-skel-wheel { display: grid; place-content: center stretch; justify-items: center; gap: 22px; height: 196px; }

/* Filter, search and add in one bar */
.ui-sm-bar { display: flex; align-items: center; gap: 8px; margin-top: 36px; }
.ui-sm-bar > :first-child { margin-right: auto; }
/* Nothing to list: the empty state at the regions' distance */
.ui-sm .ui-sm-bar + .ui-as-empty { margin-top: 20px; }
/* Search: the library's Text Field with a search icon; × and Esc clear it */
.ui-sm-search { flex: none; width: 220px; }

/* A custom model: name and endpoint side by side */
.ui-sm-form { display: grid; gap: 2px; margin-top: 12px; padding: 14px 12px 12px 16px; }
.ui-sm-form > b { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sm-form > span { font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-sm-form__fields { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ui-sm-form__fields .ui-sg-field { flex: 1; width: auto; min-width: 0; }

/* Regions, then a card per provider that folds open */
.ui-sm-region { margin-top: 28px; }
.ui-sm-region__head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sm-region__head > svg { flex: none; color: var(--muted); }
.ui-sm-region__head small { margin-left: 2px; font-size: 12px; font-weight: 400; color: var(--faint); }
.ui-sm-flag { flex: none; width: 18px; height: 13px; border-radius: 3px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.1); }
.ui-sm-provider__head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 0 14px 0 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); text-align: left; }
.ui-sm-provider__head b { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 500; color: var(--strong); }
.ui-sm-provider__head > svg { flex: none; color: var(--faint); transition: rotate 260ms var(--ease); }
.ui-sm-provider[data-open] .ui-sm-provider__head > svg { rotate: 180deg; }
.ui-sm-provider__head:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; }
.ui-sm-logo svg { width: 15px; height: 15px; }
.ui-sm-models { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 320ms var(--ease); }
.ui-sm-models > div { min-height: 0; overflow: hidden; }
.ui-sm-provider[data-open] .ui-sm-models { grid-template-rows: 1fr; }
.ui-sm-model { min-height: 56px; box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sm-model .ui-sg-label b { display: flex; align-items: center; gap: 6px; }
.ui-sm-model .ui-ss-badge { font-size: 11px; line-height: 16px; }
.ui-sm-model[data-off] .ui-sg-label { opacity: 0.5; transition: opacity 200ms ease; }
.ui-sm-access { width: 150px; }

.ui-sm-added { flex: none; font-size: 12px; color: var(--faint); white-space: nowrap; }
.ui-tfc__input.ui-sm-keyfield { font-family: var(--aui-font-mono, var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace)); }

@container ui-as-main (max-width: 600px) {
  .ui-sm-auto { flex-direction: column; align-items: stretch; gap: 16px; margin: 0 14px 12px; }
  .ui-sm-wheel { width: auto; margin: 0; }
  .ui-sm-pick { width: 100%; }
  .ui-sm-bar { flex-wrap: wrap; }
  .ui-sm-bar > :first-child { margin-right: 0; width: 100%; }
  .ui-sm-search { flex: 1; width: auto; }
  .ui-sm-form__fields { flex-direction: column; align-items: stretch; }
  .ui-sm-model .ui-sg-control { justify-content: space-between; }
  .ui-sm-region__head small { display: none; }
  /* A key row keeps the provider and the key; when it was added gives way */
  .ui-sm-added { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-sm-models { transition: none; }
}


/* The table's head: small gray labels; "Notify on" sets every row at once */
.ui-sn-thead { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 40px; padding: 0 12px 0 16px; font-size: 12px; color: var(--muted); }
.ui-sn-all { display: inline-flex; align-items: center; gap: 4px; width: 176px; height: 28px; margin-right: -6px; padding: 0 6px; border-radius: calc(var(--aui-radius-sm, 5px) + 1px); font: inherit; font-size: 12px; color: var(--muted); text-align: left; transition: background-color 140ms ease, color 140ms ease; }
.ui-sn-all:hover, .ui-sn-all[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.ui-sn-all:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; color: var(--ink); }
.ui-sn-thead + .ui-sg-row { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sn-type { min-height: 56px; }

/* The channel per row: its icon, its name – inbox only reads quieter */
/* Channel and time: the library's Select at a fixed width */
.ui-sn-select { width: 176px; }
.ui-sn .ui-sg-row .ui-as-menu { min-width: 190px; }

.ui-sn-time { width: 112px; font-variant-numeric: tabular-nums; }
.ui-sn-dash { color: var(--faint); }

@container ui-as-main (max-width: 600px) {
  .ui-sn-thead__label { display: none; }
  .ui-sn-thead { justify-content: flex-end; padding: 0 14px; }
  .ui-sn-all { width: auto; margin-right: -6px; }
  .ui-sn-select { width: 100%; }
  .ui-sn-time { flex: 1; width: auto; }
}


.ui-spf-gap { margin-top: 12px; }
.ui-spf .ui-sg-label b { display: flex; align-items: center; gap: 6px; }
.ui-spf-beta { font-size: 11px; line-height: 16px; }

/* The nudge back to Auto: a gray block inside the card */
.ui-spf-nudge { display: flex; align-items: center; gap: 14px; margin: 0 12px 12px 16px; padding: 14px 14px 14px 16px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); }
.ui-spf-nudge .ui-sg-label { flex: 1; }
.ui-spf-nudge__mark { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--card); box-shadow: var(--card-shadow); color: var(--strong); }
.ui-spf-nudge + .ui-sg-row { box-shadow: inset 0 0.5px 0 var(--line); }

.ui-spf-lang { width: 160px; }

/* Chat tools: three tiles that check on and off */
.ui-spf-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ui-spf-tool { display: grid; gap: 2px; padding: 12px 14px 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); text-align: left; color: var(--muted); transition: box-shadow 160ms ease; }
.ui-spf-tool:hover { box-shadow: var(--card-shadow-hover, var(--card-shadow)); }
.ui-spf-tool:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; box-shadow: var(--card-shadow); }
.ui-spf-tool__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ui-spf-tool b { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-spf-tool small { font-size: 12px; line-height: 16px; }
.ui-spf-check { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-strong); color: #fff; transition: background-color 160ms ease, box-shadow 160ms ease; }
.ui-spf-tool[aria-checked="true"] .ui-spf-check { background: var(--switch-on); box-shadow: none; }
.ui-spf-tool[aria-checked="true"] .ui-spf-tool__top > svg { color: var(--strong); }
:where(.dark, [data-theme="dark"]) .ui-spf-tool[aria-checked="true"] .ui-spf-check { color: #fff; }

/* Custom instructions: two writing fields under the switch; paused, they fade */
.ui-spf-fields { display: grid; gap: 14px; padding: 12px 12px 14px 16px; box-shadow: inset 0 0.5px 0 var(--line); transition: opacity 200ms ease; }
.ui-spf-fields[data-off] { opacity: 0.45; }
/* About you and How it should answer: the library's Text Area */

/* Memory */
.ui-spf-note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-spf-note svg { flex: none; margin-top: 1.5px; color: var(--faint); }
.ui-spf-memory .ui-sg-label b { display: block; font-weight: 400; color: var(--ink); }

@container ui-as-main (max-width: 600px) {
  .ui-spf-tools { grid-template-columns: 1fr; }
  /* The nudge: mark and text side by side, the button on its own line under the text */
  .ui-spf-nudge { flex-wrap: wrap; align-items: flex-start; margin: 0 14px 12px; }
  .ui-spf-nudge .ui-sg-label { flex: 1 1 calc(100% - 46px); }
  .ui-spf-nudge > .ui-buttonc { margin-left: 46px; }
  .ui-spf-lang { width: 100%; }
  .ui-spf-fields { padding: 12px 14px 14px; }
  .ui-spf-memory { flex-direction: row; align-items: center; }
}


.ui-spv-link { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.ui-spv-link:hover { text-decoration-color: currentColor; }

/* This browser's cookies: a gray panel inside the card */
.ui-spv-cookies { display: grid; margin: 0 12px 12px 16px; padding: 4px 14px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); }
.ui-spv-cookie { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.ui-spv-cookie + .ui-spv-cookie { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-spv-always { flex: none; font-size: 12px; color: var(--faint); }

/* Sessions and shared chats: a tile, two lines, an action */
.ui-spv-session, .ui-spv-chat { min-height: 60px; }
.ui-spv-session .ui-sg-label b, .ui-spv-chat .ui-sg-label b { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; min-width: 0; }
.ui-spv-session .ui-ss-domain__name, .ui-spv-chat .ui-ss-domain__name { flex: 1; }
/* A device's name wraps – the badge follows it onto the next line */
.ui-spv-session .ui-sg-label b { overflow: visible; white-space: normal; }
.ui-spv-chat .ui-sg-label b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-spv-session .ui-ss-badge { font-size: 11px; line-height: 16px; }
.ui-spv-tile { width: 32px; height: 32px; border-radius: 9px; }
.ui-spv-chat small { display: flex; flex-wrap: wrap; align-items: center; column-gap: 4px; }
.ui-spv-views { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-spv-chat small svg { color: var(--faint); }

.ui-spv-tabs { margin-top: 12px; }
.ui-spv-tabs + .ui-sg-card, .ui-spv .ui-spv-tabs + .ui-as-empty { margin-top: 8px; }

@container ui-as-main (max-width: 600px) {
  .ui-spv-cookies { margin: 0 14px 12px; }
  .ui-spv-session, .ui-spv-chat { flex-direction: row; align-items: center; }
  /* Copy link shrinks to its icon so the title keeps its room */
  .ui-spv .ui-sg-control > .ui-spv-copy { width: 30px; padding: 0; justify-content: center; }
  .ui-spv-copy .ui-buttonc__label { display: none; }
}


/* Loading: the same cards and rows, gray shapes in place of the data – nothing moves when it lands */
.ui-as [data-skel] { pointer-events: none; }
.ui-sp-skel-line { display: flex; align-items: center; min-width: 0; max-width: 100%; }
.ui-sp-skel-line--inline { display: inline-flex; vertical-align: top; }
.ui-sp-skel-control { display: flex; flex: none; height: 32px; max-width: 100%; }
.ui-sp-skel-control--button { height: 24px; }
.ui-sp-skel-switch { display: flex; flex: none; width: 32px; height: 20px; }
@media (pointer: coarse) {
  .ui-sp-skel-control { height: 38px; }
  .ui-sp-skel-control--button { height: 32px; }
  .ui-sp-skel-switch { width: 40px; height: 24px; }
}
.ui-sp-skel-ghost { position: relative; display: inline-flex; flex: none; vertical-align: top; }
/* In running text: the control stays inline, so the line keeps its height */
.ui-sp-skel-ghost--inline { display: inline-block; vertical-align: baseline; }
.ui-sp-skel-ghost > :not(.ui-as-skel, style) { visibility: hidden; }
.ui-sp-skel-ghost__fill { position: absolute; inset: 0; }
/* A text area: the empty field keeps its size, the lines sit where its text starts */
.ui-sp-skel-area { position: relative; }
.ui-sp-skel-area__lines { position: absolute; top: 7px; right: 40px; left: 10px; display: grid; }
.ui-sp-skel-area[data-labelled] .ui-sp-skel-area__lines { top: 33px; }
.ui-sp-skel-area .ui-tac__count, .ui-sp-skel-area .ui-tac__expand { visibility: hidden; }
/* Narrow: a switch stays next to its label, like the real one */
@container ui-as-main (max-width: 600px) {
  .ui-sg-row:has(> .ui-sp-skel-switch) { flex-direction: row; align-items: center; }
}


/* Settings / Profile – rows in cards, the label on the left and its control on the right */
.ui-sp { max-width: 760px; margin: 0 auto; }

/* A quiet note on the faint frame */
.ui-sp-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 0;
  padding: 10px 12px;
  border-radius: var(--aui-radius-lg, 10px);
  background: var(--frame);
  box-shadow: inset 0 0 0 0.5px var(--line);
  font-size: 13px;
  line-height: 20px;
  color: var(--text);
}
.ui-sp-note svg { flex: none; color: var(--muted); }

.ui-sp-head { margin-top: 36px; }
.ui-sp-head h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sp-head p { margin: 2px 0 0; font-size: 13px; line-height: 20px; color: var(--muted); }

.ui-sp-card { position: relative; margin-top: 12px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-sp-note + .ui-sp-card { margin-top: 16px; }
.ui-sp-card--alone { margin-top: 24px; }

.ui-sp-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 60px; padding: 10px 12px 10px 16px; }
.ui-sp-row + .ui-sp-row { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sp-label { display: grid; min-width: 0; }
.ui-sp-label b { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sp-label b, .ui-sp-label small { overflow-wrap: anywhere; }
.ui-sp-label small { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); text-overflow: ellipsis; }
.ui-sp-control { display: flex; flex: none; align-items: center; gap: 8px; min-width: 0; }
.ui-sp-row > :is(.ui-buttonc, .ui-as-anchor), .ui-sp-control > .ui-buttonc { flex: none; }

/* Text fields and selects are the library's Text Field and Select, at a fixed width here */
.ui-sp-field { flex: none; width: 240px; }
.ui-sp-field--quiet { width: 200px; }

/* The picture: initials until there is one; a small × to remove it */
.ui-sp-avatar { position: relative; display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); font-size: 13px; font-weight: 500; color: var(--accent); }
.ui-sp-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.ui-sp-avatar__remove { position: absolute; top: -3px; right: -3px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--card); box-shadow: var(--card-shadow); color: var(--muted); }
.ui-sp-avatar__remove:hover { color: var(--ink); }
/* A 32px target around the small × */
.ui-sp-avatar__remove::before { content: ""; position: absolute; inset: -7px; }
.ui-sp-avatar__remove:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; box-shadow: var(--card-shadow); color: var(--ink); }

/* Personal context: the library's Text Area */

/* Narrow: each control goes under its label, full width */
@container ui-as-main (max-width: 600px) {
  .ui-sp-row { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .ui-sp-field { width: 100%; }
  .ui-sp-control { flex: 1; }
  .ui-sp-control .ui-sp-field { flex: 1; width: auto; min-width: 0; }
}


/* Section heads with their action on the right */
.ui-ss-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.ui-ss-head > button { flex: none; }
.ui-sg-head + .ui-sg-card + .ui-sg-card { margin-top: 8px; }

/* Domains and ranges: a white tile, the name, a quiet badge – a × on hover */
.ui-ss-domain { min-height: 52px; }
.ui-ss-domain__name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ui-ss-domain__name b { overflow: hidden; font-size: 13px; font-weight: 500; color: var(--strong); white-space: nowrap; text-overflow: ellipsis; }
.ui-ss-tile { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--logo-bg, #fff); box-shadow: inset 0 0 0 0.5px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.05); color: var(--muted); }
.ui-ss-badge { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--chip); font-size: 11.5px; line-height: 18px; font-weight: 500; color: var(--muted); }
.ui-ss-badge[data-tone="ok"] { background: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent); color: var(--aui-success, #1e8a4f); }
:where(.dark, [data-theme="dark"]) .ui-ss-badge[data-tone="ok"] { background: color-mix(in srgb, var(--aui-green, #7dcf9f) 12%, transparent); color: var(--aui-green, #5fc88a); }
.ui-ss-remove { flex: none; width: 28px; height: 28px; opacity: 0; transition: opacity 140ms ease; }
.ui-ss-domain:hover .ui-ss-remove, .ui-ss-remove:focus-visible { opacity: 1; }
@media (hover: none) { .ui-ss-remove { opacity: 1; } }
.ui-ss-range { flex: none; white-space: nowrap; font-family: var(--aui-font-mono, var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace)); font-size: 12.5px; color: var(--strong); }
/* Empty lists: the App Shell's empty state in the card's place, at the card's distance */
.ui-ss .ui-as-empty { margin-top: 12px; }
.ui-ss .ui-as-empty + .ui-sg-card { margin-top: 8px; }
.ui-ss-skel-btn { margin-top: 18px; }
.ui-ss-dns { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 16px 12px; box-shadow: inset 0 0.5px 0 var(--line); font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-ss-dns svg { flex: none; margin-top: 2px; color: var(--faint); }
.ui-ss-dns code { padding: 1px 5px; border-radius: var(--aui-radius-sm, 5px); background: var(--chip); font-family: var(--aui-font-mono, var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace)); font-size: 11.5px; color: var(--ink); white-space: nowrap; }
.ui-ss-add .ui-sg-field { flex: 1; width: auto; max-width: 320px; }
.ui-sg-row + .ui-ss-add, .ui-ss-domain + .ui-ss-add { box-shadow: inset 0 0.5px 0 var(--line); }


/* Switches – the Onboarding's; a row whose switch is off-limits fades */
/* A 44 × 32 target around the 32 × 20 track */
.ui-sg-row[data-disabled] { opacity: 0.5; }

/* Select and read-only fields */
/* Session length: the library's Select at a fixed width */
.ui-ss-select { width: 160px; }
.ui-ss .ui-sg-row .ui-as-menu { min-width: 180px; }
.ui-ss-readonly { width: 220px; }

.ui-ss-rise { animation: ui-as-rise 260ms var(--ease) both; }

@container ui-as-main (max-width: 600px) {
  .ui-ss-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .ui-ss-domain { flex-direction: row; align-items: center; }
  .ui-ss-select, .ui-ss-readonly { width: 100%; }
  .ui-sg-row:has(> .ui-swc) { flex-direction: row; align-items: center; }
  .ui-ss-add .ui-sg-field { max-width: none; }
  /* Read-only values take the room their Copy button leaves */
  .ui-sg-control > .ui-ss-readonly { flex: 1; width: auto; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-ss-rise { animation-duration: 1ms; }
}


/* Settings / Billing */
.ui-sb2 { max-width: 880px; margin: 0 auto; }
.ui-sb2-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ui-sb2-docs { display: inline-flex; flex: none; align-items: center; gap: 4px; min-height: 28px; margin-top: 2px; font-size: 13px; color: var(--text); text-decoration: none; }
.ui-sb2-docs:hover { color: var(--ink); }
.ui-sb2-muted { color: var(--muted); }
.ui-sb2-link { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; font-size: 13px; color: var(--text); }
.ui-sb2-link:hover { color: var(--ink); }
.ui-sb2-link svg { color: var(--faint); transition: rotate 220ms var(--ease); }
.ui-sb2-link[aria-expanded="true"] svg { rotate: 180deg; }
.ui-sb2-tag { display: inline-flex; flex: none; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--aui-radius-sm, 5px); background: var(--chip); font-size: 11.5px; font-weight: 500; color: var(--text); }
.ui-sb2-tag[data-tone="paid"] { background: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent); color: var(--aui-success, #1e8a4f); }
:where(.dark, [data-theme="dark"]) .ui-sb2-tag[data-tone="paid"] { background: color-mix(in srgb, var(--aui-green, #7dcf9f) 14%, transparent); color: var(--aui-green, #5fc88a); }

.ui-sb2-head { margin-top: 44px; }
.ui-sb2-head h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--strong); }
.ui-sb2-head p { margin: 2px 0 0; font-size: 13px; line-height: 20px; color: var(--muted); }
.ui-sb2-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }

/* ----- The current plan: a card on the soft frame, the usage below it ----- */
.ui-sb2-overview { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); margin-top: 28px; padding: 3px; border-radius: calc(var(--aui-radius-lg, 10px) + 4px); background: var(--frame); box-shadow: inset 0 0 0 0.5px var(--line); }
.ui-sb2-overview__main, .ui-sb2-overview__bill { display: flex; flex-direction: column; justify-content: space-between; gap: 20px; padding: 18px 20px; background: var(--card); }
.ui-sb2-overview__main { align-items: flex-start; border-radius: calc(var(--aui-radius-lg, 10px) + 1px) 0 0 calc(var(--aui-radius-lg, 10px) + 1px); box-shadow: var(--card-shadow); }
.ui-sb2-overview__bill { gap: 2px; border-radius: 0 calc(var(--aui-radius-lg, 10px) + 1px) calc(var(--aui-radius-lg, 10px) + 1px) 0; box-shadow: var(--card-shadow), inset 0.5px 0 0 var(--line); }
.ui-sb2-plan { display: flex; align-items: center; gap: 12px; }
.ui-sb2-plan__mark, .ui-sb2-tray__mark { display: grid; flex: none; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.ui-sb2-plan b { display: block; font-size: 15px; line-height: 22px; font-weight: 500; color: var(--strong); }
.ui-sb2-plan small { font-size: 13px; color: var(--muted); }
.ui-sb2-bill__head { display: flex; align-items: center; gap: 6px; }
.ui-sb2-bill__head b { font-size: 14px; font-weight: 500; color: var(--strong); }
.ui-sb2-bill__head svg { color: var(--faint); }
.ui-sb2-overview__bill > small { font-size: 13px; color: var(--muted); }
.ui-sb2-bill__row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 20px; }
.ui-sb2-bill__total { font-size: 22px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--strong); }
.ui-sb2-bill__lines { display: grid; gap: 6px; margin: 12px 0 0; padding-top: 12px; box-shadow: inset 0 0.5px 0 var(--line); font-size: 12.5px; animation: ui-as-rise 300ms var(--ease) both; }
.ui-sb2-bill__lines div { display: flex; justify-content: space-between; gap: 12px; }
.ui-sb2-bill__lines dt { color: var(--muted); }
.ui-sb2-bill__lines dd { margin: 0; font-variant-numeric: tabular-nums; color: var(--ink); }

.ui-sb2-usage { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; padding: 16px 18px 14px; }
.ui-sb2-usage__item { display: grid; gap: 8px; min-width: 0; }
.ui-sb2-usage__head { display: flex; align-items: center; gap: 6px; height: 24px; color: var(--muted); }
.ui-sb2-usage__head b { font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-sb2-usage__head span { display: grid; color: var(--faint); }
.ui-sb2-usage__head .ui-as-icon-btn { width: 24px; height: 24px; margin-left: auto; }
.ui-sb2-usage__value { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); }
.ui-sb2-usage__value b { font-weight: 500; color: var(--ink); }
.ui-sb2-usage__bar { display: block; height: 4px; border-radius: 2px; background: var(--chip); overflow: hidden; }
.ui-sb2-usage__bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 600ms var(--ease); }
.ui-sb2-usage__bar[data-high] i { background: #e8740e; }

/* ----- Plans: one soft tray, white cards inside ----- */
.ui-sb2-tray { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; padding: 16px; border-radius: calc(var(--aui-radius-lg, 10px) + 6px); background: var(--frame); box-shadow: inset 0 0 0 0.5px var(--line); }
.ui-sb2-tray__head { display: flex; align-items: center; gap: 12px; padding: 2px 2px 4px; }
.ui-sb2-tray__head--addon { margin-top: 12px; padding-top: 20px; box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sb2-tray__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--card); box-shadow: var(--card-shadow); }
.ui-sb2-tray__head small { display: block; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-sb2-tray__head b { font-size: 15px; line-height: 22px; font-weight: 500; color: var(--strong); }
.ui-sb2-tray__end { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 13px; }

.ui-sb2-current { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-sb2-current > b { font-size: 15px; font-weight: 500; color: var(--strong); }
.ui-sb2-current__price { margin-left: auto; font-size: 13px; color: var(--muted); }
.ui-sb2-current__price b { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--strong); }

.ui-sb2-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ui-sb2-card { position: relative; display: flex; flex-direction: column; padding: 18px 20px 20px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); overflow: hidden; }
/* The suggested plan: an accent hairline and a soft glow rising from its bottom edge, like the Gradient Floor –
   two blurred lights in the accent and a violet that drift slowly against each other */
.ui-sb2-card[data-pick] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow); }
.ui-sb2-card[data-pick]::before,
.ui-sb2-card[data-pick]::after {
  content: "";
  position: absolute;
  bottom: -46%;
  width: 80%;
  height: 70%;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.17;
  pointer-events: none;
  animation: ui-sb2-drift 14s ease-in-out infinite alternate;
}
.ui-sb2-card[data-pick]::before { left: -14%; background: var(--accent); }
.ui-sb2-card[data-pick]::after { right: -18%; background: var(--aui-purple, #a651f0); opacity: 0.13; animation-delay: -7s; }
@keyframes ui-sb2-drift { from { translate: -8% 6%; scale: 0.92; } to { translate: 10% -4%; scale: 1.08; } }
:where(.dark, [data-theme="dark"]) .ui-sb2-card[data-pick]::before { opacity: 0.15; }
:where(.dark, [data-theme="dark"]) .ui-sb2-card[data-pick]::after { opacity: 0.11; }
@media (prefers-reduced-motion: reduce) { .ui-sb2-card[data-pick]::before, .ui-sb2-card[data-pick]::after { animation: none; } }
/* Content above the glow */
.ui-sb2-card > * { position: relative; z-index: 1; }
.ui-sb2-card h3 { margin: 0; font-size: 15px; line-height: 22px; font-weight: 500; color: var(--strong); }
.ui-sb2-card__blurb { margin: 2px 0 0; font-size: 13px; line-height: 19px; color: var(--muted); }
.ui-sb2-card__price { margin-top: 16px; font-size: 26px; line-height: 32px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--strong); animation: ui-as-rise 320ms var(--ease) both; }
.ui-sb2-card__price--quiet { margin-top: 4px; color: var(--muted); }
.ui-sb2-card > small { font-size: 12.5px; }
.ui-sb2-card__lead { margin-top: 16px; font-size: 13px; color: var(--muted); }
.ui-sb2-card ul { display: grid; gap: 8px; margin: 14px 0 20px; padding: 0; list-style: none; }
.ui-sb2-card li { display: flex; gap: 9px; font-size: 13px; line-height: 19px; color: var(--text); }
.ui-sb2-check { display: grid; flex: none; place-items: center; width: 16px; height: 16px; margin-top: 1.5px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.ui-sb2-check svg { stroke-width: 2.2; }
.ui-sb2-check[data-limited] { color: var(--muted); }
.ui-sb2-card li b { font-weight: 500; color: var(--ink); }
.ui-sb2-card > .ui-buttonc { width: 100%; margin-top: auto; }
.ui-sb2-select { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 32px; margin-top: 14px; padding: 0 10px; border-radius: calc(var(--aui-radius, 7px) + 1px); background: var(--card); box-shadow: inset 0 0 0 0.5px var(--line-strong); font-size: 13px; color: var(--ink); }
.ui-sb2-select svg { color: var(--faint); }
.ui-sb2-select[aria-expanded="true"] { box-shadow: inset 0 0 0 0.5px var(--line-strong), 0 0 0 3px var(--accent-soft); }
.ui-sb2-select:focus-visible { outline: 2px solid var(--ui-as-focus); outline-offset: 2px; }
.ui-sb2-card > .ui-as-anchor { display: flex; }
/* A menu in a card is at least as wide as its field – the trigger's width, from the Dropdown Menu */
.ui-sb2-card .ui-dmc__panel { min-width: var(--ui-dmc-trigger-w); }

.ui-sb2-byok { margin: 0; padding: 0 2px; font-size: 13px; }
.ui-sb2-byok a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.ui-sb2-enterprise { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-sb2-enterprise span { display: grid; flex: 1; min-width: 0; }
.ui-sb2-enterprise b { font-size: 15px; font-weight: 500; color: var(--strong); }
.ui-sb2-enterprise small { font-size: 13px; color: var(--muted); }
.ui-sb2-compare-toggle { align-self: flex-start; padding: 0 2px; }
.ui-sb2-compare { border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); animation: ui-as-rise 320ms var(--ease) both; }
.ui-sb2-compare__row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); align-items: center; gap: 12px; min-height: 40px; padding: 0 18px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.ui-sb2-compare__row + .ui-sb2-compare__row { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sb2-compare__row--head { font-weight: 500; color: var(--strong); }
.ui-sb2-compare__row > [role="rowheader"] { color: var(--muted); }

/* ----- Billing details ----- */
.ui-sb2-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.ui-sb2-box { display: flex; flex-direction: column; padding: 16px 18px 18px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-sb2-box header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ui-sb2-box header span { display: grid; }
.ui-sb2-box header b { font-size: 14px; font-weight: 500; color: var(--strong); }
.ui-sb2-box header small { font-size: 12.5px; color: var(--muted); }
.ui-sb2-facts { display: grid; gap: 10px; margin: 16px 0 0; font-size: 13px; }
.ui-sb2-facts div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
.ui-sb2-facts dt { color: var(--muted); }
.ui-sb2-facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.ui-sb2-facts dd[data-empty] { color: var(--faint); }
.ui-sb2-form { display: grid; gap: 10px; margin-top: 14px; animation: ui-as-rise 260ms var(--ease) both; }
.ui-sb2-form__end { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.ui-sb2-card-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px; border-radius: var(--aui-radius-lg, 10px); background: var(--frame); box-shadow: inset 0 0 0 0.5px var(--line); }
.ui-sb2-card-row > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.ui-sb2-card-row b { font-size: 13px; font-weight: 500; color: var(--strong); }
.ui-sb2-card-row small { font-size: 12px; color: var(--muted); }
.ui-sb2-visa { display: grid; flex: none; place-items: center; width: 40px; height: 26px; border-radius: 5px; background: #1a1f71; font-size: 10px; font-weight: 700; font-style: italic; letter-spacing: 0.02em; color: #fff; }
.ui-sb2-box__note { display: flex; align-items: center; gap: 6px; margin: auto 0 0; padding-top: 16px; font-size: 12px; }
.ui-sb2-box__note svg { flex: none; color: var(--faint); }

/* ----- History ----- */
.ui-sb2 .ui-sb2-head + .ui-as-empty { margin-top: 14px; }
.ui-sb2-history { margin-top: 14px; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); }
.ui-sb2-history__row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 120px; align-items: center; gap: 12px; min-height: 48px; padding: 0 10px 0 18px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); }
.ui-sb2-history__row + .ui-sb2-history__row { box-shadow: inset 0 0.5px 0 var(--line); }
.ui-sb2-history__row > :first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-sb2-history__end .ui-as-icon-btn { flex: none; }
.ui-sb2-history__row--head { min-height: 40px; font-size: 12px; color: var(--muted); }
.ui-sb2-history__row[data-upcoming] { color: var(--muted); }
.ui-sb2-history__end { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }

/* Loading: the same areas and rows, gray shapes in place of the data – nothing moves when it lands */
.ui-sb2 [data-skel] { pointer-events: none; }
/* Where a row's icon button sits */
.ui-sb2-skel-icon { flex: none; width: 28px; }

.ui-sb2-cancel { display: inline-flex; margin-top: 32px; }
.ui-sb2-confirm { display: grid; gap: 6px; width: 300px; padding: 14px; }
.ui-sb2-confirm b { font-size: 13px; font-weight: 500; color: var(--strong); }
.ui-sb2-confirm > span:not([class]) { font-size: 12.5px; line-height: 18px; color: var(--muted); }

/* Narrow: everything in one column */
@container ui-as-main (max-width: 760px) {
  .ui-sb2-overview { grid-template-columns: minmax(0, 1fr); }
  .ui-sb2-overview__main { border-radius: calc(var(--aui-radius-lg, 10px) + 1px) calc(var(--aui-radius-lg, 10px) + 1px) 0 0; }
  .ui-sb2-overview__bill { border-radius: 0 0 calc(var(--aui-radius-lg, 10px) + 1px) calc(var(--aui-radius-lg, 10px) + 1px); box-shadow: var(--card-shadow), inset 0 0.5px 0 var(--line); }
  .ui-sb2-usage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-sb2-head--row { flex-direction: column; align-items: flex-start; }
  .ui-sb2-cards, .ui-sb2-details { grid-template-columns: minmax(0, 1fr); }
  .ui-sb2-tray { padding: 12px; }
  .ui-sb2-tray__end .ui-sb2-muted { display: none; }
  .ui-sb2-current { flex-wrap: wrap; }
  .ui-sb2-enterprise { flex-direction: column; align-items: flex-start; }
  .ui-sb2-compare__row { padding: 0 12px; font-size: 12px; }
  /* Fixed columns so every row lines up; the upcoming row already says "Upcoming", so its tag gives way */
  .ui-sb2-history__row { grid-template-columns: minmax(0, 1fr) 88px 72px; }
  .ui-sb2-history__row[data-upcoming] .ui-sb2-tag { display: none; }
  .ui-sb2-history__row[data-upcoming] .ui-sb2-skel-tag { display: none; }
  .ui-sb2-history__row > :nth-child(3) { display: none; }
}


/* Onboarding – a quiet column on the left (greeting, steps, help), the current step on the right */

.ui-onb-bar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; height: var(--as-head-h, 48px); padding: 0 12px 0 20px; background: var(--panel); transition: padding-left 420ms var(--ease); }
.ui-onb-path { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ui-onb-path i { font-style: normal; color: var(--faint); }
.ui-onb-path b { font-weight: 500; color: var(--ink); }

.ui-onb {
  --ui-onb-focus: var(--aui-focus, rgba(0, 96, 226, 0.7));
  display: grid;
  grid-template-columns: 248px minmax(0, 600px);
  grid-template-areas: "aside card";
  justify-content: center;
  align-items: start;
  column-gap: 64px;
  padding: 16px 40px 64px;
}
.ui-onb-card { grid-area: card; min-width: 0; }
.ui-onb-aside { grid-area: aside; position: sticky; top: 76px; display: flex; flex-direction: column; gap: 20px; }

.ui-onb-kicker { display: block; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.ui-onb-title { margin: 6px 0 0; font-size: 20px; line-height: 26px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); overflow-wrap: anywhere; }
.ui-onb-sub { margin: 4px 0 0; font-size: 13px; line-height: 19px; color: var(--muted); }
.ui-onb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The step: flat on the page – a kicker, a title, a line of text, then its content */
.ui-onb-form { display: grid; }
.ui-onb-step { animation: ui-onb-in-next 380ms var(--ease) both; }
.ui-onb-step[data-dir="back"] { animation-name: ui-onb-in-back; }
@keyframes ui-onb-in-next { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes ui-onb-in-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.ui-onb-step__head { margin-bottom: 20px; }
.ui-onb-step__title { overflow-wrap: anywhere; margin: 6px 0 0; font-size: 22px; line-height: 30px; font-weight: 500; letter-spacing: -0.02em; color: var(--strong); }
.ui-onb-step__text { margin: 4px 0 0; font-size: 13px; line-height: 20px; color: var(--muted); }

/* Actions under the step, on the page – no tray */
.ui-onb-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.ui-onb-foot__actions { display: flex; gap: 8px; }
.ui-onb-skip { font-size: 13px; color: var(--muted); transition: color 140ms ease; }
.ui-onb-skip:hover { color: var(--ink); }

/* Fields */
.ui-onb-fields { display: grid; gap: 20px; }
/* One column that never grows past the card, even for a chip with a long address */
.ui-onb-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; min-width: 0; }
.ui-onb-label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.ui-onb-hint { font-size: 12.5px; line-height: 17px; color: var(--muted); }
.ui-onb-hint b, .ui-onb-text b { font-weight: 500; color: var(--text); }

/* Tools: a list of rows, each with a switch */
/* Tools: one white card, a row per tool with its switch */
.ui-onb-tools { display: grid; margin: 0; padding: 4px 0; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); list-style: none; }
.ui-onb-tool {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 14px;
  animation: ui-onb-rise 380ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.ui-onb-tool + .ui-onb-tool { box-shadow: inset 0 1px 0 var(--line-soft, var(--line)); }
@keyframes ui-onb-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ui-onb-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 1px 1.5px rgba(0, 0, 0, 0.08);
  color: var(--ink);
}
.ui-onb-logo svg { width: 15px; height: 15px; }
.ui-onb-tool__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ui-onb-tool__name { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.ui-onb-tool__state {
  padding: 1px 7px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 1px);
  background: color-mix(in srgb, var(--aui-green, #5fc88a) 10%, transparent);
  font-size: 11.5px;
  line-height: 16px;
  font-weight: 500;
  color: var(--aui-success, #1e8a4f);
  animation: ui-onb-fade 240ms ease both;
}
@keyframes ui-onb-fade { from { opacity: 0; } }
.ui-onb-tool__desc { overflow: hidden; font-size: 12.5px; line-height: 18px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

.ui-onb-spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: ui-onb-spin 700ms linear infinite;
}
@keyframes ui-onb-spin { to { transform: rotate(360deg); } }

/* Invites: chips in a field, the role next to it, a link below */
.ui-onb-invite-row { display: flex; align-items: flex-start; gap: 8px; }
.ui-onb-invites { flex: 1; min-width: 0; }
/* A long address ends in an ellipsis instead of wrapping out of the chip */
.ui-onb-role { height: 36px; min-width: 104px; justify-content: space-between; border-radius: calc(var(--aui-radius, 7px) + 3px); }
.ui-onb-role > svg { color: var(--faint); }

.ui-onb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  background: var(--card);
  box-shadow: var(--card-shadow);
}
.ui-onb-link__icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--text); }
.ui-onb-link__text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.ui-onb-link__text b { font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-onb-link__text span { overflow: hidden; font-size: 12.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

/* Templates: three cards to pick from */
.ui-onb-templates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ui-onb-template {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 14px 13px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  /* Gray until picked – the picked one lifts out as a white card */
  background: var(--frame);
  box-shadow: none;
  text-align: left;
  transition: box-shadow 200ms ease, background-color 200ms ease;
  animation: ui-onb-rise 380ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.ui-onb-template:hover { background: var(--hover); }
.ui-onb-template[aria-checked="true"] { background: var(--card); box-shadow: var(--card-shadow-hover); }
.ui-onb-template:focus-visible { outline: 2px solid var(--ui-onb-focus); outline-offset: 2px; }
:where(.dark, [data-theme="dark"]) .ui-onb { --ui-onb-focus: var(--aui-focus, rgba(77, 141, 255, 0.8)); }
/* Headings take focus when a step opens – no ring for that, it is not something to act on */
.ui-onb-step__title:focus { outline: none; }
.ui-onb-template__top { display: flex; align-self: stretch; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.ui-onb-template__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--ink); }
/* On the gray card the icon sits on white; on the picked white card it turns gray */
.ui-onb-template:not([aria-checked="true"]) .ui-onb-template__icon { background: var(--card); box-shadow: inset 0 0 0 0.5px var(--line); }
.ui-onb-template__check {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: transparent;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}
.ui-onb-template[aria-checked="true"] .ui-onb-template__check { background: var(--ink); box-shadow: none; color: var(--on-ink); }
.ui-onb-template__name { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.ui-onb-template__text { font-size: 12.5px; line-height: 18px; color: var(--muted); }
.ui-onb-template__meta { margin-top: auto; padding-top: 10px; font-size: 12px; line-height: 16px; color: var(--faint); }

/* Finished */
.ui-onb-success { animation: ui-onb-in-next 420ms var(--ease) both; }
.ui-onb-success__body { padding: 0; }
.ui-onb-success__badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 0 16px;
  border-radius: 50%;
  background: var(--aui-success, #1e8a4f);
  animation: ui-as-pop 360ms var(--ease) both;
}
.ui-onb-success__badge svg { width: 18px; height: 18px; fill: none; stroke: var(--on-ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ui-onb-success__badge path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ui-onb-draw 420ms var(--ease) 220ms forwards; }
@keyframes ui-onb-draw { to { stroke-dashoffset: 0; } }
.ui-onb-next { display: grid; margin: 20px 0 0; padding: 4px 0; border-radius: calc(var(--aui-radius-lg, 10px) + 2px); background: var(--card); box-shadow: var(--card-shadow); list-style: none; }
.ui-onb-next li + li { box-shadow: inset 0 1px 0 var(--line-soft, var(--line)); }
.ui-onb-next li { animation: ui-onb-rise 380ms var(--ease) both; animation-delay: calc(200ms + var(--i, 0) * 50ms); }
.ui-onb-next__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 14px;
  text-align: left;
  transition: background-color 140ms ease;
}
.ui-onb-next__item:hover { background: var(--hover); }
.ui-onb-next__item > svg { color: var(--faint); transition: translate 200ms var(--ease), color 140ms ease; }
.ui-onb-next__item:hover > svg { color: var(--ink); translate: 2px 0; }
.ui-onb-next__icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--ink); }
.ui-onb-next__text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.ui-onb-next__text b { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.ui-onb-next__text span { font-size: 12.5px; line-height: 18px; color: var(--muted); }

/* Checklist beside the card */
/* The steps in the left column: a thin bar and the count, then the list – no box around it */
.ui-onb-check { display: flex; flex-direction: column; gap: 10px; }
.ui-onb-check__head { display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.ui-onb-check__count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-onb-check__count span { display: inline-block; color: var(--ink); animation: ui-onb-rise 360ms var(--ease); }
.ui-onb-check__bar { display: block; height: 3px; overflow: hidden; border-radius: 999px; background: var(--chip); }
.ui-onb-check__bar i { display: block; height: 100%; border-radius: inherit; background: var(--ink); transform-origin: left; transition: transform 620ms var(--ease); }
.ui-onb-check__list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.ui-onb-check__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: calc(var(--aui-radius-sm, 5px) + 4px);
  text-align: left;
  transition: background-color 140ms ease;
}
.ui-onb-check__item:hover { background: var(--hover); }
.ui-onb-check__item[aria-current] { background: var(--hover); }
.ui-onb-check__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: var(--on-ink);
  transition: background-color 200ms ease, box-shadow 200ms ease;
}
.ui-onb-check__mark svg { animation: ui-as-pop 260ms var(--ease); }
.ui-onb-check__item[data-state="current"] .ui-onb-check__mark { box-shadow: inset 0 0 0 1.5px var(--ink); }
.ui-onb-check__item[data-state="done"] .ui-onb-check__mark { background: color-mix(in srgb, var(--ink) 9%, transparent); box-shadow: none; color: var(--ink); }
.ui-onb-check__item[data-state="skipped"] .ui-onb-check__mark { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.ui-onb-dash { display: block; width: 6px; height: 1.5px; border-radius: 1px; background: var(--faint); }
.ui-onb-check__text { display: grid; gap: 1px; min-width: 0; }
.ui-onb-check__label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.ui-onb-check__item[data-state="todo"] .ui-onb-check__label { color: var(--text); font-weight: 400; }
.ui-onb-check__item[data-state="done"] .ui-onb-check__label { color: var(--muted); }
.ui-onb-check__sub { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ui-onb-check__item[data-state="todo"] .ui-onb-check__sub { color: var(--faint); }

.ui-onb-help {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: calc(var(--aui-radius-lg, 10px) + 2px);
  text-align: left;
  transition: background-color 140ms ease;
}
.ui-onb-help:hover { background: var(--hover); }
.ui-onb-help__icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--text); }
.ui-onb-help > span:last-child { display: grid; gap: 1px; }
.ui-onb-help b { font-size: 13px; font-weight: 500; color: var(--ink); }
.ui-onb-help > span:last-child > span { font-size: 12px; color: var(--muted); }

/* Narrower panels: one column – the greeting and steps on top, the step below */
@container ui-as-main (max-width: 1000px) {
  .ui-onb {
    grid-template-columns: minmax(0, 600px);
    grid-template-areas: "aside" "card";
    row-gap: 28px;
    padding: 12px 32px 56px;
  }
  .ui-onb-aside { position: static; }
  .ui-onb-check__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-onb-help { display: none; }
}
@container ui-as-main (max-width: 620px) {
  .ui-onb-templates { grid-template-columns: minmax(0, 1fr); }
  .ui-onb-template__meta { padding-top: 6px; }
  .ui-onb-invite-row { flex-direction: column; align-items: stretch; }
  .ui-onb-role { width: 100%; }
  .ui-onb-tool__desc { white-space: normal; }
  .ui-onb-tool { padding-top: 8px; padding-bottom: 8px; }
}
@container ui-as (max-width: 600px) {
  .ui-onb { padding: 8px 16px 40px; }
  .ui-onb-step__title { font-size: 20px; line-height: 26px; }
  .ui-onb-check__list { grid-template-columns: minmax(0, 1fr); }
  .ui-onb-link .ui-buttonc { flex: none; }
}

/* Room for the sidebar icon on narrow screens, where the sidebar is a drawer */
@container ui-as (max-width: 900px) {
  .ui-onb-bar { padding-left: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-onb *, .ui-onb *::before, .ui-onb *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .ui-onb-success__badge path { stroke-dashoffset: 0; }
}
/* Touch: the text buttons, the small buttons and the chip's remove grow to comfortable targets */
@media (pointer: coarse) {
  .ui-onb-skip { min-height: 32px; }
}


.ui-obw {
  --ui-obw-focus: rgba(0, 96, 226, 0.7);
  --obw-bg: #fff;
  --obw-ink: rgba(0, 0, 0, 0.88);
  --obw-muted: rgba(0, 0, 0, 0.61);
  --obw-faint: rgba(0, 0, 0, 0.45);
  --obw-line: rgba(0, 0, 0, 0.06);
  --obw-card: #fff;
  --obw-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 1px -1px rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --obw-shadow-firm: 0 0 0 0.5px rgba(0, 0, 0, 0.14), 0 1px 1px -1px rgba(0, 0, 0, 0.12), 0 2px 6px 0 rgba(0, 0, 0, 0.06);
  --obw-sk: rgba(0, 0, 0, 0.05);
  --obw-side: rgba(0, 0, 0, 0.018);
  --obw-page: #f8f8f8;
  --obw-dark: rgba(0, 0, 0, 0.88);
  --obw-on-dark: #fcfcfc;
  --obw-blue: var(--aui-blue, #0190fe);
  --obw-purple: var(--aui-purple, #a651f0);
  --obw-pink: var(--aui-pink, #ee3e9e);
  --obw-red: var(--aui-danger, #d93a2b);
  --obw-out: cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  container: ui-obw / inline-size;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--obw-bg);
  color: var(--obw-ink);
  font: 400 13px/20px var(--font-sans, "Inter", ui-sans-serif, system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
}
:where(.dark, [data-theme="dark"]) .ui-obw {
  --ui-obw-focus: rgba(77, 141, 255, 0.8);
  --obw-bg: #0f0f10;
  --obw-ink: rgba(255, 255, 255, 0.92);
  --obw-muted: rgba(255, 255, 255, 0.6);
  --obw-faint: rgba(255, 255, 255, 0.42);
  --obw-line: rgba(255, 255, 255, 0.07);
  --obw-card: #18181a;
  --obw-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --obw-shadow-firm: 0 0 0 0.5px rgba(255, 255, 255, 0.18), 0 2px 6px 0 rgba(0, 0, 0, 0.4);
  --obw-sk: rgba(255, 255, 255, 0.06);
  --obw-side: rgba(255, 255, 255, 0.015);
  --obw-page: #0e0e10;
  --obw-dark: rgba(255, 255, 255, 0.92);
  --obw-on-dark: #111;
  --obw-blue: var(--aui-blue, #4fb0fe);
  --obw-purple: var(--aui-purple, #b98af0);
  --obw-pink: var(--aui-pink, #f06db5);
  --obw-red: var(--aui-danger, #ff8a7a);
}
.ui-obw :focus-visible { outline: 2px solid var(--ui-obw-focus); outline-offset: 2px; }
:where(.ui-obw) button { font: inherit; color: inherit; cursor: pointer; }
:where(.ui-obw) button:disabled { cursor: default; }

/* ---------- Top bar & footer ---------- */
.ui-obw-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 24px; }
.ui-obw-logo { display: grid; place-items: center; margin-right: 4px; color: var(--obw-dark); }
.ui-obw-account { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--obw-faint); }
.ui-obw-account b { font-weight: 400; color: var(--obw-muted); }
.ui-obw-chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 8px; border: 0; border-radius: 6px;
  background: var(--obw-card); box-shadow: var(--obw-shadow); font-weight: 500; color: var(--obw-ink);
  transition: box-shadow 160ms ease;
}
.ui-obw-chip-btn svg { color: var(--obw-faint); }
.ui-obw-chip-btn:hover { box-shadow: var(--obw-shadow-firm); }
.ui-obw-foot { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 24px; font-size: 12px; line-height: 16px; color: var(--obw-faint); }
.ui-obw-foot a { color: inherit; text-decoration: none; }
.ui-obw-foot a:hover { color: var(--obw-muted); }

/* ---------- Layout: the step centered in the left half, the dashboard from the middle off the right edge ---------- */
.ui-obw-main { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; width: 50%; min-height: 0; padding: 24px 40px; }
/* Every step's content sits centered in the left half – a field or a form, its middle is the half's middle */
.ui-obw-step { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; width: 100%; min-width: 0; max-width: 440px; text-align: center; }
.ui-obw-preview {
  position: absolute; z-index: 0; top: 56px; bottom: 0; left: 50%; width: max(1088px, 70%);
  /* The mask cuts everything outside this box – the padding keeps the window's own stroke and shadow inside it */
  padding: 24px 0 0 8px; box-sizing: border-box;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 64%, transparent 96%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 64%, transparent 96%);
  pointer-events: none; user-select: none;
}

/* ---------- The step ---------- */
.ui-obw-steps { display: flex; gap: 4px; margin-bottom: 20px; }
.ui-obw-steps i { width: 16px; height: 3px; border-radius: 2px; background: var(--obw-line); }
.ui-obw-steps i[data-on] { background: var(--obw-dark); }
.ui-obw-title { margin: 0; font-size: 24px; font-weight: 500; line-height: 32px; letter-spacing: -0.24px; color: var(--obw-ink); text-wrap: balance; }
.ui-obw-sub { margin: 6px 0 0; color: var(--obw-muted); text-wrap: balance; }
.ui-obw-form { width: 100%; margin-top: 28px; }
.ui-obw-field { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); text-align: left; }
.ui-obw-boxwrap { position: relative; }
.ui-obw-glow {
  position: absolute; z-index: 0; inset: -14px -24px; border-radius: 40px; filter: blur(28px); opacity: 0.32;
  background:
    radial-gradient(40% 70% at 18% 60%, var(--obw-blue), transparent 70%),
    radial-gradient(40% 70% at 52% 50%, var(--obw-purple), transparent 70%),
    radial-gradient(40% 70% at 86% 45%, var(--obw-pink), transparent 70%);
  animation: ui-obw-drift 9s ease-in-out infinite alternate;
}
:where(.dark, [data-theme="dark"]) .ui-obw-glow { opacity: 0.22; }

/* Chips: centered under the field, one row of room so the step stays centered; no overflow, so no stroke is cut */
.ui-obw-chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 6px; min-height: 26px; margin: 10px 0 0; padding: 0; list-style: none; }
/* The hint hangs under the chips, outside the layout – it never pushes the step off center */
.ui-obw-field > .ui-obw-hint { position: absolute; top: 100%; right: 0; left: 0; }
.ui-obw-chip__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-obw-chip {
  max-width: 100%;
  display: inline-flex; flex: none; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 6px; border-radius: 7px;
  background: var(--obw-card); box-shadow: var(--obw-shadow); font-weight: 500; white-space: nowrap;
  animation: ui-obw-chip-in 360ms var(--obw-out) both;
}
/* Without a mark (names), the text keeps the same distance to the edge as the × on the other side */
.ui-obw-chip:not(:has(.ui-obw-mono)) { padding-left: 9px; }
.ui-obw-chip__x { display: grid; place-items: center; width: 18px; height: 18px; margin-left: -2px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--obw-faint); }
.ui-obw-chip__x:hover { background: var(--obw-line); color: var(--obw-ink); }
.ui-obw-chip__x:focus-visible { outline-offset: -2px; }
.ui-obw-mono { display: inline-grid; flex: none; place-items: center; border-radius: 4px; background: var(--obw-dark); color: var(--obw-on-dark); font-weight: 500; line-height: 1; }

.ui-obw-box {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 8px 0 14px; border-radius: 12px;
  background: var(--obw-card); box-shadow: var(--obw-shadow); transition: box-shadow 160ms ease;
}
.ui-obw-box:focus-within { box-shadow: var(--obw-shadow-firm); }
.ui-obw-input:focus-visible { outline: none; outline-offset: 0; }
.ui-obw-input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--obw-ink); }
.ui-obw-input::placeholder { color: var(--obw-faint); opacity: 0.7; }
.ui-obw-input[aria-invalid] { color: var(--obw-red); }
.ui-obw-btn {
  display: grid; flex: none; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: var(--obw-card); box-shadow: var(--obw-shadow); color: var(--obw-ink);
  transition: opacity 160ms ease, transform 160ms var(--obw-out), box-shadow 160ms ease;
}
.ui-obw-btn:hover:not(:disabled) { box-shadow: var(--obw-shadow-firm); }
.ui-obw-btn:active:not(:disabled) { transform: scale(0.94); }
.ui-obw-btn:disabled { opacity: 0.45; }
.ui-obw-btn--go { background: var(--obw-dark); color: var(--obw-on-dark); box-shadow: none; }
.ui-obw-btn--go:hover:not(:disabled) { box-shadow: none; opacity: 0.88; }
.ui-obw-hint { min-height: 16px; margin: 12px 0 0; font-size: 12px; line-height: 16px; color: var(--obw-faint); text-align: center; }
.ui-obw-hint[data-error] { color: var(--obw-red); }

/* ---------- The dashboard in placeholders ---------- */
/* Taller than the view: the camera moves it so the part a step fills sits in view */
.ui-obw-win {
  position: relative; display: flex; min-height: 100%; overflow: hidden; border-radius: 12px 0 0 0;
  background: var(--obw-page); box-shadow: var(--obw-shadow);
  transition: transform 1100ms cubic-bezier(0.65, 0, 0.35, 1); will-change: transform;
}
/* One slow light sweeping over it – it's loading, your answers fill it */
.ui-obw-win::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--obw-card) 70%, transparent) 50%, transparent 70%);
  transform: translateX(-100%); animation: ui-obw-sheen 3.2s ease-in-out 1.2s infinite;
}
.ui-obw-sk { display: block; flex: none; height: 8px; border-radius: 4px; background: var(--obw-sk); }
.ui-obw-sk--sq { width: 10px; height: 10px; border-radius: 3px; }
.ui-obw-side { display: grid; align-content: start; gap: 22px; width: 232px; flex: none; padding: 10px 12px; }
.ui-obw-ws {
  display: flex; align-items: center; gap: 8px; height: 32px; margin: 0 -4px; padding: 0 8px; border-radius: 8px;
  font-weight: 500; color: var(--obw-ink);
}
.ui-obw-ws[data-on] > .ui-obw-mono { animation: ui-obw-land 600ms var(--obw-out) both; }
.ui-obw-ws { min-width: 0; }
.ui-obw-ws__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; animation: ui-obw-chip-in 420ms var(--obw-out) both; }
.ui-obw-ws__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--obw-faint); opacity: 0.6; }
.ui-obw-nav { display: grid; gap: 12px; padding: 0 4px; }
.ui-obw-nav__row { display: flex; align-items: center; gap: 10px; }
/* Inset (default): the sidebar sits on the gray page, the main area is a rounded panel beside it */
.ui-obw-body { display: flex; flex: 1; flex-direction: column; min-width: 0; margin: 8px 0 8px 0; border-radius: 10px 0 0 10px; background: var(--obw-card); box-shadow: var(--obw-shadow); }
/* Flat: edge to edge – the sidebar tinted, a hairline between it and the main area */
:is(.ui-obw[data-layout="flat"], [data-shell="flat"] .ui-obw:not([data-layout="inset"])) .ui-obw-win { background: var(--obw-card); }
:is(.ui-obw[data-layout="flat"], [data-shell="flat"] .ui-obw:not([data-layout="inset"])) .ui-obw-side { background: var(--obw-side); box-shadow: inset -0.5px 0 0 var(--obw-line); }
:is(.ui-obw[data-layout="flat"], [data-shell="flat"] .ui-obw:not([data-layout="inset"])) .ui-obw-body { margin: 0; border-radius: 0; background: none; box-shadow: none; }
.ui-obw-bar { display: flex; align-items: center; gap: 12px; height: 48px; flex: none; padding: 0 16px; box-shadow: inset 0 -0.5px 0 var(--obw-line); color: var(--obw-faint); }
.ui-obw-bar__tools { display: flex; gap: 6px; margin-left: auto; }
.ui-obw-tool { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--obw-side); box-shadow: 0 0 0 0.5px var(--obw-line); }
.ui-obw-tabs { display: flex; gap: 8px; padding: 10px 16px; box-shadow: inset 0 -0.5px 0 var(--obw-line); }
.ui-obw-tab { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px 0 10px; border-radius: 7px; box-shadow: 0 0 0 0.5px var(--obw-line); }
.ui-obw-content { display: grid; gap: 28px; padding: 20px 16px 40px; }
.ui-obw-section { display: grid; gap: 14px; }
.ui-obw-head { display: grid; gap: 8px; min-height: 28px; align-content: start; }
.ui-obw-text { font-weight: 500; color: var(--obw-ink); white-space: nowrap; animation: ui-obw-chip-in 420ms var(--obw-out) both; }
.ui-obw-head__title { font-size: 14px; line-height: 12px; }
.ui-obw-bar__title { font-size: 13px; color: var(--obw-muted); }
.ui-obw-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ui-obw-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ui-obw-kpi { display: grid; align-content: start; gap: 14px; height: 82px; padding: 16px; }
/* Live: the numbers land one card after another */
.ui-obw-kpi__label { height: 8px; font-size: 12px; line-height: 8px; color: var(--obw-muted); animation: ui-obw-chip-in 420ms var(--obw-out) both; }
.ui-obw-kpi__value { display: inline-flex; align-items: center; gap: 6px; height: 16px; font-size: 18px; font-weight: 500; line-height: 16px; color: var(--obw-ink); font-variant-numeric: tabular-nums; animation: ui-obw-chip-in 520ms var(--obw-out) both; }
.ui-obw-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--aui-green, #5fc88a); animation: ui-obw-pulse 1.6s ease-in-out infinite; }
.ui-obw-tab__label { font-size: 12px; color: var(--obw-muted); }
.ui-obw-tab[data-on] { background: var(--obw-side); }
.ui-obw-tab[data-on] .ui-obw-tab__label { color: var(--obw-ink); }
/* Live: done loading – the sheen stops */
.ui-obw-win[data-live]::after { animation: none; opacity: 0; }
.ui-obw-card { border-radius: 10px; box-shadow: 0 0 0 0.5px var(--obw-line); overflow: hidden; }
.ui-obw-chart__label { display: flex; align-items: center; gap: 8px 16px; height: 36px; padding: 0 14px; box-shadow: inset 0 -0.5px 0 var(--obw-line); }
.ui-obw-chart__plot { display: flex; gap: 14px; height: 210px; padding: 14px 14px 12px; }
.ui-obw-chart__axis { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 4px; }
/* Bars: quiet gray, growing in one after another – big surfaces stay neutral, color is for small tags only */
.ui-obw-bars {
  display: flex; flex: 1; align-items: flex-end; gap: 6px; min-width: 0; padding-bottom: 4px;
  background: repeating-linear-gradient(to bottom, var(--obw-line) 0 1px, transparent 1px 25%);
}
.ui-obw-bars i {
  flex: 1; min-width: 0; border-radius: 3px 3px 1px 1px; background: var(--obw-sk);
  transform-origin: bottom; animation: ui-obw-bar 800ms var(--obw-out) both;
  transition: background-color 600ms ease;
}
/* The assistant's card: who it is, how it greets, what else it answers to – a fixed height, so nothing moves as it fills */
.ui-obw-agent { display: grid; gap: 14px; height: 168px; align-content: start; padding: 16px; }
.ui-obw-agent__who { display: flex; align-items: center; gap: 10px; height: 28px; min-width: 0; max-width: 420px; }
/* A long name ends in an ellipsis – the tag after it always stays */
.ui-obw-agent__who > .ui-obw-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-obw-agent__aka .ui-obw-tag { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
/* The agent mark: a 3×3 pixel pattern in the agent's color (blue unless told otherwise); a person is a full square in ink */
.ui-obw-agent-mark { --obw-mark: rgba(0, 96, 226, 0.78); display: grid; flex: none; grid-template-columns: repeat(3, 3px); grid-auto-rows: 3px; gap: 1.5px; place-content: center; width: 16px; height: 16px; }
:where(.dark, [data-theme="dark"]) .ui-obw-agent-mark { --obw-mark: rgba(77, 141, 255, 0.85); }
.ui-obw-agent-mark i { border-radius: 0.75px; background: var(--obw-mark); opacity: 0; transition: opacity 240ms ease; }
.ui-obw-agent-mark i[data-on] { opacity: 1; }
.ui-obw-agent-mark[data-full] i { background: var(--obw-ink); }
.ui-obw-agent-mark[data-busy] i { animation: ui-obw-pixel 1.2s ease-in-out infinite both; }
.ui-obw-agent-mark[data-busy] i:not([data-on]) { opacity: 0.16; }
.ui-obw-bubble { display: grid; align-content: center; gap: 8px; width: fit-content; max-width: 420px; min-height: 52px; padding: 10px 14px; border-radius: 4px 12px 12px 12px; background: var(--obw-side); box-shadow: 0 0 0 0.5px var(--obw-line); }
.ui-obw-bubble .ui-obw-sk { width: 320px; }
.ui-obw-say { color: var(--obw-ink); animation: ui-obw-chip-in 520ms var(--obw-out) both; }
/* The greeting keeps to two lines, so the card keeps its height with a long name */
.ui-obw-agent .ui-obw-say { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
/* The test chat: a customer's question on the right, the reply in the chosen tone, and who it hands over to */
/* The chat keeps to a column, so the customer's message on the right stays in view where the window runs off the edge */
.ui-obw-chat { display: grid; grid-template-columns: minmax(0, 400px); gap: 12px; height: 252px; align-content: start; padding: 16px; }
.ui-obw-chat__reply { display: grid; gap: 4px; min-width: 0; }
.ui-obw-chat__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 2px; font-size: 12px; font-weight: 500; line-height: 16px; color: var(--obw-muted); }
/* Both messages from the left, each after its sender's mark – so nothing hides where the window runs off the edge */
.ui-obw-chat__msg { display: flex; align-items: flex-start; gap: 10px; }
.ui-obw-chat__msg .ui-obw-agent-mark { margin-top: 10px; }
/* The reply has its name over it – its mark lines up with the bubble, not the name */
.ui-obw-chat__msg:has(.ui-obw-chat__reply) .ui-obw-agent-mark { margin-top: 30px; }
.ui-obw-chat__msg .ui-obw-bubble { min-height: 0; }
.ui-obw-bubble--q { background: var(--obw-card); box-shadow: var(--obw-shadow); color: var(--obw-ink); }
.ui-obw-chat__hand { display: flex; align-items: center; height: 20px; padding-left: 26px; font-size: 12px; color: var(--obw-faint); }
.ui-obw-chat__hand .ui-obw-tag { margin-left: 4px; vertical-align: middle; }
.ui-obw-agent__aka { display: flex; align-items: center; gap: 6px; height: 20px; }
.ui-obw-agent__label { margin-right: 2px; font-size: 12px; color: var(--obw-faint); }
.ui-obw-tag {
  display: inline-flex; flex: none; align-items: center; gap: 5px; height: 18px; padding: 0 6px; border-radius: 5px;
  background: var(--obw-line); color: var(--obw-muted); font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap;
  animation: ui-obw-chip-in 420ms var(--obw-out) both;
}
.ui-obw-agent__who .ui-obw-tag { margin-left: 2px; }
.ui-obw-tag--green { background: color-mix(in srgb, var(--aui-green, #5fc88a) 14%, transparent); color: var(--aui-success, #1e8a4f); }
:where(.dark, [data-theme="dark"]) .ui-obw-tag--green { color: var(--aui-success, #7dcf9f); }
.ui-obw-tag--blue { background: color-mix(in srgb, var(--obw-blue) 10%, transparent); color: var(--obw-blue); }
.ui-obw-tag__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: ui-obw-pulse 1.4s ease-in-out infinite; }
.ui-obw-tr { display: grid; grid-template-columns: 44px 200px 120px 1fr; height: 34px; box-shadow: inset 0 -0.5px 0 var(--obw-line); }
.ui-obw-tr[data-head] { height: 36px; background: var(--obw-side); }
.ui-obw-td { display: flex; align-items: center; gap: 8px; padding: 0 12px; box-shadow: inset -0.5px 0 0 var(--obw-line); }
.ui-obw-td:last-child { box-shadow: none; }
.ui-obw-td--dot { justify-content: center; padding: 0; }
.ui-obw-tr[data-filled] .ui-obw-td { animation: ui-obw-chip-in 420ms var(--obw-out) both; }
.ui-obw-tr[data-faint] .ui-obw-td { opacity: 0.45; }


/* Medium: less of the dashboard shows – its sidebar becomes a rail of icons, so the main area's content stays in view */
@container ui-obw (max-width: 1280px) {
  .ui-obw-side { width: 52px; padding: 10px 8px; }
  .ui-obw-ws { justify-content: center; margin: 0; padding: 0; }
  .ui-obw-ws > :not(:first-child), .ui-obw-nav > .ui-obw-sk, .ui-obw-nav__row > .ui-obw-sk:not(.ui-obw-sk--sq) { display: none; }
  .ui-obw-nav { justify-items: center; padding: 0; }
}

/* Narrow: the dashboard steps back behind the step and the step takes the width */
@container ui-obw (max-width: 900px) {
  /* Narrow (tablet and phone): no room beside the step – the dashboard steps aside, the step takes the width */
  .ui-obw-main { width: 100%; padding: 24px 20px; }
  .ui-obw-preview { display: none; }
  .ui-obw-account { display: none; }
  .ui-obw-top { padding: 0 16px; }
  .ui-obw-top > .ui-obw-chip-btn:last-child { margin-left: auto; }
  .ui-obw-foot { padding: 0 20px; }
}
/* Touch: 16px text in fields so iOS doesn't zoom in, and bigger targets for the small buttons */
@media (pointer: coarse) {
  .ui-obw input { font-size: 16px; }
  .ui-obw-box { height: 52px; }
  .ui-obw-btn { width: 36px; height: 36px; border-radius: 10px; }
  .ui-obw-chip { height: 32px; }
  .ui-obw-chip__x { width: 26px; height: 26px; }
  .ui-obw-chip-btn { height: 34px; }
}

@keyframes ui-obw-chip-in { from { opacity: 0; transform: translateY(4px) scale(0.96); filter: blur(2px); } }
@keyframes ui-obw-land { 0% { transform: scale(0.97); } 45% { transform: scale(1.02); } 100% { transform: none; } }
@keyframes ui-obw-sheen { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes ui-obw-bar { from { transform: scaleY(0); } }
@keyframes ui-obw-pulse { 50% { opacity: 0.35; } }
@keyframes ui-obw-pixel { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes ui-obw-drift { to { transform: translateX(12px) scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .ui-obw *, .ui-obw *::after { animation: none !important; transition: none !important; }
}


/* The form: no card – fields left-aligned under each other, the label on top, Continue across the column */
.ui-obt { display: grid; gap: 18px; text-align: left; }
.ui-obt-field { display: grid; gap: 8px; }
.ui-obt-label { display: grid; font-weight: 500; color: var(--obw-ink); }
.ui-obt-note { font-size: 12px; font-weight: 400; line-height: 16px; color: var(--obw-faint); }

.ui-obt-input { display: flex; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--obw-card); box-shadow: var(--obw-shadow); transition: box-shadow 160ms ease, opacity 200ms ease; }
.ui-obt-input:focus-within { box-shadow: var(--obw-shadow-firm); }
.ui-obt-input[data-off] { opacity: 0.45; }
.ui-obt-input input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--obw-ink); }
.ui-obt-input input:focus-visible { outline: none; outline-offset: 0; }
.ui-obt-input input[aria-invalid] { color: var(--obw-red); }

.ui-obt-seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px; padding: 2px; border-radius: 8px; background: var(--obw-line); }
.ui-obt-seg button { height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--obw-muted); font-weight: 500; transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
.ui-obt-seg button:hover { color: var(--obw-ink); }
.ui-obt-seg button[aria-checked="true"] { background: var(--obw-card); color: var(--obw-ink); box-shadow: var(--obw-shadow); }
.ui-obt-seg button:focus-visible { outline-offset: -2px; }

.ui-obt-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ui-obt-switch { position: relative; flex: none; width: 32px; height: 20px; padding: 0; border: 0; border-radius: 10px; background: var(--obw-line); transition: background-color 200ms ease; }
.ui-obt-switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 240ms var(--obw-out); }
.ui-obt-switch[aria-checked="true"] { background: var(--obw-dark); }
.ui-obt-switch[aria-checked="true"] i { transform: translateX(12px); }
:where(.dark, [data-theme="dark"]) .ui-obt-switch[aria-checked="true"] i { background: #111; }

.ui-obt-go {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; margin-top: 4px; padding: 0 14px; border: 0; border-radius: 8px;
  background: var(--obw-dark); color: var(--obw-on-dark); font-weight: 500; transition: opacity 160ms ease, transform 160ms var(--obw-out);
}
.ui-obt-go:hover:not(:disabled) { opacity: 0.88; }
.ui-obt-go:active:not(:disabled) { transform: scale(0.98); }
.ui-obt-go:disabled { opacity: 0.45; }
@media (pointer: coarse) {
  .ui-obt-input { height: 44px; }
  .ui-obt-seg button { height: 36px; }
  .ui-obt-go { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-obt * { transition: none !important; }
}


/* The summary: no card, no lines – a label column and the answers, left-aligned, Edit at the end of each */
.ui-obr { display: grid; gap: 22px; text-align: left; }
.ui-obr-list { display: grid; gap: 4px; margin: 0; }
.ui-obr-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 36px; }
.ui-obr-row dt { color: var(--obw-faint); }
.ui-obr-row dd { display: flex; min-width: 0; margin: 0; color: var(--obw-ink); font-weight: 500; white-space: nowrap; }
.ui-obr-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-obr-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-obr-more { flex: none; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--obw-line); color: var(--obw-muted); font-size: 11px; line-height: 18px; }
.ui-obr-edit { height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--obw-faint); font-weight: 500; transition: background-color 160ms ease, color 160ms ease; }
.ui-obr-edit:hover { background: var(--obw-line); color: var(--obw-ink); }
.ui-obr-go {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 8px;
  background: var(--obw-dark); color: var(--obw-on-dark); font-weight: 500; transition: opacity 160ms ease, transform 160ms var(--obw-out);
}
.ui-obr-go:hover { opacity: 0.88; }
.ui-obr-go:active { transform: scale(0.98); }
@media (pointer: coarse) {
  .ui-obr-row { min-height: 44px; }
  .ui-obr-edit { height: 36px; padding: 0 10px; }
  .ui-obr-go { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-obr * { transition: none !important; }
}


