Skip to content

Open-source, local-first AI agent for real work.

38.0 KB
Raw Blame
@layer vetta-plugins, theme, base, components, utilities;

@import "tailwindcss";
@import "tw-animate-css";
@import "@vetta-org/theme-ui/styles.css";
@plugin "@iconify/tailwind4";

/* Scan official theme UI package so utilities / iconify classes in migrated
   components (e.g. window minimize/maximize icons) are generated. */
@source "../../../../packages/theme-ui/src/**/*.{ts,tsx}";
/* Host design-system primitives live in @vetta-org/ui; re-exports under
   desktop-app no longer contain className literals for Tailwind to see. */
@source "../../../../packages/ui/src/**/*.{ts,tsx}";

/* 早期系统插件贡献的侧边栏图标。
 *
 * 工作区视图的 icon 是插件声明的 iconify class 字符串,宿主只是把它原样挂到导航
 * 按钮上——而 Tailwind 只生成**它扫得到的字面量**,插件源码不在宿主的扫描范围内。
 *
 * 新插件不要再往这里加:在插件自己的 CSS 里 `@plugin "@iconify/tailwind4"` 即可,
 * 图标规则会连同内联的 SVG 一起进入插件的 dist/style.css,宿主激活插件时加载它,
 * class 自然存在。这条路对第三方插件同样成立,而本清单只能覆盖仓库内的插件。
 * 下面几条是尚未迁移的旧插件,迁走一个就删一行。 */
@source inline("icon-[solar--palette-2-linear]");
@source inline("icon-[solar--archive-minimalistic-outline]");
@source inline("icon-[solar--smartphone-2-linear]");
@source inline("icon-[solar--video-frame-play-horizontal-linear]");
@source inline("icon-[solar--widget-2-linear]");

@custom-variant dark (&:is([data-mode="dark"] *));
/* Radix sets data-state="open"|"closed"; @vetta-org/ui uses data-open:/data-closed: utilities. */
@custom-variant data-open (&:is([data-state="open"]));
@custom-variant data-closed (&:is([data-state="closed"]));

/* ─── Dark mode (default) ─── */
:root,
[data-mode="dark"] {
	color-scheme: dark;

	--background: rgb(20, 22, 30);
	--foreground: rgb(220, 224, 234);
	--card: rgb(26, 28, 36);
	--card-foreground: rgb(220, 224, 234);
	--popover: rgb(50, 53, 67);
	--popover-foreground: rgb(220, 224, 234);
	--primary: rgb(99, 102, 241);
	--primary-foreground: rgb(255, 255, 255);
	--secondary: rgb(38, 38, 40);
	--secondary-foreground: rgb(220, 224, 234);
	--muted: rgb(30, 30, 32);
	--muted-foreground: rgb(138, 144, 160);
	--accent: rgb(40, 44, 62);
	--accent-foreground: rgb(220, 224, 234);
	--destructive: rgb(255, 91, 91);
	--destructive-foreground: rgb(0, 0, 0);
	--border: rgb(42, 45, 56);
	--input: rgb(48, 51, 64);
	/* AI 输入栏底色:深色跟随 card,浅色为纯白 */
	--input-bar-bg: rgb(26, 28, 36);
	--ring: rgb(129, 132, 248);
	--chart-1: rgb(255, 174, 4);
	--chart-2: rgb(38, 113, 244);
	--chart-3: rgb(116, 116, 116);
	--chart-4: rgb(82, 82, 82);
	--chart-5: rgb(228, 228, 228);
	/* 上下文构成分段:等亮度、等饱和,只靠色相区分,
	   避免相邻分段因明度差被读成“一高一低”。 */
	--context-segment-1: oklch(0.72 0.12 268);
	--context-segment-2: oklch(0.72 0.12 215);
	--context-segment-3: oklch(0.72 0.12 165);
	--context-segment-4: oklch(0.72 0.12 95);
	--context-segment-5: oklch(0.72 0.12 25);

	/* Windows 上前面的 macOS 字体都不存在:不显式写 Segoe UI / 微软雅黑 UI 的话会退回通用 sans-serif,
	   Electron 没有中文版 Chrome 的地区默认字体,中英文可能落到发虚的字体上。 */
	--font-sans: -apple-system, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI",
		"Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
	--font-serif: Georgia, serif;
	--font-mono: "SF Mono", "Fira Code", monospace;
	--radius: 0.5rem;

	--shadow-2xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
	--shadow-xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
	--shadow-sm: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 1px 2px -1px hsl(0 0% 0% / 0.18);
	--shadow: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 1px 2px -1px hsl(0 0% 0% / 0.18);
	--shadow-md: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 2px 4px -1px hsl(0 0% 0% / 0.18);
	--shadow-lg: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 4px 6px -1px hsl(0 0% 0% / 0.18);
	--shadow-xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 8px 10px -1px hsl(0 0% 0% / 0.18);
	--shadow-2xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.45);

	--tool-call-shimmer-base: color-mix(
		in srgb,
		var(--muted-foreground) 85%,
		var(--foreground)
	);
	--tool-call-shimmer-peak: color-mix(
		in srgb,
		var(--foreground) 72%,
		var(--primary)
	);

	/* 终端 ANSI 16 色。终端语义色不能复用 UI 的 token(前景/主色只有几档),
	   但同样必须是 token 而不是散落在组件里的字面量:xterm 只吃具体色值,
	   由 `terminal-theme.ts` 把这些变量解析后喂给它。 */
	--term-black: rgb(45, 48, 58);
	--term-red: rgb(237, 118, 118);
	--term-green: rgb(129, 199, 132);
	--term-yellow: rgb(229, 192, 123);
	--term-blue: rgb(122, 162, 247);
	--term-magenta: rgb(187, 154, 247);
	--term-cyan: rgb(125, 207, 255);
	--term-white: rgb(192, 197, 209);
	--term-bright-black: rgb(90, 95, 110);
	--term-bright-red: rgb(247, 145, 145);
	--term-bright-green: rgb(158, 216, 161);
	--term-bright-yellow: rgb(239, 210, 150);
	--term-bright-blue: rgb(151, 184, 255);
	--term-bright-magenta: rgb(205, 180, 250);
	--term-bright-cyan: rgb(160, 223, 255);
	--term-bright-white: rgb(230, 234, 243);
}


