/* ============================================================================
   wanman /app 重设计方案「蓝调石墨」— 语义令牌替换块
   直接替换 web/src/styles.css 的两段变量块：
     · :root  → 原文 108–161 行（浅色）
     · .dark  → 原文 163–211 行（深色）
   @theme inline 映射（原文 31–106 行）沿用原文，本次不改，故附于文末供对照。
   规则：不新增令牌名，全部变量名均来自 web/src/styles.css 现有声明；
        每个取值都可追溯到 Mercury 参考或明确设计意图（见 proposal.md §4）。
   途径：本文件全部改动落在「① 语义化主题令牌取值」。
   ============================================================================ */

:root {
  /* 浅色＝蓝调日间：画布从近白 #fcfcfc 改为冷调雾蓝灰 #f4f6fb，
     与白色内容面拉开层级（实测现状 sidebar #fcfcfc 与 background #fcfcfc 完全同色＝零层级）。 */
  --background: #f4f6fb;
  /* 正文墨色取 Mercury「Ivory 反相」的冷调近黑，去掉 #060607 的纯黑偏色。 */
  --foreground: #14161f;
  /* 卡片/浮层维持纯白，承担 Mercury「Graphite 抬升面」的角色（浅色下白面浮于蓝灰画布）。 */
  --card: #ffffff;
  --card-foreground: #14161f;
  --popover: #ffffff;
  --popover-foreground: #14161f;
  /* 自己气泡＝淡钴蓝面，与「他人气泡＝--accent 中性灰」形成色相区分；实测对比 11.93:1（见图表 §7）。 */
  --message-self: #dfe5fb;
  --message-self-foreground: #1b2350;
  /* 主色走品牌令牌，不新增旁路；primary/ring 全部指向 --brand 保持单一蓝。 */
  --primary: var(--brand);
  --primary-foreground: var(--brand-foreground);
  /* 次级面承担 Mercury「Obsidian 交互面」角色，比画布略深，用于 hover/选中行。 */
  --secondary: #e9ecf3;
  --secondary-foreground: #14161f;
  --muted: #f0f2f7;
  --muted-foreground: #5b6070;
  --accent: #e9ecf3;
  --accent-foreground: #14161f;
  /* 危险色保留语义红但压暗一档，保证白底文字 5.15:1 达标。 */
  --destructive: #cf2d34;
  /* border 为装饰性发丝线（1.2:1，明度抬升式分层），不承担组件识别边界，见 §7 说明。 */
  --border: #dfe3ec;
  /* input 为功能性边界，必须 ≥3:1：实测对 #ffffff 3.46:1、对 #f4f6fb 3.20:1。 */
  --input: #828a9d;
  --ring: var(--brand);
  /* 图表改为单蓝阶（Mercury「单一彩色音符」纪律），替换原中性灰阶。 */
  --chart-1: #4356e3;
  --chart-2: #6f7cec;
  --chart-3: #9aa1b2;
  --chart-4: #4d5364;
  --chart-5: #232838;
  /* 圆角从 0.625rem(10px) 提到 0.75rem(12px)，对齐 Mercury 卡片 12px 规则；
     Mercury 的 32/40px 药丸形受 shadcn 官方 variant 限制不可达，列为舍弃项（proposal §8）。 */
  --radius: 0.75rem;
  /* 主色＝Mercury Cobalt 的浅底版本：为保证白字 5.71:1，把 #5266eb 压暗到 #4356e3。 */
  --brand: #4356e3;
  --brand-foreground: #ffffff;
  /* 品牌浅底 12% 透明面；选中导航项底色，与 --brand 同源不引入第二色。 */
  --brand-soft: rgb(67 86 227 / 0.12);
  /* 浅底上的品牌文字色，对 --brand-soft 合成面 5.69:1（弹窗左侧导航选中态用）。 */
  --brand-ink: #3b4ad4;
  /* 频道回复/引用软底，比 --message-self 更浅，避免与气泡同色。 */
  --surface-chat-soft: #eef1fe;
  /* 会话选中底色，落在 --brand-soft 与 --muted 之间，保证「选中 > hover > 常态」三级可辨（1.19:1 对画布）。 */
  --surface-chat-selected: #e3e8fd;
  /* @ 提及色单独压深，白底 5.72:1，且与三种并存蓝里的另两种（#006ce7/#3370ff）合并到同一色相。 */
  --mention: #3b52d9;
  --ink: #14161f;
  /* 空间 rail 从 #e1e8f2 改为 #e5e9f3：与画布 #f4f6fb 保持可辨而不过重（1.12:1）。 */
  --surface-rail: #e5e9f3;
  /* 画布渐变收在同色族内，避免原 #e1e5f1 的第二个蓝色入账。 */
  --workspace-background: linear-gradient(180deg, var(--surface-rail), #dbe1ef);
  --workspace-rail-background: transparent;
  --workspace-header-background: var(--background);
  /* 次级交互前景统一到 --muted-foreground 同族，去掉 #4e5058 的第四种灰。 */
  --interactive: #4e5058;
  /* 频道图标色对白底 3.9:1，满足图形 ≥3:1。 */
  --channel-icon: #7c8294;
  /* 会话侧栏改为纯白面：从画布抬一层，修掉实测「aside #fcfcfc == background #fcfcfc」的零层级。 */
  --sidebar: #ffffff;
  --sidebar-foreground: #14161f;
  --sidebar-primary: var(--brand);
  --sidebar-primary-foreground: var(--brand-foreground);
  --sidebar-accent: #eef0f6;
  --sidebar-accent-foreground: #14161f;
  --sidebar-border: #e2e5ee;
  --sidebar-ring: var(--ring);
}

.dark {
  /* 深色＝蓝调夜间（本方案主场）：画布取 Mercury Onyx #171721 的蓝调版 #151821，
     比原 oklch(0.145 0 0) 纯灰多一层冷蓝，避免「仪表盘式死灰」。 */
  --background: #151821;
  /* 前景取 Mercury Ivory #ededf3 的冷调版；实测对画布 14.62:1。 */
  --foreground: #e7e9f0;
  /* 卡片＝Mercury Graphite 抬升面 #1e1e2a 的蓝调版 #1c1f2a，对画布 1.08:1
     （Mercury 原文 graphite/onyx 实测 1.08:1，属刻意的极微明度抬升，非阴影）。 */
  --card: #1c1f2a;
  --card-foreground: #e7e9f0;
  --popover: #1c1f2a;
  --popover-foreground: #e7e9f0;
  /* 自己气泡＝钴蓝调深面，与本方画布 1.25:1 可辨，文字 11.45:1。 */
  --message-self: #202a44;
  --message-self-foreground: #dfe6ff;
  /* primary/primary-foreground 显式重申为品牌令牌引用：深浅同构，避免只改一处导致主题错位。 */
  --primary: var(--brand);
  --primary-foreground: var(--brand-foreground);
  --secondary: #262a35;
  --secondary-foreground: #e7e9f0;
  /* muted 比 secondary 再低一档，形成 canvas→secondary→muted 三级明度阶梯。 */
  --muted: #22252f;
  /* 次级文字取 Mercury Ash #c3c3cc 的蓝调版 #9aa1b2：对画布 6.85:1、对卡片 6.35:1、对 secondary 5.54:1，全达标。 */
  --muted-foreground: #9aa1b2;
  --accent: #262a35;
  --accent-foreground: #e7e9f0;
  /* 深色下危险色需提亮（原 oklch(0.704 0.191 22.216) 偏粉），实测对画布 7.89:1。 */
  --destructive: #ff8b8f;
  /* 深色发丝线保留白色 12% 透明（对画布 1.42:1），同浅色口径：装饰而非识别边界。 */
  --border: oklch(1 0 0 / 12%);
  /* 深色 input 必须 ≥3:1：实测 #6b7280 对画布 3.67:1、对卡片 3.40:1。 */
  --input: #6b7280;
  --ring: var(--brand);
  --chart-1: #5266eb;
  --chart-2: #7c88f0;
  --chart-3: #9aa1b2;
  --chart-4: #4a4f5e;
  --chart-5: #2b2f3c;
  /* 主色＝Mercury Cobalt #5266eb 原值；白字 4.71:1 达标，故深色保留其鲜度。 */
  --brand: #5266eb;
  --brand-foreground: #ffffff;
  /* 深色 brand-soft 用 18% 透明，保证在 #1c1f2a 上仍可见（合成 #262c4d）。 */
  --brand-soft: rgb(82 102 235 / 0.18);
  /* 深色品牌文字色提亮为 #aab4ff：对画布 9.02:1，对 brand-soft 合成面 6.89:1。 */
  --brand-ink: #aab4ff;
  --surface-chat-soft: #1b2136;
  --surface-chat-selected: #1d2540;
  /* @ 提及色提亮到 #8ea2ff，对画布 7.40:1，与 --brand 同色相不同明度。 */
  --mention: #8ea2ff;
  /* ink（深色下作反相文字/遮罩基色）同画布，避免第二套黑。 */
  --ink: #151821;
  /* 关键修复：原文 .dark 的 --surface-rail 仍是浅色 #e3e5e8，深色下表现为一条浅色竖带（实测）；
     改 #101219（比画布更深），侧栏与画布形成「外深内浅」的夜间层级。 */
  --surface-rail: #101219;
  --workspace-background: linear-gradient(180deg, var(--surface-rail), #12151d);
  /* 深色下 rail 只留极淡分离，不做发光。 */
  --workspace-rail-background: color-mix(in oklab, var(--background) 55%, transparent);
  /* 头部改为 4% 品牌色的极淡纵向渐变，替代原文 3% 的径向泛蓝。 */
  --workspace-header-background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--background), var(--brand) 4%),
    var(--background)
  );
  --interactive: #4e5058;
  --channel-icon: #8b91a3;
  /* 会话侧栏比画布略浅一档（1.04:1），与卡片同族，替代原文与卡片同值的 oklch(0.205 0 0)。 */
  --sidebar: #191c26;
  --sidebar-foreground: #e7e9f0;
  --sidebar-primary: var(--brand);
  --sidebar-primary-foreground: var(--brand-foreground);
  --sidebar-accent: #262a35;
  --sidebar-accent-foreground: #e7e9f0;
  --sidebar-border: oklch(1 0 0 / 12%);
  --sidebar-ring: var(--ring);
}

