/* tokens.css — Things 3 / iOS HIG 视觉令牌（唯一来源）
 *
 * 约定：
 * 1. 组件层只引用变量，禁止硬编码颜色；深浅色必须成对定义。
 * 2. 间距走 4pt 网格；触控热区手机 ≥ 40，平板/桌面 ≥ 44。
 * 3. 金额、日期、剩余天数一律 tabular-nums，纵向不抖动。
 * 4. 主题由 <html data-theme="light|dark"> 驱动（system 由 JS 解析后落值），
 *    避免主题偏好被媒体查询覆盖。
 */

:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", sans-serif;

  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 28px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --tap: 44px;
  --bar-h: 52px;
  --tab-h: 54px;
  --sidebar-w: 248px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* 浅色：冷白画布 + 纯白卡片 + 发丝描边 */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --surface-3: #e8eaee;
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.1);
  --text: #1c1c1e;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --accent: #2f7cf6;
  --accent-press: #2668d6;
  --accent-soft: rgba(47, 124, 246, 0.1);
  --on-accent: #ffffff;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --warn-line: rgba(217, 119, 6, 0.28);
  --danger: #c7362b;
  --danger-soft: rgba(199, 54, 43, 0.1);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
  --shadow-sheet: 0 -12px 48px rgba(16, 24, 40, 0.18);
  --blur-bg: rgba(255, 255, 255, 0.82);
  --backdrop: rgba(18, 22, 28, 0.34);

  /* 语义色：信息 / 成功 / 深墨强调面 */
  --info: #2f7cf6;
  --info-bg: rgba(47, 124, 246, 0.1);
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.12);
  --ink: #1f2a44;
  --on-ink: #ffffff;

  /* 7 个内置分类固定语义色（与 core/schema.js BUILTIN_CATEGORIES 一致） */
  --cat-ai: #a855f7;
  --cat-daily: #22c55e;
  --cat-other: #64748b;
  --cat-fun: #f43f5e;
  --cat-news: #facc15;
  --cat-tool: #f97316;
  --cat-edu: #4f46e5;

  /* 表单输入字号：iOS Safari 聚焦不缩放的下限 */
  --input-font: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f1115;
  --surface: #1b1e24;
  --surface-2: #24272f;
  --surface-3: #2d313a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f4f7;
  --text-2: #a0a4ad;
  --text-3: #6f747d;
  --accent: #4c9aff;
  --accent-press: #3b87e8;
  --accent-soft: rgba(76, 154, 255, 0.16);
  --on-accent: #06101d;
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.16);
  --warn-line: rgba(251, 191, 36, 0.32);
  --danger: #ff6b5e;
  --danger-soft: rgba(255, 107, 94, 0.14);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sheet: 0 -12px 48px rgba(0, 0, 0, 0.5);
  --blur-bg: rgba(27, 30, 36, 0.82);
  --backdrop: rgba(0, 0, 0, 0.56);

  --info: #4c9aff;
  --info-bg: rgba(76, 154, 255, 0.16);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.16);
  --ink: #eef2ff;
  --on-ink: #10141c;

  --cat-ai: #c084fc;
  --cat-daily: #4ade80;
  --cat-other: #94a3b8;
  --cat-fun: #fb7185;
  --cat-news: #fde047;
  --cat-tool: #fb923c;
  --cat-edu: #818cf8;
}