/* ─── Light mode ─── */
[data-mode="light"] {
	color-scheme: light;

	--background: rgb(255, 255, 255);
	--foreground: rgb(0, 0, 0);
	--card: rgb(250, 250, 250);
	--card-foreground: rgb(0, 0, 0);
	--popover: rgb(255, 255, 255);
	--popover-foreground: rgb(0, 0, 0);
	--primary: rgb(79, 70, 229);
	--primary-foreground: rgb(255, 255, 255);
	--secondary: rgb(235, 235, 235);
	--secondary-foreground: rgb(0, 0, 0);
	--muted: rgb(242, 242, 242);
	--muted-foreground: rgb(82, 82, 82);
	--accent: rgb(226, 232, 248);
	--accent-foreground: rgb(0, 0, 0);
	--destructive: rgb(229, 75, 79);
	--destructive-foreground: rgb(255, 255, 255);
	--border: rgb(230, 230, 230);
	--input: rgb(230, 230, 230);
	--input-bar-bg: rgb(255, 255, 255);
	--ring: rgb(79, 70, 229);
	--chart-1: rgb(255, 174, 4);
	--chart-2: rgb(45, 98, 239);
	--chart-3: rgb(164, 164, 164);
	--chart-4: rgb(228, 228, 228);
	--chart-5: rgb(116, 116, 116);
	--context-segment-1: oklch(0.62 0.14 268);
	--context-segment-2: oklch(0.62 0.14 215);
	--context-segment-3: oklch(0.62 0.14 165);
	--context-segment-4: oklch(0.62 0.14 95);
	--context-segment-5: oklch(0.62 0.14 25);

	--shadow-2xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
	--shadow-xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.09);
	--shadow-sm: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 1px 2px -1px hsl(0 0% 0% / 0.18);
	--shadow: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 1px 2px -1px hsl(0 0% 0% / 0.18);
	--shadow-md: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 2px 4px -1px hsl(0 0% 0% / 0.18);
	--shadow-lg: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 4px 6px -1px hsl(0 0% 0% / 0.18);
	--shadow-xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.18),
		0px 8px 10px -1px hsl(0 0% 0% / 0.18);
	--shadow-2xl: 0px 1px 2px 0px hsl(0 0% 0% / 0.45);

	--tool-call-shimmer-base: color-mix(
		in srgb,
		var(--muted-foreground) 85%,
		var(--foreground)
	);
	--tool-call-shimmer-peak: color-mix(
		in srgb,
		var(--foreground) 72%,
		var(--primary)
	);

	/* 终端 ANSI 16 色(浅色):整体压暗以保证白底上的对比度。 */
	--term-black: rgb(60, 64, 76);
	--term-red: rgb(193, 60, 60);
	--term-green: rgb(45, 138, 62);
	--term-yellow: rgb(158, 118, 20);
	--term-blue: rgb(38, 96, 204);
	--term-magenta: rgb(130, 78, 196);
	--term-cyan: rgb(23, 130, 176);
	--term-white: rgb(110, 116, 130);
	--term-bright-black: rgb(130, 136, 150);
	--term-bright-red: rgb(214, 84, 84);
	--term-bright-green: rgb(58, 158, 76);
	--term-bright-yellow: rgb(178, 138, 32);
	--term-bright-blue: rgb(58, 116, 224);
	--term-bright-magenta: rgb(150, 98, 216);
	--term-bright-cyan: rgb(30, 150, 200);
	--term-bright-white: rgb(40, 44, 54);
}

@theme inline {
	--font-sans: var(--font-sans);
	--font-mono: var(--font-mono);
	--font-serif: var(--font-serif);

	--radius-sm: calc(var(--radius) - 4px);
	--radius-md: calc(var(--radius) - 2px);
	--radius-lg: var(--radius);
	--radius-xl: calc(var(--radius) + 4px);

	--shadow-2xs: var(--shadow-2xs);
	--shadow-xs: var(--shadow-xs);
	--shadow-sm: var(--shadow-sm);
	--shadow: var(--shadow);
	--shadow-md: var(--shadow-md);
	--shadow-lg: var(--shadow-lg);
	--shadow-xl: var(--shadow-xl);
	--shadow-2xl: var(--shadow-2xl);
}

@layer base {
	* {
		@apply border-border outline-ring/50;
	}
}