/* ---------------------------------------------------------------------------
   以下 @theme inline 映射沿用 web/src/styles.css 原文（31–106 行），本次不改动。
   注意：--shadow-e1..e3/--shadow-pop 未改，故 Mercury「零阴影、纯明度分层」在
   shadcn 组件上只能部分落地（组件自带 shadow-e1/e2），列为舍弃项，见 proposal §3/§8。
   --------------------------------------------------------------------------- */
@theme inline {
  --font-heading: var(--font-sans);
  --font-sans:
    "Geist Variable", "gg sans", "Noto Sans SC", "PingFang SC", ui-sans-serif,
    system-ui, "Segoe UI", "Microsoft YaHei", Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono:
    ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  --color-brand-ink: var(--brand-ink);
  --shadow-e1: 0 1px 0 rgb(4 4 5 / 0.08), 0 1.5px 0 rgb(4 4 5 / 0.02);
  --shadow-e2:
    0 2px 4px -1px rgb(15 23 42 / 0.07), 0 6px 16px -4px rgb(15 23 42 / 0.1);
  --shadow-e3:
    0 10px 28px -8px rgb(15 23 42 / 0.16), 0 2px 6px -2px rgb(15 23 42 / 0.06);
  --shadow-pop:
    0 16px 40px -12px rgb(15 23 42 / 0.24), 0 4px 10px -4px rgb(15 23 42 / 0.1);
  --animate-message-in: message-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-rise-in: rise-in 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-drawer-in: drawer-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --animate-drawer-overlay-in: drawer-overlay-in 160ms ease-out;
  --animate-drop-in: drop-in 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-breathe: breathe 1.2s ease-in-out infinite;
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --color-foreground: var(--foreground);
  --color-background: var(--background);
  --color-brand: var(--brand);
  --color-brand-foreground: var(--brand-foreground);
  --color-brand-soft: var(--brand-soft);
  --color-surface-chat-soft: var(--surface-chat-soft);
  --color-surface-chat-selected: var(--surface-chat-selected);
  --color-mention: var(--mention);
  --color-ink: var(--ink);
  --color-surface-rail: var(--surface-rail);
  --color-interactive: var(--interactive);
  --color-channel-icon: var(--channel-icon);
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}
