/**
 * 设计令牌（design tokens）——全站唯一权威来源。
 *
 * 消费方：① legacy 主应用 index.html 直接 <link>（在 style.css 之前）；
 *        ② SPA 经 src/styles/base.css → src/styles/tokens.css（@import 转发到本文件）。
 *
 * 原 css/style.css 的 :root / [data-theme=dark] 变量已全部迁入此处（值原样，视觉零变化），
 * style.css 不再定义这些变量，仅消费 var()。新增分级标度：间距 / 圆角 / 字号 / 层级 / 阴影 / 品牌色阶。
 * 既有变量名（--accent-color/--accent-hover/--radius/--shadow）保留为新标度的别名，故老引用不受影响。
 */
:root {
  /* ===== 布局 ===== */
  --chat-max-width: 960px;            /* 对话区阅读宽度（对齐 Lobe WideScreenContainer，窄屏仍 100%） */
  --chat-inline-padding: 16px;
  --chat-side-gutter: max(var(--chat-inline-padding), calc((100% - var(--chat-max-width)) / 2));
  --sidebar-width: 280px;
  --header-height: 60px;
  --chat-bottom-dock-height: 174px;   /* 侧栏底栏与主区输入区统一高度，使 border-top 分割线对齐 */
  --icp-footer-height: 36px;

  /* ===== 背景 ===== */
  --bg-primary: #fafafa;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #e5e7eb;

  /* ===== 文本 ===== */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  /* ===== 边框 ===== */
  --border-color: #e5e7eb;

  /* ===== 品牌色阶（accent 50–900，基于既有 #2563eb，Tailwind blue 量级） ===== */
  --accent-50: #eff6ff;
  --accent-100: #dbeafe;
  --accent-200: #bfdbfe;
  --accent-300: #93c5fd;
  --accent-400: #60a5fa;
  --accent-500: #3b82f6;
  --accent-600: #2563eb;
  --accent-700: #1d4ed8;
  --accent-800: #1e40af;
  --accent-900: #1e3a8a;
  --accent-color: var(--accent-600);  /* 既有别名（=#2563eb） */
  --accent-hover: var(--accent-700);  /* 既有别名（=#1d4ed8） */

  /* ===== 语义色 ===== */
  --danger-color: #dc2626;
  --success-color: #16a34a;

  /* ===== 消息气泡 ===== */
  --message-user-bg: #2563eb;
  --message-user-text: #ffffff;
  --message-assistant-bg: #eceef2;
  --message-assistant-text: #1f2937;

  /* ===== 侧栏（Lobe 式浅灰底 + 白内容区对比） ===== */
  --sidebar-bg: #eef1f5;
  --sidebar-border: rgba(15, 23, 42, 0.08);
  --sidebar-item-hover: rgba(15, 23, 42, 0.055);
  --sidebar-item-active: #ebebed;
  --chat-main-bg: #ffffff;

  /* ===== 对话区 Markdown（表格 / 代码块外框） ===== */
  --dialog-table-border: #e8e8ec;
  --dialog-table-header-bg: #f0f1f4;
  --dialog-code-frame-bg: #eceef2;
  --dialog-code-header-bg: #e4e6ec;

  /* ===== 间距标度（4px 基准） ===== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* ===== 圆角标度（覆盖现有 4/6/8/10/12 + full） ===== */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;
  --radius: var(--radius-xl);         /* 既有别名（=12px） */

  /* ===== 字号标度（覆盖现有 11–20px） ===== */
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 20px;

  /* ===== 阴影分级 ===== */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow: var(--shadow-sm);         /* 既有别名 */

  /* ===== z-index 分级（覆盖现有 1–20000 量级，供精修时逐步替换硬编码） ===== */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-overlay: 2000;
  --z-modal: 10000;
  --z-popover: 12000;
  --z-toast: 20000;
}

[data-theme="dark"] {
  --bg-primary: #111111;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2d2d2d;

  --text-primary: #ececec;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;

  --border-color: #3f3f3f;

  --message-assistant-bg: #1e1e1e;
  --message-assistant-text: #ececec;

  --sidebar-bg: #141414;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-item-hover: rgba(255, 255, 255, 0.06);
  --sidebar-item-active: #252525;
  --chat-main-bg: #111111;

  --dialog-table-border: #2d2d33;
  --dialog-table-header-bg: #1c1c20;
  --dialog-code-frame-bg: #252528;
  --dialog-code-header-bg: #1e1e22;

  /* 阴影在暗色下加深（别名链 --shadow → --shadow-sm 保持不变） */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}