/* 黑白主题浅色:纯黑 primary 的 15%/10% 叠色作侧栏选中过深,压到约 7%/5%。
   仅覆盖 tint 工具类,不影响 solid bg-primary 按钮。 */
[data-theme="mono"][data-mode="light"] .bg-primary\/15 {
	background-color: color-mix(in srgb, var(--primary) 7%, transparent);
}
[data-theme="mono"][data-mode="light"] .bg-primary\/10 {
	background-color: color-mix(in srgb, var(--primary) 5%, transparent);
}

/* 黑白主题:深色灰眼(浅色脸底);浅色保持默认白眼 */
[data-theme="mono"][data-mode="dark"] .bot-avatar-eye {
	background-color: rgb(150, 150, 150);
}

/* 黑白主题浅色:发送按钮禁用态默认用 muted-foreground,偏深;压浅为中性灰 */
[data-theme="mono"][data-mode="light"] .send-button {
	--send-button-inactive-background: color-mix(in srgb, rgb(180, 180, 180) 22%, transparent);
	--send-button-inactive-foreground: rgb(180, 180, 180);
}

/* 切换主题/模式时短暂启用过渡。由 shared/theme/apply.ts 的
   withThemeTransition() 添加/移除根节点 class。仅作用于颜色/边框/阴影,
   不影响 transform、opacity 等交互反馈相关的属性。 */
[data-theme].theme-transitioning,
[data-theme].theme-transitioning *,
[data-theme].theme-transitioning *::before,
[data-theme].theme-transitioning *::after {
	transition:
		background-color 180ms ease,
		color 180ms ease,
		border-color 180ms ease,
		fill 180ms ease,
		stroke 180ms ease,
		box-shadow 180ms ease !important;
}

/* View Transition 已经用根快照完成整页过渡。捕获和播放期间暂停页面内部的普通 transition,
   避免主题 token 变化让 transition-all / transition-colors 元素各自启动非合成颜色动画。
   fallback 路径带 theme-transitioning class,需要继续使用上面的颜色渐变。 */
:root[data-theme-transition]:not(.theme-transitioning),
:root[data-theme-transition]:not(.theme-transitioning) *,
:root[data-theme-transition]:not(.theme-transitioning) *::before,
:root[data-theme-transition]:not(.theme-transitioning) *::after {
	transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
	animation: none;
	mix-blend-mode: normal;
}

::view-transition-new(root) {
	z-index: 1;
}

:root {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	/* 一律使用系统原生光标。 */
	--cursor-default: default;
	--cursor-click: pointer;
	--cursor-help: help;
	--cursor-hover: pointer;
	--cursor-horizontal-resize: ew-resize;
	--cursor-loading: wait;
	--cursor-move: move;
	--cursor-not-allowed: not-allowed;
	--cursor-pointer: pointer;
	--cursor-text: text;
	--cursor-vertical-resize: ns-resize;
	--cursor-diagonal-resize: nwse-resize;
	--cursor-diagonal-resize-flipped: nesw-resize;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100vh;
	background: transparent;
	color: var(--foreground);
}

#root {
	min-height: 100vh;
}

html,
body,
#root {
	cursor: var(--cursor-default);
}

button,
a,
label,
summary,
select,
[role="button"],
.cursor-pointer {
	cursor: var(--cursor-pointer);
}

button:hover,
a:hover,
label:hover,
summary:hover,
select:hover,
[role="button"]:hover,
.cursor-pointer:hover {
	cursor: var(--cursor-hover);
}

button:active,
a:active,
label:active,
summary:active,
select:active,
[role="button"]:active,
.cursor-pointer:active {
	cursor: var(--cursor-click);
}

input,
textarea,
[contenteditable="true"],
.cursor-text {
	cursor: var(--cursor-text);
	caret-color: var(--primary);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
[aria-disabled="true"],
.cursor-not-allowed {
	cursor: var(--cursor-not-allowed);
}

.cursor-default {
	cursor: var(--cursor-default);
}

.cursor-help {
	cursor: var(--cursor-help);
}

.cursor-wait,
.cursor-progress {
	cursor: var(--cursor-loading);
}

.cursor-move,
.cursor-grab,
.cursor-grabbing {
	cursor: var(--cursor-move);
}

.cursor-col-resize,
.cursor-ew-resize {
	cursor: var(--cursor-horizontal-resize);
}

.cursor-row-resize,
.cursor-ns-resize {
	cursor: var(--cursor-vertical-resize);
}

.cursor-nwse-resize {
	cursor: var(--cursor-diagonal-resize);
}

.cursor-nesw-resize {
	cursor: var(--cursor-diagonal-resize-flipped);
}

/* macOS-style overlay scrollbars: hidden by default, fade in on hover.
   Width/height stays reserved so layout doesn't shift; only thumb opacity changes. */
* {
	scrollbar-width: thin;
	scrollbar-color: transparent transparent;
}
*:hover,
*:focus-within {
	scrollbar-color: color-mix(in srgb, var(--muted-foreground) 35%, transparent)
		transparent;
}

::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}
::-webkit-scrollbar-track {
	background: transparent;
}
::-webkit-scrollbar-thumb {
	background: transparent;
	border-radius: 4px;
	border: 2px solid transparent;
	background-clip: padding-box;
	transition: background-color 0.2s ease;
}
::-webkit-scrollbar-corner {
	background: transparent;
}
/* Show thumb only when the scrollable container is hovered or focused. */
*:hover::-webkit-scrollbar-thumb,
*:focus-within::-webkit-scrollbar-thumb {
	background: color-mix(in srgb, var(--muted-foreground) 35%, transparent);
	background-clip: padding-box;
}
*:hover::-webkit-scrollbar-thumb:hover {
	background: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
	background-clip: padding-box;
}

/* Fully hide scrollbar (still scrollable). Unlayered so it overrides the
   global overlay-scrollbar rules above, which Tailwind utilities cannot. */
.no-scrollbar {
	scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
	display: none;
}

/* macOS window drag region */
.drag-region {
	-webkit-app-region: drag;
}
.no-drag {
	-webkit-app-region: no-drag;
}

/* Sidebar: transparent for native macOS vibrancy */
.sidebar-vibrancy {
	background: transparent;
}

/* Sidebar surface: pin children to z:1 so inline z-index overrides
   (e.g. filter dropdown) can float above the project list below. */
.sidebar-surface > *:not(.absolute) {
	position: relative;
	z-index: 1;
}

/* 侧边栏:抵消 AppFrame 的 p-2,让常驻侧边栏贴住窗口左/上/下边,
   并去掉圆角与四周边框,只保留右侧一条分隔线。窄屏 overlay 侧边栏不受影响。 */
:root .sidebar-dock {
	margin: -0.5rem 0 -0.5rem -0.5rem;
}

/* 收起态:左栏仍是流内的 0 宽盒子(子树不随收起卸载,见 SidebarDock),贴边用的 -8px
   会把主内容多拉 8px 到窗口外,所以跟着宽度一起过渡回 0。 */
:root .sidebar-dock[inert] {
	margin-left: 0;
}

:root .sidebar-dock .sidebar-surface {
	border-radius: 0;
	border-width: 0;
	border-right-width: 1px;
}

/* Windows 上玻璃按钮组按扁平画:窗口 chrome 由 DWM 平涂,没有 macOS 那层透明与阴影做过渡,
   深色下的内高光、投影和背景模糊会显得突兀。按钮组组件本身不判断平台,这是应用层的取舍。 */
:root[data-platform="windows"] [data-slot="button-group"][data-variant="glass"] {
	backdrop-filter: none;
}

/* 阴影只在深色下清:浅色玻璃本来就不加阴影,调用方自带的阴影(如启动器的浮动按钮组)要留着。 */
:root[data-platform="windows"][data-mode="dark"] [data-slot="button-group"][data-variant="glass"] {
	box-shadow: none;
}

/* 侧边栏顶栏内容与主页头对齐。h-11 自身居中:顶栏从 y=0 起算、中线 22 偏上,
   补顶部内边距把图标中线挪到与主页头一致的 28(含 relative top-[-2px])。
   padding 记在 h-11 元素自身(border-box,总高不变),drag-region 仍覆盖整条顶栏。
   红绿灯位置不依赖这里的数字:renderer 会实测 [data-titlebar-anchor] 的中线并上报主进程。 */
:root[data-platform="mac"] .sidebar-dock .sidebar-top-bar {
	padding-top: 1rem;
	padding-bottom: 0;
}

/* macOS 经典侧边栏用系统原生毛玻璃(窗口已带 vibrancy: "sidebar",见 main/window-manager.ts)。
   放行的做法是整帧 + 侧边栏都不上底色,再由主内容区自己补回不透明底色:
   ::before 向上/右/下各溢出 8px 盖住 AppFrame 的 p-2 留白,所以布局与非 mac 完全一致,
   只有侧边栏那一条透出桌面。 */
:root[data-platform="mac"] .app-frame {
	background-color: transparent;
}

/* 侧边栏不全透:在毛玻璃上再铺一层半透明 --background,压住桌面壁纸的杂色,
   同时保留 vibrancy 的通透感。浓淡调 --sidebar-vibrancy-tint 即可。

   主题里的 --accent 是不透明实色,铺在这层半透明底上会出问题:侧边栏底色跟着背后
   桌面的明暗走,选中块却纹丝不动,背后亮的那一段底色会被抬得比选中块还亮,高亮与
   底色的明暗关系当场反转,看着就像那半边的选中背景没了。所以在侧边栏子树内把
   --accent 换成半透明叠加色——始终是「在当前合成底色上再压 10% 前景色」,背后黑白
   都成立。导航指示条、项目行/会话行选中与 hover:bg-accent/50 一起生效。 */
:root[data-platform="mac"]
	.sidebar-dock
	.sidebar-surface {
	background-color: color-mix(
		in srgb,
		var(--background) var(--sidebar-vibrancy-tint, 60%),
		transparent
	);
	--accent: color-mix(in srgb, var(--foreground) 10%, transparent);
	transition: background-color 240ms ease;
}

/* 浅色的 --background 是纯白,同样的浓度压得比深色狠得多,透明感几乎没了,所以单独调淡。 */
:root[data-platform="mac"][data-mode="light"]
	.sidebar-dock
	.sidebar-surface {
	--sidebar-vibrancy-tint: 35%;
}

/* 有弹出层蒙层(.overlay-backdrop,见 @vetta-org/ui 的 OVERLAY_BACKDROP_CLASS)时把侧边栏换成实色。
   侧边栏半透明是为了透出原生毛玻璃,但 backdrop-filter 模糊出的结果同样半透明,
   盖不住底下仍然清晰的文字,会出现「主内容糊了、侧边栏字还是清楚的」。换成实色后蒙层
   才能把整块都模糊掉。进入时不过渡(蒙层自己在淡入);退出时按上面的 240ms 淡回半透明。 */
:root[data-platform="mac"]:has(.overlay-backdrop)
	.sidebar-dock
	.sidebar-surface {
	background-color: var(--background);
	transition: none;
}

/* 弹出层蒙层(OVERLAY_BACKDROP_CLASS 的 .overlay-backdrop):模糊背景 + 磨砂底色。
   曾叠过一层 SVG 像素化滤镜,但它要在 GPU 上对整屏背景逐帧重算,蒙层下背景在动
   (流式输出、加载动画)时开销明显,且只是装饰,已去掉。
   选择器带 :root 是为了压过 Tailwind 的 backdrop-blur 工具类(保留它作为没有本样式时的兜底)。 */
:root .overlay-backdrop {
	backdrop-filter: blur(10px);
	/* 磨砂的浅色而不是灰压暗:灰蒙蒙的底色是「脏」的主要来源。 */
	background-color: rgb(255 255 255 / 0.2);
}

:root[data-mode="dark"] .overlay-backdrop {
	background-color: rgb(0 0 0 / 0.18);
}

/* 明暗切换期间先遮住原生 vibrancy(它由主进程翻转,动不了也不进 View Transition 快照,
   否则会比页面动画早一步瞬变);属性移除后按上面的 240ms 淡回半透明。 */
:root[data-platform="mac"][data-theme-transition]
	.sidebar-dock
	.sidebar-surface {
	background-color: var(--background);
	transition: none;
}

:root[data-platform="mac"] .app-main-frame::before {
	content: "";
	position: absolute;
	inset: -0.5rem;
	z-index: -1;
	background-color: var(--background);
}

/* 侧边栏在位时,左边那 8px 已经被它自己盖住,::before 不能再往左伸——否则会压住毛玻璃右缘。
   收起(或窄屏浮层态)时左栏节点仍在,但带 inert,此规则不命中,::before 就按上面的 inset
   一路铺到窗口左边,不会留下透出桌面的空白条。 */
:root[data-platform="mac"]
	.sidebar-dock:not([inert])
	~ .app-main-frame::before {
	left: 0;
}

/* 沉浸式页头(插件工作区视图声明 immersive):主内容帧吃掉 AppFrame 的 p-2 留白,
   铺到窗口边缘——沉浸页的门面从窗口第一像素开始,四周不能露出一圈底色缝隙。
   左侧跟随侧边栏:侧边栏在位时由它占住左缘,不在位(收起/窄屏)时一并铺满。 */
.app-main-frame[data-header-overlay] {
	margin: -0.5rem -0.5rem -0.5rem -0.5rem;
}
.sidebar-dock:not([inert]) ~ .app-main-frame[data-header-overlay] {
	margin-left: 0;
}

/* 沉浸内容帧已经抵消了窗口留白,背景无需再次出血;否则底部多出 8px 滚动范围。 */
:root[data-platform="mac"] .app-main-frame[data-header-overlay]::before {
	inset: 0;
}

/* 出血只给内容,不给页头:页头里给 macOS 红绿灯留的 78px 和 h-11 的垂直居中,
   都是按「主内容帧带 AppFrame p-2 偏移」算的,跟着上面那条负 margin 一起外移后,
   展开侧边栏按钮就比红绿灯偏左偏上(侧边栏收起时尤其明显)。这里把这 8px 在页头层补回来,
   让沉浸式与常规页头的按钮落点完全一致;左侧同样跟随侧边栏是否在位。 */
.app-main-frame[data-header-overlay] > .main-content-header {
	padding: 0.5rem 0.5rem 0;
}
.sidebar-dock:not([inert]) ~ .app-main-frame[data-header-overlay] > .main-content-header {
	padding-left: 0;
}

/* 常规页头下,仅展开的新会话停靠栏抵消 AppFrame 右侧和底部的 p-2。 */
.app-main-frame:not([data-header-overlay]) .new-session-layout > [data-activity-panel-dock="open"] {
	height: auto;
	margin-right: -0.5rem;
	margin-bottom: -0.5rem;
}

.project-list-containment {
	contain: layout paint style;
}

.project-group-contain {
	contain: layout style;
}

.project-running-icon,
.project-running-ping {
	contain: layout paint style;
	will-change: transform;
}

/* Selection highlight */
::selection {
	background: color-mix(in srgb, var(--primary) 42%, transparent);
	color: var(--foreground);
}

/* Focus: no global outline/ring; interactive controls use 1px border color change */
:focus-visible {
	outline: none;
}
textarea:focus-visible,
textarea:focus {
	outline: none;
	box-shadow: none;
}

/* Outgoing messages and the Appearance preview share the same visual primitive. */
:root[data-user-bubble-shape="chat"] [data-message-visual="outgoingbubble"] {
	position: relative;
	margin-bottom: 7px;
	border-radius: 1.25rem;
	/* A one-character bubble is narrower than its two corner radii, so its bottom edge is all curve and the
	   tail's flat top shows a notch. Keep enough width for a flat stretch and centre short content in it;
	   longer content is unaffected because it already fills the bubble. */
	display: flex;
	justify-content: center;
	min-width: 3rem;
}

:root[data-user-bubble-shape="chat"] [data-message-visual="outgoingbubble"] > * {
	min-width: 0;
	max-width: 100%;
}

/* The tail's bottom margin sits below the bubble; keep the side actions centred on the bubble itself. */
:root[data-user-bubble-shape="chat"] [data-user-message-actions] {
	margin-top: -3.5px;
}

:root[data-user-bubble-shape="chat"] [data-message-visual="outgoingbubble"]::after {
	position: absolute;
	right: max(12px, 6%);
	bottom: -7px;
	width: 18px;
	height: 12px;
	background-color: inherit;
	clip-path: path("M0 0H18C13 3 12 6 14.5 9.5C15.6 11.2 14.6 12 13 11.5C7.5 10 6 5 0 5Z");
	pointer-events: none;
	content: "";
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"]) [data-message-visual="outgoingbubble"] {
	background-color: var(--user-bubble-bg);
	color: var(--user-bubble-fg);
	/* Pending messages retain their ring without washing out the custom colors. */
	opacity: 1;
}

/* Rich Markdown panels have their own theme backgrounds and contrast. */
:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] :where([data-md-table-frame], [data-md-code-frame]) {
	color: var(--foreground);
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] .markdown-body
	:where(.text-foreground, blockquote):not(:where([data-md-table-frame] *, [data-md-code-frame] *)) {
	color: var(--user-bubble-fg);
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] .markdown-body
	:where(.text-primary, .text-chart-2):not(:where([data-md-table-frame] *, [data-md-code-frame] *)) {
	--primary: var(--user-bubble-fg);
	--chart-2: var(--user-bubble-fg);
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] .markdown-body
	:where(a, button).text-primary:hover:not(:where([data-md-table-frame] *, [data-md-code-frame] *)) {
	/* A softer hover tint preserves white text contrast on the blue bubble. */
	background-color: color-mix(in srgb, var(--user-bubble-fg) 15%, var(--user-bubble-bg));
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] .markdown-body
	ol > li:not(:where([data-md-table-frame] *, [data-md-code-frame] *))::marker {
	color: var(--user-bubble-fg);
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] .markdown-body
	code.bg-muted:not(:where([data-md-table-frame] *, [data-md-code-frame] *)) {
	background-color: color-mix(in srgb, var(--user-bubble-fg) 12%, var(--user-bubble-bg));
}

:root[data-user-bubble-color]:not([data-user-bubble-color="default"])
	[data-message-visual="outgoingbubble"] [data-user-message-expand-fade] {
	--secondary: var(--user-bubble-bg);
}

/* Use resolved theme surfaces so nested panels do not stack multiple translucent layers. */
:root:is([data-user-bubble-shape="chat"], [data-user-bubble-color]:not([data-user-bubble-color="default"]))
	[data-message-visual="outgoingbubble"] {
	--bubble-surface: var(--user-bubble-bg, var(--secondary));
	--bubble-panel-background: color-mix(in srgb, var(--background) 88%, var(--bubble-surface));
	--bubble-panel-muted: color-mix(in srgb, var(--muted) 88%, var(--bubble-surface));
}

:root:is([data-user-bubble-shape="chat"], [data-user-bubble-color]:not([data-user-bubble-color="default"]))
	[data-message-visual="outgoingbubble"] :where([data-md-table-frame], [data-md-code-frame]) {
	--background: var(--bubble-panel-background);
	--muted: var(--bubble-panel-muted);
}

:root:is([data-user-bubble-shape="chat"], [data-user-bubble-color]:not([data-user-bubble-color="default"]))
	[data-message-visual="outgoingbubble"] [data-user-message-expand-fade] button {
	--expand-foreground: var(--user-bubble-fg, var(--foreground));
	background-color: color-mix(in srgb, var(--expand-foreground) 8%, var(--bubble-surface));
	border-color: color-mix(in srgb, var(--expand-foreground) 28%, transparent);
	color: var(--expand-foreground);
}

:root:is([data-user-bubble-shape="chat"], [data-user-bubble-color]:not([data-user-bubble-color="default"]))
	[data-message-visual="outgoingbubble"] [data-user-message-expand-fade] button:is(:hover, :focus-visible) {
	background-color: color-mix(in srgb, var(--expand-foreground) 15%, var(--bubble-surface));
	border-color: color-mix(in srgb, var(--expand-foreground) 55%, transparent);
}

/* Use the prose foreground for decorative lines drawn directly on a styled bubble. */
:root:is([data-user-bubble-shape="chat"], [data-user-bubble-color]:not([data-user-bubble-color="default"]))
	[data-message-visual="outgoingbubble"] .markdown-body
	:where(hr, blockquote, .md-bullet-list):not(:where([data-md-table-frame] *, [data-md-code-frame] *)) {
	--md-bullet-line: color-mix(in srgb, var(--user-bubble-fg, var(--foreground)) 40%, transparent);
	border-color: var(--md-bullet-line);
}

/* Match the editor font weights while letting Markdown emphasis remain explicit. */
:root[data-user-bubble-weight="medium"] [data-message-visual="outgoingbubble"] {
	font-weight: 500;
}

:root[data-user-bubble-weight="semibold"] [data-message-visual="outgoingbubble"] {
	font-weight: 600;
}

/* Markdown body: readable text should use text-selection cursor. */
.markdown-body,
.markdown-body :where(p, li, blockquote, td, th, h1, h2, h3, h4, h5, h6, span, strong, em, code, pre),
.code-preview,
.code-preview :where(pre, code, span),
.text-preview-content {
	cursor: var(--cursor-text);
}

.markdown-body :where(a, button, [role="button"]),
.markdown-body :where(a, button, [role="button"]) :where(span, strong, em, code) {
	cursor: var(--cursor-pointer);
}

.markdown-body :where(a:hover, button:hover, [role="button"]:hover),
.markdown-body :where(a:hover, button:hover, [role="button"]:hover) :where(span, strong, em, code) {
	cursor: var(--cursor-hover);
}

/* Markdown body: remove margin on first/last children */
.markdown-body > :first-child {
	margin-top: 0 !important;
}
.markdown-body > :last-child {
	margin-bottom: 0 !important;
}

/* Markdown unordered list: tree connector (matches NewSession guiding words) */
.md-bullet-list {
	--md-bullet-line: color-mix(in srgb, var(--muted-foreground) 30%, transparent);
	list-style: none;
	padding-left: 0.625rem; /* pl-2.5 */
}
.md-bullet-list > li {
	position: relative;
	padding-left: 18px;
	padding-top: 0.25rem;
	padding-bottom: 0.25rem;
}
/* Tight paragraphs so the branch aligns with the first text line */
.md-bullet-list > li > p {
	margin-top: 0;
	margin-bottom: 0;
}
.md-bullet-list > li > p + p {
	margin-top: 0.375rem;
}
/* Non-last: full-height vertical rail */
.md-bullet-list > li:not(:last-child)::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0;
	border-left: 1px solid var(--md-bullet-line);
}
/* Non-last: horizontal branch at first-line height */
.md-bullet-list > li:not(:last-child)::after {
	content: "";
	position: absolute;
	left: 0;
	top: 0.95rem;
	width: 12px;
	border-top: 1px solid var(--md-bullet-line);
}
/* Last: L-shaped corner */
.md-bullet-list > li:last-child::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	height: 0.95rem;
	width: 12px;
	border-left: 1px solid var(--md-bullet-line);
	border-bottom: 1px solid var(--md-bullet-line);
	border-bottom-left-radius: 7px;
}
.md-bullet-list > li:last-child::after {
	content: none;
}

/* ─── Markdown 表格(MarkdownTable 壳的配套样式)─── */

/* 数值列必须等宽数字,否则「4,680.50 / 2,450.20」上下对不齐,一眼看不出量级差。 */
.md-table {
	font-variant-numeric: tabular-nums;
}

/* 表头列间的竖分隔:只有一个字高、垂直居中。通高的 border 会把表头切成一排格子,
   压过标题本身。th 是 sticky,天然可作伪元素的定位上下文。 */
.md-table thead th + th::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	height: 1em;
	width: 1px;
	translate: 0 -50%;
	background: var(--border);
}

.md-table-shadow-host {
	--md-table-shadow: color-mix(in srgb, var(--foreground) 22%, transparent);
}

/* Smooth transitions globally */
button,
a {
	transition:
		color 0.15s ease,
		background-color 0.15s ease,
		border-color 0.15s ease;
}

/* ─── InputBar visual effects ─── */

@keyframes message-bell-swing {
	0%,
	28%,
	100% {
		transform: rotate(0deg);
	}
	3% {
		transform: rotate(-22deg);
	}
	6% {
		transform: rotate(20deg);
	}
	9% {
		transform: rotate(-16deg);
	}
	13% {
		transform: rotate(12deg);
	}
	17% {
		transform: rotate(-7deg);
	}
	22% {
		transform: rotate(3deg);
	}
}

.message-bell-swing {
	transform-origin: top center;
	animation: message-bell-swing 3.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
	will-change: transform;
}

@keyframes bash-cursor-blink {
	0%,
	50% {
		opacity: 1;
	}
	51%,
	100% {
		opacity: 0;
	}
}

/* 运行中的工具名/状态文字:整段轻微呼吸。
   早先是 background-clip: text 的渐变光斑横扫(对 background-position 做无限动画)——
   那种写法每帧都要重绘文字层,一个任务里常有好几段同时在跑,还贯穿整个任务时长;
   在毛玻璃窗口上每帧重绘都很贵。后来改成 opacity 关键帧,合成器不重绘了,但每段仍各自
   60fps 出帧,毛玻璃窗口照样整窗重合成。现在 CSS 只写静止态,呼吸由 shared/lib/live-animations.ts
   挂 steps(16) 的合成器动画并与其它进行中指示器锁同一相位(每 100ms 一步、全页同拍)。 */
.tool-call-shimmer-text {
	color: var(--tool-call-shimmer-peak);
}

@media (prefers-reduced-motion: reduce) {
	.tool-call-shimmer-text {
		color: var(--muted-foreground);
	}
}

/* ─── Dialog 入场/出场动画 ───
   radix 在 overlay/content 上写 data-state="open"|"closed",关闭时 Presence
   会等动画结束再卸载,因此出场动画也能完整播放。content 的 to 态保持
   translate(-50%,-50%) 与 Tailwind 的居中类一致,动画结束后无跳动。 */
@keyframes vetta-dialog-overlay-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes vetta-dialog-overlay-out {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}

@keyframes vetta-dialog-content-in {
	from {
		opacity: 0;
		transform: translate(-50%, -50%) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}
}

@keyframes vetta-dialog-content-out {
	from {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}
	to {
		opacity: 0;
		transform: translate(-50%, -50%) scale(0.96);
	}
}

[data-slot="dialog-overlay"][data-state="open"] {
	animation: vetta-dialog-overlay-in 200ms ease-out;
}

[data-slot="dialog-overlay"][data-state="closed"] {
	animation: vetta-dialog-overlay-out 150ms ease-in;
}

/* ─── 首次启动引导:步骤/按钮入场 ───
   只动 opacity + transform(合成器属性),不用 filter: blur——毛玻璃窗口上 blur 会让切换掉帧。 */
@keyframes setup-wizard-enter {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.setup-wizard-enter {
	animation: setup-wizard-enter 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
	.setup-wizard-enter {
		animation: none;
	}
}

/*
  Safety net for DialogContent width after primitives moved to @vetta-org/ui.
  Utility max-w-* / sm:max-w-* (utilities layer) still override this when present.
  Without a cap, only w-full may apply and dialogs span nearly the full viewport.
*/
@layer components {
	[data-slot="dialog-content"] {
		width: 100%;
		max-width: min(24rem, calc(100% - 2rem));
	}
}

[data-slot="dialog-content"][data-state="open"] {
	animation: vetta-dialog-content-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-slot="dialog-content"][data-state="closed"] {
	animation: vetta-dialog-content-out 150ms ease-in;
}

/* Full-screen dialog stages (e.g. the usage ticket maker): same timing as dialog-content, but the
   element fills the viewport, so it scales in place instead of from a translate(-50%, -50%) centre. */
@keyframes vetta-dialog-stage-in {
	from {
		opacity: 0;
		transform: scale(0.96);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes vetta-dialog-stage-out {
	from {
		opacity: 1;
		transform: scale(1);
	}
	to {
		opacity: 0;
		transform: scale(0.96);
	}
}

[data-slot="dialog-stage"][data-state="open"] {
	animation: vetta-dialog-stage-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-slot="dialog-stage"][data-state="closed"] {
	animation: vetta-dialog-stage-out 150ms ease-in;
}

@media (prefers-reduced-motion: reduce) {
	[data-slot="dialog-overlay"][data-state="open"],
	[data-slot="dialog-overlay"][data-state="closed"],
	[data-slot="dialog-content"][data-state="open"],
	[data-slot="dialog-content"][data-state="closed"],
	[data-slot="dialog-stage"][data-state="open"],
	[data-slot="dialog-stage"][data-state="closed"] {
		animation: none;
	}
}

/* ─── Team 成员胶囊:正在输出时的柔和光斑与呼吸状态点 ─── */

@keyframes team-pill-sweep {
	0% {
		transform: translateX(-160%);
	}
	100% {
		transform: translateX(320%);
	}
}

.team-pill-sweep::after {
	content: "";
	position: absolute;
	top: -60%;
	bottom: -60%;
	left: 0;
	width: 40%;
	background: linear-gradient(
		100deg,
		transparent 0%,
		color-mix(in srgb, var(--primary) 30%, transparent) 50%,
		transparent 100%
	);
	/* 不挂 filter: blur——渐变两端本就淡到全透,模糊只是让无限动画每帧多跑一遍滤镜。 */
	animation: team-pill-sweep 2.6s ease-in-out infinite;
	will-change: transform;
}

@keyframes team-pill-live-halo {
	0% {
		transform: scale(1);
		opacity: 0.55;
	}
	70%,
	100% {
		transform: scale(2.2);
		opacity: 0;
	}
}

.team-pill-live-dot::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 9999px;
	background: currentColor;
	color: var(--color-emerald-500, #10b981);
	animation: team-pill-live-halo 1.8s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
	.team-pill-sweep::after,
	.team-pill-live-dot::after {
		animation: none;
	}
}

/* ─── 侧栏更新入口:主色圆圈边缘的呼吸荡漾 ─── */

@keyframes update-entry-glow {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.58;
	}
}

/* 底色呼吸走独立图层的 opacity:直接在 background-color 上插值 color-mix()
   会被浏览器按离散值切换,看起来就是“跳一下”。 */
.update-entry-glow {
	animation: update-entry-glow 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes update-entry-ripple {
	0% {
		transform: scale(1);
		opacity: 0;
	}
	18% {
		opacity: 0.4;
	}
	100% {
		transform: scale(1.28);
		opacity: 0;
	}
}

.update-entry-ripple::before,
.update-entry-ripple::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
	border-radius: 9999px;
	animation: update-entry-ripple 3.6s cubic-bezier(0.3, 0, 0.4, 1) infinite;
}

/* 第二道涟漪延后半拍;幅度压在 1.28 倍以内,不会被行高截断。 */
.update-entry-ripple::after {
	animation-delay: 1.8s;
}

@media (prefers-reduced-motion: reduce) {
	.update-entry-glow {
		animation: none;
	}

	.update-entry-ripple::before,
	.update-entry-ripple::after {
		animation: none;
		opacity: 0;
	}
}

/* 窗口不在前台时暂停无限动画:标记由 shared/lib/inactive-window-animations.ts 打在宿主元素上。
   必须走样式而不是脚本的 pause()——原因见那个文件开头。 */
[data-inactive-paused],
[data-inactive-paused]::before,
[data-inactive-paused]::after {
	animation-play-state: paused !important;
}