/* ================================================================
   Todo Web — Minimalist Monochrome
   深灰钢板 + 黑白灰三色。零彩色。
   布局: 顶部导航 + 看板/列表/日历三视图 + 右侧抽屉
   参考: Linear / Notion 的信息密度和留白节奏
   ================================================================ */

/* ----- Reset & Tokens ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ------------------------------------------------------------------
   v3 视觉体系（2026-09-15 第十二轮后重构）
   三层表面：页面(bg-root) → 容器(bg-surface) → 卡片(surface-card)
   ⚠️ 这是整个 UI 的地基。改颜色只改这里，别在组件里硬编码色值。
   ⚠️ 浅色与深色的"层级方向"相反：浅色靠"更白 + 阴影"浮起来，
      深色靠"更亮 + 描边"浮起来。所以卡片必须用 surface-card，
      不能再用 bg-elevated（浅色下 bg-elevated 比容器更暗，会把卡片压沉）。
   ------------------------------------------------------------------ */
:root {
  /* --- 表面三层 --- */
  --bg-root:        #0a0d13;   /* 页面底 */
  --bg-surface:     #11151e;   /* 列容器 / 侧栏 */
  --surface-card:   #171c26;   /* 卡片 —— 比容器亮一档 */
  --bg-elevated:    #1e242f;   /* 弹层 / 输入框 / 内嵌小块 */
  --surface-popover:#1f2632;   /* 菜单 / 气泡（比卡片再亮一档） */
  --bg-hover:       #232a36;
  --bg-active:      #2c3442;
  --bg-overlay:     rgba(4,6,10,.64);

  /* v2.23 补全: 表面系列 (modal/drawer/editor 的背景) */
  --surface-primary:   #131823;
  --surface-secondary: #1a202b;
  --surface-tertiary:  #232a36;

  /* --- 文本 --- */
  --text-primary:     #e9ebf1;
  --text-secondary:   #99a1b2;
  --text-tertiary:    #6a7284;
  --text-warn:        #f0736a;
  --text-muted-label: #b3bac9;

  /* --- 边界 --- */
  --border-subtle:  #1a1f2a;
  --border-default: #232936;
  --border-hover:   #333d4e;
  --border-focus:   #7c86f5;
  --border-control:       #6a7284;   /* 录入类控件的静态边界：对卡片 3.5:1，满足 WCAG 1.4.11 的 3:1 */
  --border-control-hover: #8b93a6;   /* 悬停再亮一档（深色下「更亮」才是更近） */

  /* --- 主色 --- */
  --accent:        #7c86f5;
  --accent-subtle: #212848;
  --accent-hover:  #98a1ff;

  /* --- 板块圆点色板（列头自选色，固定 8 色）---
     ⚠️ 三处必须同序同集：此处 --col-*、routes_board.COLOR_KEYS、app.js
        COLUMN_COLORS。只改一处会出现"用户选了色、前端取不到值"。
     ⚠️ 库里存的是 key（"blue"）不是 hex，就是为了这里 —— 同一个 hex 在白底上
        看得清、放到深底上可能就糊了。两套主题各给一版值才能都保住对比度。
        实测本组对列头底色 #11151e 的最低对比度 5.73（靛蓝），远超控件要求的 3:1。 */
  --col-gray:   #8a93a6;
  --col-blue:   #5aa2f0;
  --col-indigo: #7c86f5;
  --col-violet: #a78bfa;
  --col-teal:   #2dd4bf;
  --col-green:  #5ed08a;
  --col-amber:  #fbbf24;
  --col-rose:   #fb7185;

  /* --- 表单控件（复选框 / 下拉 / 日期 / 聚焦光圈）---
     ⚠️ color-scheme 决定"浏览器自绘部件"（下拉弹层、日期选择器、滚动条）
        跟随哪套配色。不写它，深色页面上会弹出一个浅色的系统下拉框 —— 一眼出戏。
        默认（无 data-theme）就是深色，浅色主题块里覆盖成 light。
     ⚠️ --chevron / --check-mark 是内联 SVG：data URI 里吃不到 currentColor，
        只能按主题各给一套；颜色分别对齐 --text-secondary 与"白勾"。
     ⚠️ --ring 是全站统一的聚焦光圈。以后要改聚焦样式只改这里，
        别再在组件里各写一遍 rgba(59,130,246,.15)（那是旧调色板的蓝）。 */
  color-scheme: dark;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2399a1b2' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.6 6.5L8 9.9l3.4-3.4'/%3E%3C/svg%3E");
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.4l3.1 3.1L12.8 5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --ring: 0 0 0 3px var(--accent-subtle);
  /* 登录页错误条前面那个小图标。用 mask 而不是 background-image：
     mask 只取形状（alpha），颜色交给元素的 currentColor —— 深浅两套主题
     共用一个 data URI，不用各存一份、也不会和文字色脱节。 */
  --login-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6.3'/%3E%3Cpath d='M8 4.8v4'/%3E%3Cpath d='M8 11.3h.01'/%3E%3C/svg%3E");

  /* --- 语义色（成组：底 / 边 / 字）---
     ⚠️ 2026-09-22 扩容：加了 teal / violet / rose 三组（分类色板从 5 色变 8 色）。
     三组的 -text 都按"能在自家 -bg 上当正文"选（≥4.5:1），-bg 是极暗的同色相底、
     -border 比 -bg 再亮一档 —— 与既有五组同一套做法，深浅两套主题各一份。 */
  --c-danger-bg:  #2e1a19;  --c-danger-border:  #4a2725;  --c-danger-text:  #f08b83;
  --c-warn-bg:    #2b2114;  --c-warn-border:    #46351d;  --c-warn-text:    #e8a33d;
  --c-success-bg: #14291f;  --c-success-border: #1f4231;  --c-success-text: #5ed08a;
  --c-teal-bg:    #12282a;  --c-teal-border:    #1d4348;  --c-teal-text:    #5ed0c0;
  --c-info-bg:    #1e2545;  --c-info-border:    #313d6e;  --c-info-text:    #98a1ff;
  --c-violet-bg:  #241e3a;  --c-violet-border:  #37305c;  --c-violet-text:  #c9a7ff;
  --c-rose-bg:    #331a26;  --c-rose-border:    #54283d;  --c-rose-text:    #f9a8d4;
  --c-neutral-bg: #1b212c;  --c-neutral-border: #2a3140;  --c-neutral-text: #99a1b2;

  /* --- 兼容旧名（历史规则仍在引用，勿删）--- */
  --urgent-bg:     var(--c-danger-bg);
  --urgent-border: var(--c-danger-border);
  --urgent-text:   var(--c-danger-text);
  --doing-bg:      var(--c-info-bg);
  --done-bg:       var(--c-success-bg);
  --done-text:     var(--c-success-text);
  --error-text:    var(--c-danger-text);

  /* --- 分类配色 ---
     ⚠️ 2026-09-21 起档位可自定义（增/删/改名/调序），所以这里**不再有按档位
        写死的颜色变量**（原 --pri-urgent-bar / --pri-normal-bar / --pri-low-bar 已删）。
     每个档位只存一个"语义色 key"，前端把它写到元素的 data-pri-color 上，
     再由 [data-pri-color="..."] 那组规则展开成 --pri-bar/--pri-bg/--pri-border/
     --pri-text/--pri-soft 五个变量。所有分类视觉都只引用这五个变量，
     于是**新增档位不需要写任何 CSS**。
     用语义色而不是自定义 hex: 一个档位要同时出现在卡片色条、badge 底/边/字、
     列表圆点、日历标签四处，每处需要的明度都不同；语义色组已为深浅两套主题
     各备好这三件套，直接取用才能保证任何一档在任何主题下都看得清。 */

  /* --- 颜色选择器（板块 8 色 / 分类 6 色共用）---
     ⚠️ 2026-09-22 重做（用户：「色卡调好看一点」）。原来的两处毛病：
     ① 分类色板把 --c-*-text 直接当**填充色**用 —— 那是"浅色底上当文字"的深色档，
        做成 28px 实心块就是一块块旧油漆（浅色主题下是 #b42318 这种发闷的暗红），
        和板块色板（正经的明快色）放在一起完全不像同一套东西。
        → 分类改用自己的**明快填充档**，色系直接对齐板块色板：
          琥珀/绿/靛蓝/灰 取 --col-* 同名档，只有"红"要单开一个值
          （板块的 --col-rose 是玫瑰红偏粉，当"紧急"不好）。
     ② 内描边写死 rgba(0,0,0,.16)，深色弹层上等于没有 → 改用 --swatch-ring 按主题给。 */
  --pri-swatch-danger:  #f2555a;              /* 正红：rose 偏粉，这里单开 */
  --pri-swatch-warn:    var(--col-amber);     /* 连同下面几支，与板块色板同一套色 */
  --pri-swatch-success: var(--col-green);
  --pri-swatch-teal:    var(--col-teal);
  --pri-swatch-info:    var(--col-indigo);
  --pri-swatch-violet:  #c084fc;              /* 紫：col-violet 太靠靛蓝，这里单开一支偏品红的 */
  --pri-swatch-rose:    #f472b6;              /* 洋红粉：col-rose 是绯红，跟"红"撞色 */
  --pri-swatch-neutral: var(--col-gray);
  --pri-swatch-none:    transparent;

  /* 色块内描边（把色块从弹层底色上"拎"出来）：浅色底给暗线、深色底给亮线 */
  --swatch-ring: rgba(255,255,255,.16);

  /* 选中勾：白勾 + 深色描边。
     ⚠️ 为什么不用现成的 --check-mark（纯白勾）：色板里既有亮底（琥珀/青/浅绿）
        又有暗底（靛蓝/正红），还有全透明的「无色」，纯白勾在亮底上看不见。
        加一圈深色描边后，亮底靠描边、暗底靠白勾、透明底靠描边，三种都成立，
        于是**一个勾就够用**，不必按颜色维护多套勾图。 */
  --check-mark-outlined: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.4l3.1 3.1L12.8 5' fill='none' stroke='rgba(0,0,0,0.45)' stroke-width='4.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M3.2 8.4l3.1 3.1L12.8 5' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* --- 阴影 --- */
  --shadow-xs:     0 1px 2px rgba(0,0,0,.30);
  --shadow-card:   0 1px 2px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.22);
  --shadow-hover:  0 4px 14px rgba(0,0,0,.42), 0 1px 3px rgba(0,0,0,.30);
  --shadow-drawer: -6px 0 34px rgba(0,0,0,.52);
  --shadow-menu:   0 10px 30px rgba(0,0,0,.48);
  --shadow-cmdk:   0 24px 70px rgba(0,0,0,.62);
  --shadow-toast:  0 8px 24px rgba(0,0,0,.5);

  --danger:       #e5484d;
  --danger-hover: #c93a3f;
  --on-accent:    #ffffff;

  /* --- 圆角（收敛为 4 档 + 全圆）--- */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-full: 999px;

  /* --- 字号阶梯（收敛为 7 档）---
     旧版散落着 10.2/10.5/10.8/11.1/11.7/12.3/12.75 等 15 种字号，
     全是 rem 换算出来的非整数。新代码一律用下面这些 token。 */
  --fs-2xs: 11px;    /* 角标 / 计数 */
  --fs-xs:  11.5px;  /* meta / 表头 */
  --fs-sm:  12.5px;  /* 次要文字 */
  --fs-md:  13.5px;  /* 正文（默认） */
  --fs-lg:  15px;    /* 小标题 */
  --fs-xl:  17px;    /* 区块标题 */
  --fs-2xl: 21px;    /* 页面标题 */

  --lh-tight: 1.3;
  --lh:       1.55;
  --lh-loose: 1.7;

  --font-mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'JetBrains Mono', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'system-ui',
               'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 120ms;
  --norm: 200ms;
}

/* 浅色：页面浅灰 → 容器更灰 → 卡片纯白 + 轻阴影（靠"白"浮起来）
   ⚠️ --urgent-* / --doing-* / --done-* / --error-text 是 :root 里指向 --c-* 的别名，
      这里只改 --c-* 就会自动跟着变，不要在这里重复定义。 */
[data-theme="light"] {
  /* --- 表面三层 --- */
  --bg-root:        #f6f7f9;
  --bg-surface:     #eef1f5;   /* 列容器 / 侧栏 —— 比页面更灰 */
  --surface-card:   #ffffff;   /* 卡片 —— 纯白，与容器拉开 */
  --bg-elevated:    #f1f3f7;   /* 输入框 / 内嵌小块 */
  --surface-popover:#ffffff;   /* 菜单 / 气泡 —— 白 + 阴影 */
  --bg-hover:       #e7ebf1;
  --bg-active:      #dde2ea;
  --bg-overlay:     rgba(15,20,30,.34);

  /* v2.23 补全: 表面系列 */
  --surface-primary:   #ffffff;
  --surface-secondary: #f1f3f7;
  --surface-tertiary:  #e7ebf1;

  /* --- 文本 --- */
  --text-primary:     #131722;
  --text-secondary:   #59606f;
  --text-tertiary:    #8b93a3;
  --text-warn:        #d0342c;
  --text-muted-label: #6b7284;

  /* --- 边界 --- */
  --border-subtle:  #eef1f6;
  --border-default: #e2e6ee;
  --border-hover:   #ccd3e0;
  --border-focus:   #5b6cf0;
  --border-control:       #808a9b;   /* 对白卡 3.5:1（旧的 #e2e6ee 只有 1.24:1，等于没边界）*/
  --border-control-hover: #5f6a7d;   /* 悬停再深一档（浅色下「更深」才是更近）*/

  /* --- 主色 --- */
  --accent:        #5b6cf0;
  --accent-subtle: #eceffe;
  --accent-hover:  #4855dd;

  /* --- 板块圆点色板（浅色版）---
     实测对白色列头的最低对比度 3.09（灰），全部 ≥3:1。
     取值整体比深色版深一档 —— 浅底上要更深才够看，深底上要更亮才够看。 */
  --col-gray:   #8b93a3;
  --col-blue:   #3b7ddd;
  --col-indigo: #5b6cf0;
  --col-violet: #8b5cf6;
  --col-teal:   #0d9488;
  --col-green:  #15803d;
  --col-amber:  #d97706;
  --col-rose:   #e11d48;

  /* 颜色选择器：浅色主题下要覆盖的两项（其余 --pri-swatch-* 都是 var(--col-*) 自动跟随）。
     红：深色版的 #f2555a 在白色弹层上太飘，压深一档成一枚干净的正红。
     粉：同理，深色版那支在浅底上偏灰。 */
  --pri-swatch-danger: #e03131;
  --pri-swatch-rose:   #ec4899;
  --pri-swatch-violet: #9333ea;
  --swatch-ring: rgba(15,23,42,.14);

  /* 浅色下原生部件（下拉弹层 / 日期选择器 / 滚动条）走浅色。
     --check-mark 的白勾与 --ring 引用 --accent-subtle，在浅色下自动正确，不用重复定义。 */
  color-scheme: light;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2359606f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.6 6.5L8 9.9l3.4-3.4'/%3E%3C/svg%3E");

  /* --- 语义色 --- */
  --c-danger-bg:  #fdf0ef;  --c-danger-border:  #f8d5d2;  --c-danger-text:  #b42318;
  --c-warn-bg:    #fdf6e8;  --c-warn-border:    #f7e3b8;  --c-warn-text:    #9a6311;
  --c-success-bg: #e9f8ef;  --c-success-border: #c6ecd6;  --c-success-text: #0f7a44;
  --c-teal-bg:    #e7f7f4;  --c-teal-border:    #c2e9e1;  --c-teal-text:    #0f766e;
  --c-info-bg:    #eceffe;  --c-info-border:    #d7ddfc;  --c-info-text:    #4353d6;
  --c-violet-bg:  #f4f0ff;  --c-violet-border:  #ded4fb;  --c-violet-text:  #7e22ce;
  --c-rose-bg:    #fdeef5;  --c-rose-border:    #f9cfe0;  --c-rose-text:    #be185d;
  --c-neutral-bg: #f1f3f7;  --c-neutral-border: #e2e6ee;  --c-neutral-text: #59606f;

  /* --- 分类色条：已改用语义色组，见 :root 里的说明 --- */

  /* --- 阴影 --- */
  --shadow-xs:     0 1px 2px rgba(16,24,40,.05);
  --shadow-card:   0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-hover:  0 6px 16px rgba(16,24,40,.10), 0 1px 3px rgba(16,24,40,.06);
  --shadow-drawer: -6px 0 34px rgba(16,24,40,.10);
  --shadow-menu:   0 12px 32px rgba(16,24,40,.13), 0 2px 6px rgba(16,24,40,.06);
  --shadow-cmdk:   0 24px 64px rgba(16,24,40,.20);
  --shadow-toast:  0 8px 24px rgba(16,24,40,.13);

  --danger:       #d92d20;
  --danger-hover: #b42318;

  /* 浅色下两套字体栈都要带 Segoe UI —— Windows 上 'system-ui' 解析结果不稳定 */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'system-ui',
               'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
}

/* 基准字号 15 → 16px（2026-09-15）。
   旧版全站字号是 .68/.78/.82/.85rem 这种相对值，在 15px 基准下换算成
   10.2/11.7/12.3/12.75px 等一堆非整数、且整体偏小（中文在 11px 下发虚）。
   抬到 16px 后同一批 rem 统一放大 6.7%，配合 --lh 1.55，可读性立竿见影。
   ⚠️ 这是全局缩放，改完必须在 1440/1024/768/390/320 五个宽度验横向溢出。 */
html {
  font-size: 16px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-sans);
  background: var(--bg-root);
  color: var(--text-primary);
  font-size: var(--fs-md);
  line-height: var(--lh);
  min-height: 100vh;
}

/* ================================================================
   表单控件（2026-09-15 第十四轮统一）
   原生 checkbox / select / datetime-local 的长相由浏览器决定：
   Win 上下拉是个实心三角、复选框圆角各家不同、深色下还弹白底弹层。
   这里统一成一套语言：输入井底 + 1px 描边 + 主色勾/箭头 + 同一枚聚焦光圈。
   ⚠️ 具体控件（.drawer-section select / .notes-sort-select）后续若要用
      background 简写会把这些清掉 —— 要改底色请写 background-color。
   ================================================================ */

/* --- 下拉菜单：appearance:none 后用 token 里的 SVG 箭头自绘 --- */
select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 30px 7px 11px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background-color: var(--bg-elevated);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.35;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
select:hover { border-color: var(--border-control-hover); }
select:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
select:disabled { opacity: .55; cursor: not-allowed; }
/* 展开后的弹层本体由系统绘制（已由 color-scheme 控制）；
   option 再显式给一遍颜色，兜住不认 color-scheme 的浏览器 */
option { background: var(--surface-popover); color: var(--text-primary); }

/* --- 复选框：统一 16px / 4px 圆角 / 线性白勾，与批量多选那个自绘勾选框同款 --- */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 16px; height: 16px;
  margin: 0;
  /* ⚠️ 不要写 1.5px：Chromium 会把小数边框向下取整到整数 CSS 像素，
     1.5px 在 Chrome/Edge 里实测就是 1px（Firefox 却是 1.5px）——
     与其跨浏览器不一致，不如统一写 1px，粗细交给「边界色」去保证可辨识度。 */
  border: 1px solid var(--border-control);
  border-radius: var(--radius-xs);
  background-color: var(--bg-elevated);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
  vertical-align: -3px;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
input[type="checkbox"]:hover { border-color: var(--accent); }
input[type="checkbox"]:checked {
  background-color: var(--accent);
  background-image: var(--check-mark);
  border-color: var(--accent);
}
input[type="checkbox"]:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
input[type="checkbox"]:disabled { opacity: .45; cursor: default; }

/* --- 日期时间：同样去掉系统外观；指示器图标交给 color-scheme 反色 --- */
input[type="datetime-local"] {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
}
input[type="datetime-local"]:hover { border-color: var(--border-control-hover); }
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .6;
  transition: opacity var(--fast) var(--ease);
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ===== Top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  /* 2026-09-14 重排: 视图切换组居左 → 搜索框 flex:1 铺满中间 → 工具按钮居右 */
  display: flex; align-items: center; justify-content: flex-start;
  height: 48px;
  padding: 0 12px;
  background: color-mix(in srgb, var(--bg-root) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
}

/* .topbar-left 已于 2026-09-14 移除 (无任何内容), 顶栏只剩右侧控件 */
/* 内部布局: 视图切换组(左) + 搜索框(flex:1 铺满) + 工具按钮(右) */
.topbar-right { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
/* 固定宽度的控件不许被 flex:1 的搜索框挤压 */
.view-switcher, .topbar-right .icon-btn, .avatar { flex: none; }

/* Primary nav (全部/待办/已过期/已完成) 已于 2026-09-14 按用户要求整块移除;
   其后筛选行的状态下拉也一并移除 —— 状态筛选只剩快捷键 1/2/3/4, 无可见控件。 */

/* Top bar buttons */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-secondary);
  border-radius: var(--radius); cursor: pointer;
  font-size: 1.05rem; font-weight: 400;
  transition: all var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ===== 主题开关 (太阳 / 月亮) =====
   两个图标绝对叠放在同一按钮里, 由 html[data-theme] 决定谁可见 —— 切换主题时
   图标自动更换, 不需要 JS 碰 DOM; 换的一瞬间做「旋转 + 缩放 + 淡入」过渡。
   语义: 图标表示「点一下会切到哪个模式」→ 暗色显示太阳, 亮色显示月亮。 */
.theme-toggle { position: relative; overflow: hidden; }
.theme-icon {
  position: absolute; inset: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 420ms var(--ease), opacity 240ms var(--ease);
}
/* 暗色主题 (html 上没有 data-theme="light") */
html:not([data-theme="light"]) .theme-icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
html:not([data-theme="light"]) .theme-icon-moon { opacity: 0; transform: rotate(-90deg) scale(.35); }
/* 亮色主题 */
html[data-theme="light"] .theme-icon-sun { opacity: 0; transform: rotate(90deg) scale(.35); }
html[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
/* 按下时轻微回弹, 点击更有手感 */
.theme-toggle:active { transform: scale(.9); }
/* 尊重系统「减少动态效果」偏好: 只留淡入淡出, 不做旋转缩放 */
@media (prefers-reduced-motion: reduce) {
  .theme-icon { transition: opacity 120ms linear; }
  html:not([data-theme="light"]) .theme-icon-sun,
  html:not([data-theme="light"]) .theme-icon-moon,
  html[data-theme="light"] .theme-icon-sun,
  html[data-theme="light"] .theme-icon-moon { transform: none; }
}

.avatar {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default); border-radius: 50%;
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  overflow: hidden;                  /* 自定义头像图片裁在圆里 */
  padding: 0;
}
.avatar-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  border-radius: 50%;
}

.search-trigger {
  display: inline-flex; align-items: center;
  flex: 1; min-width: 0;            /* 自适应: 铺满顶栏剩余宽度 */
  padding: 4px 10px; gap: 6px;
  border: 1px solid var(--border-default); border-radius: var(--radius);
  background: var(--bg-surface); color: var(--text-tertiary);
  font-size: .82rem; cursor: pointer;
  transition: all var(--fast) var(--ease);
}
.search-trigger:hover { border-color: var(--border-focus); color: var(--text-secondary); }
.kbd {
  font-family: var(--font-mono); font-size: .68rem;
  padding: 1px 5px; border-radius: 4px;
  background: var(--bg-active); color: var(--text-tertiary);
  margin-left: auto;                /* 搜索框铺满后, 快捷键提示推到右端 */
}

.user-menu {
  position: absolute; top: 44px; right: 8px;
  background: var(--surface-popover); border: 1px solid var(--border-default);
  border-radius: var(--radius); padding: 4px;
  min-width: 172px; box-shadow: var(--shadow-menu);
}
.user-menu a { display: block; padding: 6px 10px; border-radius: var(--radius-sm);
               color: var(--text-secondary); text-decoration: none; font-size: .85rem; }
.user-menu a:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-menu hr { border: none; border-top: 1px solid var(--border-default); margin: 4px 0; }

.view-switcher { display: flex; gap: 1px; }
.view-tab {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 30px; padding: 0 10px;   /* 桌面端 = 图标 + 文字, 宽度自适应; 窄屏由下方 @media 收成方形图标 */
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
  white-space: nowrap;
}
.view-tab-text { font-size: .8rem; font-weight: 500; line-height: 1; }
.view-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.view-tab.active { background: var(--accent-subtle); color: var(--accent); }
/* 旧版图标 opacity .6 在浅色下发虚 —— 抬到 .85，active 才是纯色 */
.view-tab svg { flex: none; opacity: .8; }
.view-tab.active svg { opacity: 1; }

/* ===== Filter chips ===== */
.filter-chips {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-root); border-bottom: 1px solid var(--border-default);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  touch-action: pan-y;       /* 允许垂直页面滑动, 水平才走容器滚动 */
  overscroll-behavior-x: contain;  /* 横滑到边界不传给页面 */
}
/* .filter-chips-spacer 已于 2026-09-14 移除 —— 筛选行由「靠右」改为左对齐 */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border: 1px solid var(--border-default);
  border-radius: 100px; background: transparent;
  color: var(--text-secondary); font-size: .78rem;
  cursor: pointer; white-space: nowrap;
  transition: all var(--fast) var(--ease);
}
.chip:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.chip-clear-x { font-weight: 600; margin-left: 2px; opacity: .5; }
.chip-clear {
  border-color: transparent; color: var(--text-tertiary);
}
/* .chip-toggle / .chip-toggle-text 已随「书签 / 管理」两个按钮移除 (2026-09-14)。
   筛选行现在只有一个 .chip-clear, 无筛选条件时整行由 updateClearChip() 收起。 */

/* 状态筛选下拉 已于 2026-09-14 按用户要求移除 (筛选行不再有状态下拉控件)。
   状态筛选能力仅保留键盘快捷键 1/2/3/4, 仍走 setScope(); 相关样式不再需要。 */

/* ===== 小记视图 (独立视图: 左侧筛选栏 + 右侧书写浏览区) ===== */
.notes-view {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* --- 左侧筛选栏 --- */
.notes-side {
  width: 176px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.notes-side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notes-side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 9px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: .78rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.notes-side-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.notes-side-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 500;
}
.notes-side-count {
  font-size: .68rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.notes-side-section { display: flex; flex-direction: column; gap: 6px; }
.notes-side-title {
  margin: 0;
  display: flex;               /* 让下面 .notes-side-add 的 margin-left:auto 真正生效 */
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  /* ⚠️ 不再写 letter-spacing: 对中文无效, 只把字距拉散发虚 (跟 .drawer-section label 同款教训)。
     颜色从 --text-tertiary 提到 --text-secondary —— 它现在是个可点击的开关, 太淡就不像能点。 */
  color: var(--text-secondary);
}
/* 目录区块的折叠开关: 整块标题行可点, 前面一枚会转的 caret */
.notes-side-toggle {
  flex: 1; min-width: 0;
  display: inline-flex; align-items: center; gap: 3px;
  border: 0; background: transparent; color: inherit;
  font: inherit; padding: 1px 0; cursor: pointer;
  text-align: left; border-radius: 5px;
  transition: color .16s var(--ease);
}
.notes-side-toggle:hover { color: var(--text-primary); }
.notes-side-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.nst-caret {
  flex: none; font-size: 10px; line-height: 1;
  transition: transform .18s var(--ease);
}
/* 收起: caret 转 -90° + 整棵树不显示 */
.notes-side-section.is-folded .nst-caret { transform: rotate(-90deg); }
.notes-side-section.is-folded .note-folder-tree { display: none; }
.notes-side-empty { font-size: .72rem; color: var(--text-muted-label); }
.notes-tag-filter { display: flex; flex-wrap: wrap; gap: 4px; }

/* --- 右侧主区 --- */
.notes-main { flex: 1; min-width: 0; }

.notes-main-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.notes-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  transition: border-color var(--fast);
}
.notes-search:focus-within { border-color: var(--border-focus); }
.notes-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: .8rem;
  font-family: inherit;
}
.notes-search input::placeholder { color: var(--text-tertiary); }
.notes-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}
.notes-search-clear:hover { color: var(--text-primary); background: var(--bg-surface); }

/* 外观（描边/底/箭头/聚焦）全部继承通用 select；这里只管尺寸，
   好跟右边那排「附件 / 导入任务 / 模板」按钮等高。
   旧版字号 .74rem(11.8px) 比邻居小一档，看着像没做完。 */
.notes-sort-select {
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.notes-sort-select:hover { color: var(--text-primary); }

/* --- 书写区 --- */
.notes-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background: var(--bg-surface);
}
.notes-composer textarea {
  width: 100%;
  padding: 2px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: .82rem;
  font-family: inherit;
  line-height: 1.55;
  outline: none;
  /* 高度按内容自适应 (JS: autoGrowNoteInput), 这里只兜住上下限:
     min-height 保证空着时也是一块看得见的书写区, max-height 到了就出滚动条。
     ⚠️ 因此不能用 resize: vertical —— 用户手拖出来的高度会被下一次输入
     立刻覆盖掉, 手感自相矛盾; 自适应本身就替代了这个需求。 */
  resize: none;
  overflow-y: auto;
  min-height: 44px;
  max-height: 240px;
}
.notes-composer textarea::placeholder { color: var(--text-tertiary); }
.notes-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
/* 快速新增的标签行: 已选在前、候选在后 (最多 8 个), 没有标签时整行隐藏 */
.notes-quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.notes-quick-tags.hidden { display: none; }
.notes-quick-tags .nqt-label {
  font-size: .68rem;
  color: var(--text-tertiary);
}
.notes-quick-tags .nqt-empty {
  font-size: .68rem;
  color: var(--text-tertiary);
  font-style: italic;
}
/* "+ 新建" 用虚线胶囊, 和真标签区分开 */
.note-tag-chip.nqt-add {
  background: transparent;
  border-style: dashed;
  border-color: var(--border-control);
  color: var(--text-tertiary);
}
.note-tag-chip.nqt-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.note-tag-new-inline { flex: 0 1 220px; }
/* 孤儿标签的 ×: 平时淡, hover chip 时才显眼, 避免手滑 */
.note-tag-chip .nqt-del {
  margin-left: 4px;
  padding: 0 2px;
  font-weight: 700;
  opacity: .45;
  border-radius: 50%;
}
.note-tag-chip:hover .nqt-del { opacity: .9; }
.note-tag-chip .nqt-del:hover { background: color-mix(in srgb, var(--tag-c, #e0614f) 30%, transparent); }
.notes-composer-hint { font-size: .7rem; color: var(--text-tertiary); }
.notes-composer-hint code {
  font-family: var(--font-mono);
  font-size: .68rem;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-elevated);
}

/* 卡片栅格: 面板时代是"横向滚动一行", 独立视图空间大得多,
   改为自动换行网格 —— 一屏能看到更多条, 也不用横向拖 */
.notes-grid {
  display: grid;
  /* ⚠️ 这里用 auto-fit（不是 auto-fill）:
     auto-fill 会先按容器宽度把轨道铺满(1223px 下铺 4 条), 只有 3 条小记时
     第 4 条空轨道照样占位 → 右侧空出约 310px, 看着像卡片"没排满"。
     auto-fit 折叠掉完全没内容的轨道, 剩下的列自己撑满整行。
     ⚠️ 上限必须是 1fr, 不能写 420px 这种确定值:
        轨道上限是确定值时, 列数按"上限"算(1223px 只能放下 2 个 420px),
        结果反而只剩 2 列、右边留一大块空白。 */
  /* v=235: 272px→320px, 1080p(1920宽, 容器≈1680px)下 6 列收成 5 列 (用户要求)。
     320 的依据: floor((1680+10)/(320+10))=5; 再大(330+)会掉到 4 列。 */
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
  align-content: start;
}
.notes-empty {
  grid-column: 1 / -1;
  padding: 28px 12px;
  text-align: center;
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
/* 「加载更多」: 列表一次只画 NOTE_RENDER_STEP 张，滚近末尾自动补
   （见 app.js 的 bindNoteInfiniteScroll），按钮留作兜底。
   slot 是网格子元素，跨整行(grid-column:1/-1)并居中，不占卡片轨道；
   哨兵(1px)压在按钮**上方** —— rootMargin 提前 400px 触发，正常滚动时
   按钮还没进视口就已经自动补上了，所以平时基本看不到这颗按钮。 */
.notes-more-slot {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.notes-sentinel { width: 100%; height: 1px; }
.notes-more {
  min-height: 36px;
  padding: 7px 24px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast);
}
.notes-more:hover { color: var(--accent); border-color: var(--accent); }
.notes-more:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
/* 翻到底后的收尾提示 —— 让"没有了"是明确的, 而不是"按钮悄悄消失了" */
.notes-more-end {
  grid-column: 1 / -1;
  padding: 6px 0 2px;
  text-align: center;
  font-size: .7rem;
  color: var(--text-tertiary);
}
/* === v=204 懒加载共用尾部 (看板列底 / 回收站 / 修订历史抽屉) ===
   视觉与小记的 .notes-more 家族一致, 但这三处的容器各不相同 (看板列是 flex 纵向、
   回收站/抽屉是普通块级列表), 所以单独立一组而不是挂在 .notes-more-slot 下 ——
   任何一处都要能脱离小记栅格独立显示。回收站沿用 .notes-more-slot 容器 + 本组按钮。 */
.col-more-slot,
#rev-more-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 4px 0;
}
.col-sentinel { width: 100%; height: 1px; }
.col-more {
  min-height: 36px;
  padding: 7px 24px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast);
}
.col-more:hover { color: var(--accent); border-color: var(--accent); }
.col-more:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.col-more-end {
  padding: 6px 0 2px;
  text-align: center;
  font-size: .7rem;
  color: var(--text-tertiary);
}
.note-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  /* ⚠️ 必须是 --surface-card, 不能用 --bg-elevated:
     浅色下 --bg-elevated(#f1f3f7) 比页面底 --bg-root(#f6f7f9) 还要暗 ——
     卡片会"凹"下去, 一眼看着像没启用; 深色下又是反过来偏亮。
     更要命的是卡片里的 code/pre 用的就是 --bg-elevated, 同色 → 代码块看不见。
     改这里必须同步三处: 本行、.is-clamped::after 的渐变终点、
     .note-actions 的背景 + 3px 同色 halo。漏一处就露馅。 */
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: default;
  position: relative;
  /* 保存后的一次性高亮 (见 .is-just-saved) 也靠这条 transition 渐变进出 */
  transition: border-color var(--fast), box-shadow var(--fast);
  word-break: break-word;
  white-space: pre-wrap;
}
/* 置顶卡: 左侧一条强调色, 一屏卡片里扫一眼就能认出来 */
.note-card.is-pinned {
  border-left: 3px solid var(--accent);
}
.note-card.is-pinned .note-icon-btn.is-on { color: var(--accent); }
.note-card .note-text {
  display: block;
  word-break: break-word;
  white-space: pre-wrap;
}
/* ===== 小记的 Markdown 渲染 =====
   v=264 起这套规则由「卡片正文」和「查看全文弹窗」**共用** —— 所以前缀是
   .note-text.markdown-body 而不是 .note-card .note-text.markdown-body。
   原先只挂在 .note-card 下，弹窗里一条都不匹配，预览看着就是纯文本。
   卡片专属的东西（截断渐隐 .is-clamped、展开上限 .is-expanded）仍带 .note-card 前缀。
   卡片现在是"渲染结果的唯一落点"（编辑器里已不放预览），所以层级必须真的拉开:
   标题 > 正文 > 元信息 三级, 段落之间要有呼吸, 代码块必须与卡片底区分开。
   ⚠️ 改卡片底色时必须同步 .is-clamped::after 的渐变终点与 .note-actions 的 halo。 */
.note-text.markdown-body {
  white-space: normal;
  position: relative;
  /* 正文用主色 —— 原来是继承卡片的次级色, 整张卡发灰、像"未启用" */
  color: var(--text-primary);
  font-size: .84rem;
  line-height: 1.62;
}
/* v=221: 收起态不再写死 max-height: 260px。
   写死的问题: 卡片被同排更高的邻居拉伸后(gird align-items:stretch), 文字仍卡在 260px,
   下面空出一大片 —— 实测某排卡片 487px 高, 而收起的那张只显示 260px 里的内容。
   改成 flex-basis:
     · basis 260px → 它对"行高的贡献"还是 260px, 整屏密度跟以前一样;
     · flex-grow 1  → 同排更高时它继续长高, 把卡片铺满, 于是能多露出几行内容。
   同理, 同排里的短文卡由 .note-foot 的 margin-top:auto 把页脚压到底,
   空白收在正文与页脚之间, 卡片底边也就跟同排对齐了。 */
.note-text.markdown-body.is-clamped {
  flex: 1 1 260px;
  min-height: 0;
  overflow: hidden;
}
/* 折叠态底部渐隐 —— 用渐隐暗示"下面还有", 比硬切一行更清楚。
   渐变终点必须与卡片底色一致, 否则底部会露出一条色差带。 */
.note-text.markdown-body.is-clamped::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: linear-gradient(transparent, var(--surface-card));
  pointer-events: none;
}
/* 展开态也要设上限: 实测 9987 字的小记完全展开会把卡片撑到 16219px, 且
   align-items:stretch(同行等高) 会把同一排另外几张一起拉到这个高度 —— 一屏之内全是空白。
   收成"卡片内部滚动"后高度恒在视口量级; 短文不受影响(max-height 只是上限)。
   渐隐 ::after 只挂在 .is-clamped 上, 展开态刻意不显示 —— 底部渐隐会误导"下面还有"。 */
.note-text.markdown-body.is-expanded {
  max-height: 70vh;
  overflow-y: auto;
}
/* 标题: 原来 h1/h2/h3 都是 .88rem（比正文只大 1px）→ Markdown 的层级在卡片里
   等于不存在; h4~h6 更是压根没定义, 直接吃浏览器默认。现按 3 级 + 兜底展开。 */
.note-text.markdown-body h1,
.note-text.markdown-body h2,
.note-text.markdown-body h3,
.note-text.markdown-body h4,
.note-text.markdown-body h5,
.note-text.markdown-body h6 {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 12px 0 5px;
}
.note-text.markdown-body h1 { font-size: 1.05rem; }
.note-text.markdown-body h2 { font-size: .97rem; }
.note-text.markdown-body h3 { font-size: .9rem; }
.note-text.markdown-body h4,
.note-text.markdown-body h5,
.note-text.markdown-body h6 {
  font-size: .86rem;
  color: var(--text-secondary);
}
/* 首个子元素不留上边距 —— 否则卡片顶部会白白空出一条 */
.note-text.markdown-body > :first-child { margin-top: 0; }
.note-text.markdown-body p { margin: 0 0 6px; }
.note-text.markdown-body p:last-child { margin-bottom: 0; }
.note-text.markdown-body ul,
.note-text.markdown-body ol {
  margin: 0 0 6px;
  padding-left: 20px;
}
.note-text.markdown-body li { margin: 2px 0; }
/* normalizeNoteMarkdown() 会把"松散清单"里多余的 <p> 脱掉, 这条是兜底 */
.note-text.markdown-body li > p { margin: 0; }
.note-text.markdown-body li > ul,
.note-text.markdown-body li > ol { margin: 2px 0 0; }
/* 待办项 (- [ ]): marked 不输出 .task-list-item, 所以项目符号会跟复选框一起显示
   → 「• ☐ 事项」。这里去掉符号, 并用 flex 做出悬挂缩进 ——
   否则长事项折行后第二行会顶回项目符号的位置, 看着像两条不同的项。
   负 margin 抵消 ul 的 padding-left, 让复选框与正文左边缘对齐。 */
.note-text.markdown-body li:has(input[type="checkbox"]) {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  list-style: none;
  margin-left: -20px;
}
.note-text.markdown-body li:has(input[type="checkbox"]) > input {
  flex: none;
  margin: 4px 0 0;
  vertical-align: baseline;
}
/* 代码: 卡片底色原先是 --bg-elevated, 而 code/pre 也用 --bg-elevated ——
   两者同色, 代码块在卡片里只有 padding 没有边界, 等于看不见。
   卡片底色已改 surface-card, 这里再补一条发丝边, 保证任何主题下都分得开。 */
.note-text.markdown-body code {
  font-size: .78rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  padding: 1px 4px;
  border-radius: 4px;
  font-family: var(--font-mono);
}
.note-text.markdown-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0 0 6px;
  line-height: 1.55;
}
.note-text.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .78rem;
}
/* 引用: 原来只有一根 --border-default 的浅竖线, 在卡片上几乎看不到; 补淡底 + 圆角 */
.note-text.markdown-body blockquote {
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 5px 10px;
  margin: 0 0 6px;
  color: var(--text-secondary);
}
.note-text.markdown-body blockquote > :last-child { margin-bottom: 0; }
/* 链接常显下划线: 正文里只靠颜色区分链接不满足 WCAG 1.4.1
   (色觉障碍用户看不出哪儿能点), 而且卡片正文密度高, 光靠颜色很难扫。 */
.note-text.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.note-text.markdown-body a:hover {
  text-decoration-color: var(--accent);
}
/* max-height 兜住长截图: 竖版长图会把卡片撑得比屏幕还高 (展开后不受 is-clamped 管) */
.note-text.markdown-body img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.note-text.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 8px 0;
}
/* 窄卡片里的宽表格: 交给 normalizeNoteMarkdown() 包出来的滚动容器, 别撑破栅格 */
.md-table-wrap { overflow-x: auto; margin: 0 0 6px; }
.note-text.markdown-body table {
  border-collapse: collapse;
  font-size: .78rem;
  line-height: 1.45;
}
.note-text.markdown-body th,
.note-text.markdown-body td {
  border: 1px solid var(--border-default);
  padding: 3px 8px;
  text-align: left;
  white-space: nowrap;
}
.note-text.markdown-body th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
}
/* 注: 这里原本有一整段"裸 .markdown-body"的 Markdown 渲染样式, 是给编辑器
   预览区(2026-09-23 已撤掉)用的。现在 DOM 里唯一的 .markdown-body 就是小记卡片,
   而卡片有一整套更具体的选择器(.note-text.markdown-body ),
   裸选择器永远轮不到 → 整段删除。下面两条卡片也在用, 保留。 */
/* 附件下载链接: 长文件名不要撑破卡片 */
.note-file-link { word-break: break-all; }
.note-text.markdown-body a.note-file-link { word-break: break-all; }
/* 图片可点击放大 (小记卡片很窄, 截图要能看清)。
   ⚠️ 这条同时是 app.js 里 lightbox 点击代理的挂载依据(委托选择器是
   `.markdown-body img`), 别只当装饰删掉。 */
.markdown-body img { cursor: zoom-in; }
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .82);
  cursor: zoom-out;
}
.img-lightbox.open { display: flex; }
.img-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
/* 拖拽图片到输入框时的落点提示 */
.note-edit-pane textarea.note-drop-active,
.note-edit-pane .note-edit-rich.note-drop-active,
.notes-composer textarea.note-drop-active {
  border-color: var(--accent);
  background: var(--bg-surface);
}
.note-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
}
/* 保存后的一次性高亮 (app.js 的 flashNoteCard 加/去这个类, 700ms)
   编辑器里已经没有预览了, "改的效果对不对"全靠列表卡片来回答 ——
   一眼扫不到是哪张卡就等于没有反馈。
   刻意只用 border + box-shadow: 卡片在栅格里占固定位置, 一旦缩放或位移,
   整行卡片都会跟着抖一下。 .note-card 上已有这两项的 transition, 进出都是渐变的。 */
.note-card.is-just-saved {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
/* 卡片页脚 (展开按钮 / 标签 / 时间): 整块沉到卡片底部。
   短文卡被同排拉高时, 空白就收在正文与页脚之间, 而不是全堆在卡片底部 ——
   同排卡片的时间行因此对齐, 一眼看着是"排好的"而不是"没长齐"。 */
.note-card .note-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}
.note-card .note-time {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  color: var(--text-tertiary);
  margin-top: 6px;
  line-height: 1.4;
}
.note-card.is-archived {
  border-style: dashed;
  opacity: .8;
}
.note-card .note-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  /* 必须抬层: 正文容器是 position:relative 且 DOM 顺序在后,
     同为定位元素时后来的在上 —— 不设 z-index 的话正文会盖住这排按钮,
     表现就是"图标看得见、鼠标点不着" */
  z-index: 2;
  display: flex;
  gap: 0;
  padding: 1px 2px;
  border-radius: var(--radius-sm);
  /* 桌面端保留"悬停才浮出"的习惯做法(Trello/Notion 同款), 但浮层必然压字 ——
     实测 299px 卡上压住第一行 172px(63%)。所以这层要尽量收窄:
     gap 归零、halo 降到 2px、图标内边距 5px→4px, 178px → 约 156px。
     ⚠️ 想在桌面端也做到零遮挡, 得把它挪进卡片底部那行(和 .note-time 同排),
     那是结构性改动, 用户拍板了再做。
     ⚠️ 这两行必须跟着 .note-card 的底色走 (现在是 --surface-card) ——
     底色改了 halo 没改, 那圈 2px 会显出一个方块。 */
  background: var(--surface-card);
  box-shadow: 0 0 0 2px var(--surface-card);
  opacity: 0;
  transition: opacity .15s;
}
.note-card:hover .note-actions {
  opacity: 1;
}
.note-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  /* 5px→4px: 操作条是浮层, 每颗省 2px, 7 颗省 14px —— 浮层压字就少 14px */
  padding: 2px 4px;
  color: var(--text-tertiary);
  border-radius: 4px;
  line-height: 1;
}
.note-icon-btn:hover {
  background: var(--bg-hover);   /* ⚠️ 原为 var(--bg-base), 该变量不存在 → 悬停无底色 */
  color: var(--text-primary);
}
.note-icon-delete:hover { color: var(--danger); }

/* 置顶图钉的"已开启"态 */
.note-card .note-icon-btn.is-on { color: var(--accent); }

/* 卡片底部的标签 —— 柔和彩色胶囊 (2026-09-22 重做:
   原来是一圈细线空胶囊, 颜色只出现在 1px 描边上, 又细又挤显得廉价) */
.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.note-tag {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  line-height: 1.5;
  padding: 1px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-c, var(--text-secondary)) 13%, transparent);
  color: var(--tag-c, var(--text-secondary));
  border: 1px solid color-mix(in srgb, var(--tag-c, var(--text-secondary)) 30%, transparent);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.note-tag:hover {
  background: color-mix(in srgb, var(--tag-c, var(--text-secondary)) 22%, transparent);
}

/* 「展开全文 / 收起」 */
.note-expand {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: .7rem;
  font-family: inherit;
  cursor: pointer;
}
.note-expand:hover { text-decoration: underline; }

/* Markdown 待办清单的复选框(bindNoteCheckboxes 会解除 disabled)
   外观已由通用 input[type=checkbox] 规则接管 —— 旧版靠 accent-color 让浏览器
   自己画，勾形/圆角/尺寸全由浏览器定，跟批量多选那个自绘勾选框是两种长相。
   这里只留行内对齐：16px 的方框下沉 3px 才跟中文正文的视觉中线齐。 */
.note-card .note-text input.note-check {
  margin-right: 5px;
  vertical-align: -3px;
}

/* --- 标签配色 ---
   色名由数据库给出, 这里做白名单映射: 认不出的色名落到默认灰,
   不会因为拼出一个没定义的 class 就整个失去样式。
   v=277: 新建标签弹窗里的色点 (.tagc-dot) 也走这一套 —— 颜色只在这里定义一次,
   弹窗那边靠 --tag-c 取色, 以后加档位也不用改两处。 */
.note-tag.tag-blue,   .notes-tag-chip.tag-blue,   .note-tag-chip.tag-blue,   .tagc-dot.tag-blue   { --tag-c: #5b8def; }
.note-tag.tag-green,  .notes-tag-chip.tag-green,  .note-tag-chip.tag-green,  .tagc-dot.tag-green  { --tag-c: #3fb27f; }
.note-tag.tag-amber,  .notes-tag-chip.tag-amber,  .note-tag-chip.tag-amber,  .tagc-dot.tag-amber  { --tag-c: #d99a2b; }
.note-tag.tag-red,    .notes-tag-chip.tag-red,    .note-tag-chip.tag-red,    .tagc-dot.tag-red    { --tag-c: #e0614f; }
.note-tag.tag-purple, .notes-tag-chip.tag-purple, .note-tag-chip.tag-purple, .tagc-dot.tag-purple { --tag-c: #9b6dd6; }
.note-tag.tag-teal,   .notes-tag-chip.tag-teal,   .note-tag-chip.tag-teal,   .tagc-dot.tag-teal   { --tag-c: #2fa8a0; }
.note-tag.tag-gray,   .notes-tag-chip.tag-gray,   .note-tag-chip.tag-gray,   .tagc-dot.tag-gray   { --tag-c: var(--text-tertiary); }

/* 侧栏 / 编辑器里的标签 chip */
.notes-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--tag-c, var(--border-default));
  border-radius: 999px;
  background: transparent;
  color: var(--tag-c, var(--text-secondary));
  font-size: .7rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.notes-tag-chip:hover { background: var(--bg-elevated); }
.notes-tag-chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-elevated);
  font-weight: 500;
}
.notes-tag-count {
  font-size: .62rem;
  opacity: .7;
  font-family: var(--font-mono);
}

/* ===== 小记工具栏附属控件 ===== */
/* 书写区右侧的「附件」按钮 */
.notes-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .72rem;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--fast), border-color var(--fast);
}
.notes-attach-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.notes-attach-btn svg { flex: none; }

/* ===== 小记编辑器 (单栏专注书写) =====
   2026-09-23 撤掉了抽屉里的实时预览: 抽屉仅 480px, 1:1 分栏后每栏只剩 219px
   (正文可用约 197px, 每行 14 个汉字), Markdown 的标题 / 引用 / 清单缩进
   在那个宽度里全被压平 —— 预览形同虚设。
   渲染效果改由列表卡片承担: 保存后卡片就地更新, 而且卡片是完整的栅格宽度。
   编辑器因此变成单栏全宽 (428px, 每行约 30 个汉字), 配一排 Markdown 快捷按钮。 */
.note-editor-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px;
}
.note-editor-head label {
  font-size: .78rem; color: var(--text-secondary); font-weight: 500;
}
.note-char-count {
  font-size: .7rem; color: var(--text-tertiary); font-family: var(--font-mono);
}
/* 接近上限才变色: 平时保持中性, 免得写几行就在"报警" */
.note-char-count.is-warn { color: var(--c-warn-text); }

/* Markdown 快捷工具栏 —— 按钮只往 textarea 里插/去标记, 不引入富文本编辑器
   (正文必须始终是用户看得见的 Markdown 原文, 否则"复制原文"与修订历史都会失真) */
.note-md-bar { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; flex: 0 0 auto; }
.note-md-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 28px; padding: 0 7px;
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-secondary);
  font-family: inherit; font-size: .72rem; line-height: 1; cursor: pointer;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.note-md-btn:hover { color: var(--accent); border-color: var(--accent); }
.note-md-btn:active { transform: scale(.95); }
.note-md-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.note-md-btn.is-strong { font-weight: 700; }
.note-md-btn.is-em { font-style: italic; }

/* 书写区吃满抽屉剩余高度 (固定 240px 会在下面留一大片空白)。
   ⚠️ 链条要两段都通: .drawer-body 自己也得变成弹性列, 否则 .drawer-form
   拿不到"确定高度", 里面的 flex:1 全部失效 —— 实测表现是 textarea 停在
   min-height 一动不动, 下面空出 300px。只写 .note-editor-body{flex:1} 没用。
   用 :has() 把这两条限制在"抽屉里装的是小记编辑器"时, 不影响任务编辑抽屉。
   min-height:0 是留给窄屏的: 内容超出时让 .drawer-body 出滚动条, 而不是撑破。
   ⚠️ 2026-10-15 补: 上面那句"出滚动条"当时只是**意图**, .drawer-body 上并没有写
      overflow —— 窄屏实测: .note-editor-body 被压到 116px, 而 textarea 的
      min-height:220px 让它溢出 104px、压住下面的标签/目录区 (重叠 84px, 文字糊成
      一团; 旧版 38px 的目录字段也重叠 68px, 是既有缺陷、这轮被加重)。
      修法: 补 overflow-y:auto + 把三处 flex:1 改成 flex:1 0 auto ——
      basis 从 0% 改回 auto 后, 内容自然高会参与计算: 内容矮时照旧 grow 补满
      (桌面 textarea 仍然撑开), 内容高时不缩、整体交给外层滚动, 不再互相压。 */
.drawer-body:has(.note-editor-body) { display: flex; flex-direction: column; overflow-y: auto; }
.drawer-form:has(.note-editor-body) { flex: 1 0 auto; min-height: 0; }
.note-editor-body { display: flex; flex-direction: column; flex: 1 0 auto; min-height: 0; gap: 8px; }
.note-edit-pane { display: flex; flex-direction: column; flex: 1 0 auto; min-height: 0; }
/* v=256: 小记编辑区从 <textarea> 换成 contenteditable（外面套了一层"伪 textarea"接口）。
   两条选择器并存 —— 模板弹窗、快捷输入框那些地方仍然是真的 textarea。 */
.note-edit-pane textarea,
.note-edit-pane .note-edit-rich {
  /* flex:1 必须写在元素自己身上 —— 只给父级 .note-edit-pane 设 flex:1
     的话, 它会长到 639px, 而输入框仍是 flex-grow:0, 被 min-height 钉住不动,
     下面照样空一片 (实测踩到)。改成撑满后拖拽手柄也没意义了, 故 resize:none。 */
  flex: 1;
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-control);
  border-radius: var(--radius-sm); background: var(--bg-elevated);
  color: var(--text-primary); font-family: inherit; font-size: .85rem;
  line-height: 1.6; resize: none; min-height: 300px; box-sizing: border-box;
}
/* contenteditable 专属：保留换行、超长可滚、空的时候给占位文案 */
.note-edit-rich {
  /* v=259: 改成块级富文本后，容器本身不能再 pre-wrap —— 否则 <ul> 标签之间的
     换行会被当成可见空白，列表项之间凭空多出空行。只在 <p> / <blockquote> 里保留。 */
  white-space: normal;
  overflow-wrap: break-word;
  overflow-y: auto;
  cursor: text;
  position: relative;      /* 给空态占位文案做定位基准 */
}
/* 空文档时结构是一段空 <p>（不是完全空），所以两种形态都要覆盖 */
.note-edit-rich:empty::before,
.note-edit-rich:has(> p:only-child:empty)::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 12px;
  top: 10px;
  right: 12px;
  color: var(--text-muted-label);
  pointer-events: none;
  white-space: normal;
}
/* 空段落也得有点高度，否则点不到那一行 */
.note-edit-rich > p:empty { min-height: 1.6em; }
.note-edit-pane textarea:focus,
.note-edit-pane .note-edit-rich:focus { border-color: var(--border-focus); outline: none; }

/* ===== 块级渲染样式 (v=259) =====
   编辑器里直接看到标题 / 列表 / 引用 / 代码块的真实样子，不用等保存后去卡片里看。
   尺度比卡片里的 .markdown-body 小一档 —— 抽屉只有 480px 宽。 */
.note-edit-rich > * { margin: 0 0 .45em; }
.note-edit-rich > *:last-child { margin-bottom: 0; }
.note-edit-rich > p { white-space: pre-wrap; }

.note-edit-rich h1,
.note-edit-rich h2,
.note-edit-rich h3,
.note-edit-rich h4,
.note-edit-rich h5,
.note-edit-rich h6 {
  font-weight: 650;
  line-height: 1.35;
  margin: .55em 0 .3em;
  color: var(--text-primary);
}
.note-edit-rich > h1:first-child,
.note-edit-rich > h2:first-child,
.note-edit-rich > h3:first-child { margin-top: 0; }
.note-edit-rich h1 { font-size: 1.3rem; }
.note-edit-rich h2 { font-size: 1.14rem; }
.note-edit-rich h3 { font-size: 1.02rem; }
.note-edit-rich h4,
.note-edit-rich h5,
.note-edit-rich h6 { font-size: .92rem; }

.note-edit-rich ul,
.note-edit-rich ol { padding-left: 1.45em; margin: .2em 0 .5em; }
.note-edit-rich li { margin: .1em 0; }

.note-edit-rich blockquote {
  margin: .35em 0;
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--border-control);
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.note-edit-rich pre {
  margin: .35em 0;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.5;
}
.note-edit-rich code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--bg-elevated);
  padding: 1px 4px;
  border-radius: 3px;
}
.note-edit-rich pre code { background: none; padding: 0; font-size: inherit; }
.note-edit-rich strong { font-weight: 650; }
.note-edit-rich em { font-style: italic; }
.note-edit-rich del { text-decoration: line-through; color: var(--text-secondary); }

/* ===== v=261: 小记编辑器换成 Vditor =====
   组件自带完整样式（.vditor-* 前缀，基本不会污染全局），这里只做尺寸和配色的缝合。 */
.note-edit-pane .note-edit-vditor { flex: 1; min-height: 0; }
/* ⚠️ 这里必须是 `.note-edit-vditor.vditor`（同一个元素的两个类），
   不能写成 `.note-edit-vditor .vditor`：Vditor 是把 `vditor` 类**加到宿主元素自身**上的，
   后代选择器一个都匹配不到 —— 这几条样式曾经因此整段失效，编辑器的边框和底色一直是组件的默认值。
   外框与底色见下方 v=270 段落（那里是最终生效值）。 */
/* 480px 抽屉里工具栏本来就挤，允许折行，别把按钮裁掉 */
.note-edit-vditor .vditor-toolbar { padding: 3px 4px; flex-wrap: wrap; }
.note-edit-vditor .vditor-toolbar__item { margin: 0 1px; padding: 3px 4px; }
.note-edit-vditor .vditor-toolbar__item svg { width: 15px; height: 15px; }
.note-edit-vditor .vditor-toolbar__divider { margin: 0 4px; }

/* v=262: 工具栏分两档显示。
   抽屉里宽度只有 480px，全量塞进去会折成两行、白占高度，把输入区压短；
   展开成全屏后宽度够了，才把撤销/重做和表格/分隔线放出来。
   JS 在 after() 里给按钮**和它前面那根分隔线**都打了 .nvd-fs-only / .nvd-wide，
   分隔线不打的话，收起之后会剩下连续两条竖线。 */
body:not(.note-fs-open) .note-edit-vditor .vditor-toolbar__item.nvd-fs-only,
body:not(.note-fs-open) .note-edit-vditor .vditor-toolbar__item.nvd-wide,
body:not(.note-fs-open) .note-edit-vditor .vditor-toolbar__divider.nvd-fs-only,
body:not(.note-fs-open) .note-edit-vditor .vditor-toolbar__divider.nvd-wide { display: none; }

/* 撤销/重做：Vditor 在 IR 模式下会把它们长期标成 vditor-menu--disabled（它的状态刷新
   有延迟），图标变灰看着像不能用，其实撤销栈是有内容的。点击已由 app.js 接管，
   这里只需要把灰掉的外观还原。 */
.note-edit-vditor .vditor-toolbar button[data-type="undo"].vditor-menu--disabled,
.note-edit-vditor .vditor-toolbar button[data-type="redo"].vditor-menu--disabled {
  opacity: .85;
  cursor: pointer;
}

/* 窄屏（手机 390px 左右）：抽屉里的编辑框只有 355px 宽，而一颗按钮实占 33px，
   11 颗要 363px —— 差一点点就折成两行、白吃掉 41px 高度。
   这里收掉最不常用的两个（删除线 / 代码块），再把间距压到最小，保证一行放得下。 */
@media (max-width: 430px) {
  .note-edit-vditor .vditor-toolbar__item.nvd-narrow { display: none; }
  .note-edit-vditor .vditor-toolbar { padding: 3px 3px; }
  .note-edit-vditor .vditor-toolbar__item { margin: 0; padding: 3px 2px; }
  .note-edit-vditor .vditor-toolbar__divider { margin: 0 2px; }
}

/* ===== v=265 编辑器视觉打磨 =====
   目标：让它看起来像"页面的一部分"，而不是嵌进来的第三方控件。
   做法：拆掉 Vditor 自带的那圈外框和底色（原来是个白底大方框，和抽屉里的输入框、
   下拉框风格完全不搭），工具栏收成一条独立的小圆角条，正文直接坐在抽屉底色上。 */

/* 🔴 深色主题下正文几乎看不见：Vditor 把 `--textarea-text-color` 之类的值写死成
   #24292e（浅色主题那一套），深色底上实测对比度只有 1.2:1，等于不可读。
   文字颜色必须交给我们自己的主题变量，Vditor 那套只管结构。 */
.note-edit-vditor.vditor,
.note-edit-vditor .vditor-reset { color: var(--text-primary); }

/* ===== v=270 编辑区把边框加回来 =====
   v=265 为了"看起来像页面的一部分"，把 Vditor 自带的框和底色整段拆了、正文直接坐在抽屉底色上。
   结果是编辑区彻底没有边界：抽屉是白底、编辑区也是白底，看不出哪块能写（用户反馈"边框都没有"）。
   现在按抽屉里其他录入控件（标题输入框）的规格补回来，但**不用 Vditor 那套白底方框**：
   底色/描边/圆角全部引用主题变量，深浅色主题下都和旁边控件同款。
   ⚠️ 这里**不能加 `overflow:hidden`**：Vditor 的浮层（链接输入框、自动补全 hint、黑气泡提示）
   都是 absolute 定位在宿主内部的，一裁就有可能半个面板消失。工具栏的底边线离顶部圆角
   还有 30px，本来就碰不到弧线，不需要靠裁切收口。 */
.note-edit-vditor.vditor {
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  transition: border-color var(--fast), box-shadow var(--fast);
}
/* 聚焦时边框转主色 + 一圈柔和光环，和标题输入框的行为一致 */
.note-edit-vditor.vditor:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 16%, transparent);
}
.note-edit-vditor .vditor-ir { padding: 0; }
.note-edit-vditor .vditor-ir pre.vditor-reset,
.note-edit-vditor .vditor-ir pre.vditor-reset:focus {
  background: transparent;
  /* ⚠️ 这段 padding 是 Vditor 写在**内联 style** 上的（padding:10px 35px），
     样式表压不过内联，必须 !important。35px 那块原本留给标题前的 "H1/H2" 浮标，
     浮标下面已经关掉了，这里给到 12px 让正文不贴边框。 */
  padding: 10px 12px !important;
  min-height: 200px;
}

/* 工具栏：v=270 起不再是一条"浮在正文上的独立小条"，而是编辑框内部的一条顶栏 ——
   底色透明（和外框同色）、只用一条底边线跟正文分开，方角交给外框的 overflow:hidden 裁圆。
   v=265 那版在无外框时是对的，加了外框后若还保留自己的边和圆角，就会变成"框里再套一个框"。 */
.note-edit-vditor .vditor-toolbar {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-default);
  border-radius: 0;
  /* 同样要压掉内联的 padding-left:35px，所以用简写 + !important 一次盖全 */
  padding: 4px 8px !important;
  margin-bottom: 0;
}
.note-edit-vditor .vditor-toolbar button {
  color: var(--text-secondary);
  border-radius: 5px;
  transition: background-color .15s ease, color .15s ease;
}
.note-edit-vditor .vditor-toolbar button:hover {
  background: color-mix(in srgb, var(--text-primary) 9%, transparent);
  color: var(--text-primary);
}
.note-edit-vditor .vditor-toolbar__divider { background: var(--border-default); }

/* 标题前的 "H1/H2" 角标纯属噪声 —— 标题已经靠字号字重区分了。
   光标所在块前面的 `## ` 记号保留（那是 IR 模式本身的语义，删掉反而不知道自己在几级）。 */
.note-edit-vditor .vditor-ir .vditor-reset > h1:before,
.note-edit-vditor .vditor-ir .vditor-reset > h2:before,
.note-edit-vditor .vditor-ir .vditor-reset > h3:before,
.note-edit-vditor .vditor-ir .vditor-reset > h4:before,
.note-edit-vditor .vditor-ir .vditor-reset > h5:before,
.note-edit-vditor .vditor-ir .vditor-reset > h6:before,
.note-edit-vditor .vditor-ir div[data-type="link-ref-defs-block"]:before,
.note-edit-vditor .vditor-ir div[data-type="footnotes-block"]:before,
.note-edit-vditor .vditor-ir .vditor-toc:before { content: none; }

/* 标题：h1/h2 默认带一条贯穿整行的下划线（var(--heading-border-color)），
   在窄抽屉里看着像分割线而不是标题，去掉；层级改由字号 + 字重承担。 */
.note-edit-vditor .vditor-reset h1,
.note-edit-vditor .vditor-reset h2 {
  border-bottom: 0;
  padding-bottom: 0;
}
.note-edit-vditor .vditor-reset h1,
.note-edit-vditor .vditor-reset h2,
.note-edit-vditor .vditor-reset h3,
.note-edit-vditor .vditor-reset h4,
.note-edit-vditor .vditor-reset h5,
.note-edit-vditor .vditor-reset h6 {
  margin-top: 18px;
  margin-bottom: 8px;
  line-height: 1.32;
}
.note-edit-vditor .vditor-reset > :first-child { margin-top: 0; }
/* Vditor 默认 h1 1.75em / h2 1.55em，在 480px 抽屉里太夸张，压到跟正文成比例 */
.note-edit-vditor .vditor-reset h1 { font-size: 1.34em; }
.note-edit-vditor .vditor-reset h2 { font-size: 1.2em; }
.note-edit-vditor .vditor-reset h3 { font-size: 1.07em; }
.note-edit-vditor .vditor-reset h4,
.note-edit-vditor .vditor-reset h5,
.note-edit-vditor .vditor-reset h6 { font-size: .98em; color: var(--text-secondary); }

/* 段落与列表：Vditor 默认 16px 的段间距偏散，收紧到 8px */
.note-edit-vditor .vditor-reset p { margin: 0 0 8px; }
.note-edit-vditor .vditor-reset ul,
.note-edit-vditor .vditor-reset ol { margin: 0 0 8px; padding-left: 22px; }
.note-edit-vditor .vditor-reset li { margin: 2px 0; }
.note-edit-vditor .vditor-reset li::marker { color: var(--text-secondary); }

/* 引用：原来只有一根极淡的竖线（#eaecef），在编辑器里几乎看不见。
   用"淡化底色"而不是实底色 —— 实底在窄抽屉里像一条高亮横幅，太重。 */
.note-edit-vditor .vditor-reset blockquote {
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
  border-radius: 0 6px 6px 0;
  padding: 7px 12px;
  margin: 0 0 8px;
  color: var(--text-secondary);
}

/* 代码：行内码原来底色是 rgba(27,31,35,.05)，和编辑区背景几乎同色，看不出是代码。
   ⚠️ Vditor 的选择器是 `.vditor-reset code:not(.hljs):not(.highlight-chroma)`（0,3,1），
   比普通的 `.vditor-reset code`（0,2,1）高 —— 这里必须带上同样两个 :not 才压得住，
   光靠类前缀 `.note-edit-vditor` 是不够的。 */
.note-edit-vditor .vditor-reset code:not(.hljs):not(.highlight-chroma) {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .84em;
}
.note-edit-vditor .vditor-reset pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 0 0 8px;
}

/* ===== v=291: 编辑器里的 Markdown 表格（深色模式白底浅字）=====
   ⚠️ 根因在 Vditor 自己的 CSS（vendor 里，不能改）：表格底色是**写死的浅色**
       .vditor-reset table tr { background-color: #fafbfc }
       .vditor-reset table tbody tr:nth-child(2n) { background-color: #fff }
   而它的 dark 主题只换文字颜色、没换表格底色 —— 深色模式下就成了白底浅字，
   整张表基本看不见。这里用项目 token 覆盖，明暗两套自动跟随。

   ⚠️ 权重：Vditor 的斑马纹是 `.vditor-reset table tbody tr:nth-child(2n)`（0,2,3），
   所以这里必须写到同样带 tbody + nth-child 的层级（0,3,3）才压得住。 */
.note-edit-vditor .vditor-reset table {
  border-collapse: collapse;
  font-size: .86em;
  margin: 0 0 8px;
}
.note-edit-vditor .vditor-reset table tr {
  background-color: transparent;
  border-top: 1px solid var(--border-hover);
}
.note-edit-vditor .vditor-reset table tbody tr:nth-child(2n) {
  background-color: var(--bg-hover);
}
.note-edit-vditor .vditor-reset table td,
.note-edit-vditor .vditor-reset table th {
  border: 1px solid var(--border-hover);
  padding: 5px 10px;
  color: var(--text-primary);
}
.note-edit-vditor .vditor-reset table th {
  background-color: var(--bg-active);
  color: var(--text-secondary);
  font-weight: 600;
}
.note-edit-vditor .vditor-reset pre code:not(.hljs):not(.highlight-chroma) {
  border: 0;
  background: none;
  padding: 0;
}

/* ===== 附件胶囊 (v=256，旧编辑器遗留，新编辑器用不到) =====
   原来正文里插一张图就是一行 `![图片1](/api/notes/files/12)`, 用户看到的是一串地址。
   现在把引用渲染成「缩略图/图标 + 名字」的胶囊, 像聊天输入框那样嵌在文字里。
   ⚠️ 字色用 --accent-hover 而不是 --accent: 后者在 --accent-subtle 底上只有 3.8:1,
      达不到 WCAG AA 的 4.5 (:hover 那个更深, 实测 5.0:1)。 */
.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 260px;
  margin: 0 2px;
  padding: 1px 8px 1px 5px;
  border-radius: 6px;
  background: var(--accent-subtle);
  color: var(--accent-hover);
  font-size: .78rem;
  line-height: 1.55;
  vertical-align: baseline;
  user-select: none;
  cursor: grab;                 /* v=257: 可拖动换位置 */
}
.note-chip:active { cursor: grabbing; }
.note-chip.is-dragging { opacity: .4; }
/* 拖动经过输入框时给个落点提示（和"拖文件进来"高亮同一套观感） */
.note-edit-rich.note-drop-active { border-color: var(--border-focus); }
.note-chip-img { padding-left: 3px; }
.note-chip img {
  display: block;
  width: 18px; height: 18px;
  border-radius: 3px;
  object-fit: cover;
  flex: 0 0 auto;
}
.note-chip-ico { display: inline-flex; flex: 0 0 auto; color: var(--text-secondary); }
.note-chip-ico svg { width: 13px; height: 13px; }
/* 按扩展名染色：一眼能分出表格 / 文档 / PDF / 压缩包（图标属于 UI 元素，3:1 即可） */
.note-chip-ico[data-ext="xls"],
.note-chip-ico[data-ext="xlsx"],
.note-chip-ico[data-ext="csv"] { color: #1f7a4d; }
.note-chip-ico[data-ext="doc"],
.note-chip-ico[data-ext="docx"] { color: #2b579a; }
.note-chip-ico[data-ext="pdf"] { color: #c0392b; }
.note-chip-ico[data-ext="zip"],
.note-chip-ico[data-ext="rar"],
.note-chip-ico[data-ext="7z"] { color: #8a6d3b; }
.note-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-editor-meta {
  /* ⚠️ 别用 --text-tertiary: 它对卡片/抽屉底只有 ~3.1 的对比度, 这行"创建/最新修改"
     基本读不清。--text-muted-label 在浅/深主题下分别有 4.8/8.8。 */
  font-size: .7rem; color: var(--text-muted-label); margin: 0;
}

/* ===== 上传中态：按钮禁用 + 转圈 ===== */
[data-note-attach].is-busy { opacity: .75; cursor: progress; }
[data-note-attach].is-busy::before {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: note-attach-spin .7s linear infinite;
}
@keyframes note-attach-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  [data-note-attach].is-busy::before { animation: none; }
}

/* ===== 编辑器内的标签选择 ===== */
.note-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
/* ⚠️ 2026-09-22 修复: 编辑器标签选择器渲染用的就是这个类, 但 CSS 里
   一直没有它的定义 —— 浏览器回退成裸 <button> (黑直角边框/字体不继承/
   文字贴边), 用户截图反馈"标签显示好丑"的根因即此。 */
.note-tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid color-mix(in srgb, var(--tag-c, var(--text-secondary)) 30%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-c, var(--text-secondary)) 13%, transparent);
  color: var(--tag-c, var(--text-secondary));
  font-size: .72rem;
  font-family: inherit;
  line-height: 1.5;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.note-tag-chip:hover {
  background: color-mix(in srgb, var(--tag-c, var(--text-secondary)) 22%, transparent);
}
.note-tag-chip.active {
  background: color-mix(in srgb, var(--tag-c, var(--text-secondary)) 20%, transparent);
  border-color: var(--tag-c, var(--accent));
  color: var(--tag-c, var(--accent));
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-c, var(--accent)) 45%, transparent);
}
.note-tag-new {
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-tag-new input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .74rem;
  font-family: inherit;
  outline: none;
}
.note-tag-new input:focus { border-color: var(--border-focus); }
.note-tag-new input::placeholder { color: var(--text-tertiary); }
/* 注: 这里原本有一条 @media (max-width:768px), 管的是"移动端把预览切成切换式"。
   预览整体撤掉后它没有作用对象了。工具栏的触控尺寸覆盖统一放在文件末尾的
   「移动端 · 后置覆盖」块里 —— 本文件同权重靠源码顺序定胜负, 别写在这里。 */

/* ===== 历史记录卡片 ===== */
.rev-card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-elevated);   /* 原为不存在的 --bg-base → 卡片底色透明 */
}
.rev-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.rev-action {
  font-size: .68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
/* v=268: 原来这四个是写死的深底浅字（#2a5a3a 那套），只在深色主题下成立 ——
   浅色页面上会蹦出四个深色胶囊，和周围完全不是一套。改用语义色变量，
   两种主题各取各的值。 */
.rev-action.rev-created  { background: var(--c-success-bg); color: var(--c-success-text); }
.rev-action.rev-edited   { background: var(--accent-subtle); color: var(--accent-hover, var(--accent)); }
.rev-action.rev-archived { background: var(--bg-elevated); color: var(--text-secondary); }
.rev-action.rev-restored { background: var(--c-info-bg); color: var(--c-info-text); }
.rev-action.rev-trashed  { background: var(--c-danger-bg); color: var(--c-danger-text); }
.rev-time {
  font-size: .68rem;
  color: var(--text-muted-label);   /* 原 --text-tertiary 只有 ~3.1:1，小字不达标 */
  font-family: var(--font-mono);
}
.rev-body {
  font-size: .78rem;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
/* 旧值划掉 + 淡红底：一眼能分辨「被替换掉的」和「现在的」，
   比单纯 opacity:.7 的灰色清楚得多 */
.rev-old {
  color: var(--text-secondary);
  background: var(--c-danger-bg);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: -4px;
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
}
.rev-new { color: var(--text-primary); }
.rev-arrow { color: var(--text-tertiary); font-size: .68rem; margin: 4px 0; }

/* 旧的单按钮删除样式(.note-delete)已随卡片操作区重构移除:
   DOM 里早已不再生成这个元素, 留着只会让后来人以为还有第二种删除入口 */

.chip-menu {
  position: absolute; margin-top: 32px;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius); padding: 4px; min-width: 130px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 20;
}
.chip-menu button {
  display: block; width: 100%; padding: 5px 10px; border: none;
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-secondary); font-size: .82rem; text-align: left; cursor: pointer;
}
.chip-menu button:hover { background: var(--bg-hover); color: var(--text-primary); }
.chip-menu-clear { color: var(--text-tertiary) !important; }

/* ===== Main content ===== */
.main {
  padding: 12px;
  min-height: 60vh;
}

/* === Board (Kanban) === */
/* 列数由板块定义决定, 所以不能写死 repeat(3, 1fr) —— 用户加了第 4 个板就串行错位。
   auto-fill + minmax: 每列有合理最小宽度, 屏宽够就多排一列, 不够就自动换行。 */
/* 板块数量不固定, 用 auto-fit 而不是 auto-fill。
   ⚠️ 这俩差别很大, 2026-09-15 踩过: auto-fill 会**先按容器宽度铺满轨道**
   (1440px 下铺 5 个 / 1920px 下铺 7 个), 列数不够时那些空轨道照样占位置,
   于是 4 列只占 4/5 宽 —— 屏幕右侧空出 300~800px, 看着像"少了点什么"。
   auto-fit 会把没用上的轨道折叠掉, 列自己把整行撑满。 */
.board {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  /* stretch: 四列等高（旧版 start 让每列各按内容高度，实测 300/300/362/300 底边参差） */
  align-items: stretch;
}
/* 平板（≤1024px）：看板两列起, 窄了继续让 auto-fit 自己收 */
@media (max-width: 1024px) { .board { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }

.column {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  min-height: 340px;
  overflow: hidden;      /* 配合圆角裁掉列头那根贯穿的分隔线 */
}
.column-header {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px; border-bottom: 1px solid var(--border-default);
  /* 列头 = 板块拖拽手柄 (2026-09-21)。光标给 grab 提示;
     禁选文本, 否则按下拖动会先拖出一片蓝色选区再开始拖。 */
  cursor: grab; user-select: none;
}
/* 板块名可能很长, 撑开会把右边的操作按钮挤出去 —— 单行省略 */
.column-header h2 {
  font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); flex: 1;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -.01em;
}
/* 板块改名 / 删除: 只在鼠标悬停列头时出现, 平时不占视觉噪音。
   固定板块(待办/已完成)不渲染这两个按钮 —— 后端也会拒绝, 这里是 UI 侧同步 */
.col-op { opacity: 0; transition: opacity var(--fast); }
.column-header:hover .col-op { opacity: 1; }
.col-op-danger:hover { color: var(--danger); }
/* 板块拖拽手柄: 与 .col-op 同样"悬停才现身", 但**始终占宽**(opacity 0→1)。
   若改成 display:none→block, 悬停瞬间右边几个按钮会平移一格, 像在抖。 */
.col-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; flex: none; color: var(--text-tertiary);
  opacity: 0; transition: opacity var(--fast);
}
.column-header:hover .col-grip { opacity: .7; }
/* 触屏 / ≤768px 不提供列排序 (见 app.js enableSortable 的禁用条件),
   手柄就别露出来骗人 —— 这里直接不占位, 给窄屏列头省 16px。 */
@media (hover: none), (max-width: 768px) { .col-grip { display: none; } }
/* 触屏没有 hover: 直接常显, 否则这两个按钮永远点不到 */
@media (hover: none) {
  .col-op { opacity: 1; }
}
/* 看板尾部的虚线「＋新建板块」卡片已于 2026-09-15 按用户要求删除,
   建板块统一走顶栏右上角的「＋」。.column-add / .column-add-plus 的样式一并清掉。 */
.dot { width: 8px; height: 8px; border-radius: 50%; }
/* 列头圆点颜色由板块自己决定（用户可自选）。
   JS 渲染时写 inline style="--dot-color: var(--col-blue)"，这里只负责兜底：
   没有 --dot-color 时退回中性灰 —— 覆盖老库自定义板块（color 列为 NULL）
   和「数据来自别处、本机没有这个板块」的情况，点不会变成透明的。
   ⚠️ 原 .dot-status-todo/doing/done 三条规则（按状态写死灰/靛/绿）已删除，
      颜色改由数据驱动；固定板块的默认色在 routes_board.DEFAULT_COLUMNS 里。 */
.column-header .dot { background: var(--dot-color, var(--text-tertiary)); }

.task-list { flex: 1; padding: 6px; overflow-y: auto; }
/* 空列占位用伪元素渲染: 不是 DOM 节点, 因此不会被 SortableJS 拖走, 也选不中 */
.task-list:empty::after {
  content: '暂无任务';
  display: block; margin: 4px 2px;
  font-size: var(--fs-sm); color: var(--text-tertiary);
  padding: 26px 12px; text-align: center;
  border: 1px dashed var(--border-default); border-radius: var(--radius);
  pointer-events: none; user-select: none;
}
.column-empty { font-size: var(--fs-sm); color: var(--text-tertiary); padding: 26px 12px; text-align: center; pointer-events: none; user-select: none; }

.icon-btn-sm {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-tertiary); border-radius: var(--radius-sm);
  cursor: pointer; font-size: .9rem; transition: all var(--fast);
}
.icon-btn-sm:hover { background: var(--bg-hover); color: var(--text-primary); }

/* 抽屉头部关闭按钮 hover */
.drawer-action-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* === Task card === */
.task-card {
  /* ⚠️ 必须用 surface-card，不能用 bg-elevated。
     旧版用 bg-elevated：浅色下是 #f0f0f3 —— 比白色列容器更暗，
     所以卡片不是"浮在列上"而是"陷进列里"，整个看板看着发脏。
     深色下 surface-card 也比 bg-surface 亮一档，方向一致。 */
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
  position: relative;
  box-shadow: var(--shadow-card);   /* 静态就给一层极轻阴影，卡片才有"抬起"感 */
}
.task-card::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--pri-bar, transparent);   /* 档位无颜色时不画条 */
}
/* ===== 分类配色：语义色 → 一组变量 =====
   ⚠️ 档位由用户自定义（可增删改名调序），所以这里按**语义色**分档，不按分类 key。
   前端把档位的颜色写到元素的 data-pri-color 上，本组规则负责展开成变量；
   使用这些变量的组件（卡片色条 / badge / 圆点 / 日历标签）因此不用知道有哪些档位。
   五个变量的分工：
     --pri-bar    色条 / 圆点的颜色（无颜色档 = 透明，不画条）
     --pri-text   强调色文字（badge 字、日历小条字）
     --pri-bg     元件底色（badge / 胶囊）
     --pri-border 元件描边
     --pri-soft   大块淡底（日历小条的第一档强调底）
   data-pri-color="" 与 "neutral" 是"没选色"，落在最后的兜底规则上。 */
[data-pri-color="danger"] {
  --pri-bar: var(--c-danger-text);
  --pri-bg: var(--c-danger-bg); --pri-border: var(--c-danger-border);
  --pri-text: var(--c-danger-text); --pri-soft: var(--c-danger-bg);
}
[data-pri-color="warn"] {
  --pri-bar: var(--c-warn-text);
  --pri-bg: var(--c-warn-bg); --pri-border: var(--c-warn-border);
  --pri-text: var(--c-warn-text); --pri-soft: var(--c-warn-bg);
}
[data-pri-color="success"] {
  --pri-bar: var(--c-success-text);
  --pri-bg: var(--c-success-bg); --pri-border: var(--c-success-border);
  --pri-text: var(--c-success-text); --pri-soft: var(--c-success-bg);
}
[data-pri-color="teal"] {
  --pri-bar: var(--c-teal-text);
  --pri-bg: var(--c-teal-bg); --pri-border: var(--c-teal-border);
  --pri-text: var(--c-teal-text); --pri-soft: var(--c-teal-bg);
}
[data-pri-color="info"] {
  --pri-bar: var(--c-info-text);
  --pri-bg: var(--c-info-bg); --pri-border: var(--c-info-border);
  --pri-text: var(--c-info-text); --pri-soft: var(--c-info-bg);
}
[data-pri-color="violet"] {
  --pri-bar: var(--c-violet-text);
  --pri-bg: var(--c-violet-bg); --pri-border: var(--c-violet-border);
  --pri-text: var(--c-violet-text); --pri-soft: var(--c-violet-bg);
}
[data-pri-color="rose"] {
  --pri-bar: var(--c-rose-text);
  --pri-bg: var(--c-rose-bg); --pri-border: var(--c-rose-border);
  --pri-text: var(--c-rose-text); --pri-soft: var(--c-rose-bg);
}
/* 中性 / 未选色：不抢注意力 —— 不给色条、不给强调底色，只在 badge 上用中性底 */
[data-pri-color="neutral"],
[data-pri-color=""] {
  --pri-bar: transparent;
  --pri-bg: var(--c-neutral-bg); --pri-border: var(--c-neutral-border);
  --pri-text: var(--text-tertiary); --pri-soft: var(--bg-elevated);
}

/* ----- 设置面板里的「分类」档位管理器 -----
   行结构和看板列头同构（手柄 + 色块 + 名字 + 计数 + 两个按钮），
   颜色同样走 data-pri-color → --pri-* 变量，所以新加的档位不用写任何 CSS。 */
.pri-manage { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.pri-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  font-size: var(--fs-sm);
  transition: border-color var(--fast), background var(--fast);
}
.pri-row:hover { border-color: var(--border-hover); background: var(--bg-hover); }
/* 手柄常显但压暗（设置面板要让人看得出"这能拖"，看板列头是 hover 才现身） */
.pri-row-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; flex: none;
  color: var(--text-tertiary); opacity: .4;
  cursor: grab; transition: opacity var(--fast);
}
.pri-row:hover .pri-row-grip { opacity: .85; }
.pri-row.sortable-chosen .pri-row-grip { cursor: grabbing; }
/* 色块：无颜色的档位靠 --pri-border 的描边才看得见 */
.pri-row-swatch {
  width: 14px; height: 14px; flex: none;
  border-radius: 4px;
  background: var(--pri-bar, transparent);
  box-shadow: inset 0 0 0 1px var(--pri-border, var(--border-default));
}
.pri-row-name {
  flex: 1; min-width: 0; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pri-row-tag {
  flex: none; padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle); color: var(--accent);
  font-size: var(--fs-2xs);
}
.pri-row-count {
  flex: none; min-width: 22px; text-align: right;
  color: var(--text-tertiary);
  font-family: var(--font-mono); font-size: var(--fs-2xs);
}
/* 按钮沿用 .col-op 的"悬停才现身"（触屏由 @media (hover: none) 统一常显） */
.pri-row:hover .col-op { opacity: 1; }
.pri-row .col-op-danger:hover { color: var(--danger); }

.task-card:hover {
  border-color: var(--border-hover);   /* 旧版 hover 变主色蓝边，太吵；改用中性边 + 阴影抬升 */
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}
.task-card.is-done { opacity: .62; }
.task-card.is-done::before { background: transparent; }   /* 做完的卡片不再亮色条 */
.task-card.is-done .task-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.task-card.is-overdue { border-color: var(--c-danger-border); }
.task-card.is-overdue .task-title { color: var(--c-danger-text); }

.task-card-header { display: flex; align-items: flex-start; gap: 4px; }
.task-card-header .task-title { flex: 1; min-width: 0; }

/* ===== 专注倒计时胶囊 (v=268) =====
   位置在「···」左边。用 tabular-nums，否则 11:11 → 11:08 时字宽变化会让
   整颗胶囊左右抽动（每秒一次，很晃眼）。 */
.task-focus-chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 3px;
  height: 22px; padding: 0 7px; margin-top: 1px;
  border: 1px solid var(--accent-subtle);
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Consolas, monospace);
  font-size: 11px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.task-focus-chip:hover { border-color: var(--accent); }
.task-focus-chip:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
/* 暂停：换成中性色，一眼能和"正在跑"区分开（不靠颜色单一维度：
   暂停态还少一个跳动动画） */
.task-focus-chip.is-paused {
  color: var(--text-secondary); background: var(--bg-elevated); border-color: var(--border-default);
}
.task-focus-chip.is-done {
  color: var(--c-success-text); background: var(--c-success-bg); border-color: var(--c-success-border);
}
.task-focus-chip.is-done .tf-clock { animation: focus-blink 1.6s ease-in-out infinite; }
@keyframes focus-blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.task-card-menu-btn {
  flex-shrink: 0;
  width: 28px; height: 26px;
  margin-top: -2px;
  border: none; background: transparent;
  color: var(--text-tertiary);
  font-size: 18px; line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 6px;
  cursor: pointer; opacity: .55;
  transition: opacity var(--fast), background var(--fast), color var(--fast);
  display: inline-flex; align-items: center; justify-content: center;
}
.task-card:hover .task-card-menu-btn { opacity: 1; }
.task-card-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); opacity: 1; }

/* 卡片 ··· 菜单 */
.task-card-menu {
  position: fixed;
  z-index: 1000;
  min-width: 132px;
  background: var(--surface-popover);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
  padding: 5px;
  display: flex; flex-direction: column; gap: 1px;
  /* 兜底：卡片比视口还高时（手机上地址栏占位、横屏），上下都翻不开，
     这时贴底显示 + 允许内部滚动，至少每一项都还点得到。 */
  max-height: calc(100vh - 16px);
  overflow-x: hidden;
  overflow-y: auto;
}
.task-card-menu-item {
  border: none; background: transparent;
  text-align: left;
  padding: 8px 12px;
  font-size: .85rem;
  color: var(--text-primary);
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--fast);
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
  line-height: 1.3;
}
.task-card-menu-item:hover { background: var(--bg-hover); }
.task-card-menu-item.is-danger { color: var(--danger); }
.task-card-menu-item.is-danger:hover { background: rgba(220, 38, 38, 0.08); }

.task-title { font-size: .85rem; font-weight: 500; color: var(--text-primary); line-height: 1.4; margin-bottom: 6px; }
.task-desc { font-size: .78rem; color: var(--text-tertiary); margin-bottom: 6px; }

.task-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.task-badge {
  display: inline-flex; align-items: center; padding: 1.5px 7px;
  font-size: var(--fs-2xs); font-weight: 500; line-height: 1.5;
  border-radius: var(--radius-xs);
  border: 1px solid var(--c-neutral-border);
  background: var(--c-neutral-bg); color: var(--c-neutral-text);
}
/* 分类 badge 上色 —— 颜色全部来自档位的语义色（见上面的 [data-pri-color] 规则组），
   这里只负责把变量接到属性上，所以新增/改名档位不用改这里。
   ⚠️ 旧版 .badge-priority-normal 只有 background: var(--bg-elevated) ——
      与卡片背景色完全相同，等于「普通」这个 badge 在界面上根本看不见。 */
.badge-priority {
  background: var(--pri-bg, var(--c-neutral-bg));
  border-color: var(--pri-border, var(--c-neutral-border));
  color: var(--pri-text, var(--c-neutral-text));
}
.badge-due        { background: var(--c-neutral-bg); border-color: var(--c-neutral-border); color: var(--c-neutral-text); }
.badge-overdue    { background: var(--c-danger-bg);  border-color: var(--c-danger-border);  color: var(--c-danger-text); }
.badge-recurring  { background: var(--c-neutral-bg); border-color: var(--c-neutral-border); color: var(--c-neutral-text); }
.badge-checklist  { background: var(--c-neutral-bg); border-color: var(--c-neutral-border); color: var(--c-neutral-text); font-family: var(--font-mono); }

.tag-chip {
  background: var(--bg-elevated); color: var(--text-secondary);
  padding: 1px 7px; border-radius: var(--radius-xs); font-size: var(--fs-2xs);
}
.tag-toggle { cursor: pointer; border: 1px solid var(--border-default); padding: 3px 8px; border-radius: var(--radius); font-size: .78rem; }
.tag-toggle.active { border-color: var(--accent); background: var(--bg-active); }

/* ===== List view ===== */
.list-view {
  overflow-x: auto;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.task-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
/* 表头：旧版 text-transform:uppercase + letter-spacing 对中文毫无作用，
   只把中文表头拉得松散发虚 —— 去掉，改用底色 + 常规字重区分 */
.task-table th {
  padding: 9px 12px; text-align: left; font-weight: 600;
  color: var(--text-tertiary); font-size: var(--fs-xs);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.task-table td { padding: 11px 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); cursor: pointer; }
.task-table tbody tr:hover td { background: var(--bg-hover); }
.task-table tbody tr:last-child td { border-bottom: none; }
.cell-title { display: flex; align-items: center; gap: 8px; color: var(--text-primary) !important; }
.priority-dot {
  width: 6px; height: 6px; border-radius: 50%;
  /* 颜色 = 档位语义色；查不到档位(已删除的 key)时退成中性灰，不会是透明空洞 */
  background: var(--pri-bar, var(--text-tertiary));
}
/* 默认中性配色写在基类里: 自定义板块没有专属 status-* 规则可匹配,
   不给底的话它在列表里就是一段没有背景的裸文字 */
.status-pill { font-size: var(--fs-xs); font-weight: 500; padding: 1.5px 9px; border-radius: var(--radius-full); background: var(--c-neutral-bg); color: var(--c-neutral-text); border: 1px solid var(--c-neutral-border); }
.status-pill.status-todo { background: var(--c-neutral-bg); color: var(--c-neutral-text); border-color: var(--c-neutral-border); }
.status-pill.status-doing { background: var(--c-info-bg); color: var(--c-info-text); border-color: var(--c-info-border); }
.status-pill.status-done { background: var(--c-success-bg); color: var(--c-success-text); border-color: var(--c-success-border); }
.status-pill.status-cancelled { background: var(--c-neutral-bg); color: var(--text-tertiary); border-color: var(--c-neutral-border); }
.empty, .muted { color: var(--text-tertiary); padding: 20px; text-align: center; font-size: var(--fs-md); }
/* 注: .muted 是「空态提示」(含居中 + 20px padding), **不是**通用弱化文字色。
   行内次要文字请用各自的 meta 类或 .device-meta.is-dim —— 直接套 .muted 会被居中。 */
/* 列表里的分类：做成和状态列一致的小胶囊 —— 旧版这里是一段裸文字，
   跟旁边"状态"列的胶囊并排看着像没写完。 */
.pri-pill {
  display: inline-block; font-size: var(--fs-xs); font-weight: 500;
  padding: 1.5px 9px; border-radius: var(--radius-full); border: 1px solid;
  background: var(--pri-bg, var(--c-neutral-bg));
  border-color: var(--pri-border, var(--c-neutral-border));
  color: var(--pri-text, var(--c-neutral-text));
}
/* 完成的行整体减弱 + 标题删除线（看板卡片有删除线，列表此前没有，两边不一致） */
.task-table tbody tr.is-done .cell-title {
  text-decoration: line-through; text-decoration-thickness: 1px;
  color: var(--text-tertiary) !important;
}
.task-table tbody tr.is-done .priority-dot { opacity: .45; }

/* ===== Calendar view ===== */
.calendar-view { max-width: 880px; margin: 0 auto; }
/* 工具条：‹ 月份 › 收成一个居中的小簇, 「今天」单独靠右。
   旧版 h2 是 flex:1 —— 标题一居中就把 ‹ › 顶到两端（1440 下相距 400+px），
   三个元素看着像互不相关。 */
.calendar-toolbar {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-bottom: 14px;
}
.calendar-toolbar h2 {
  flex: none; min-width: 150px;
  font-size: var(--fs-lg); font-weight: 600; text-align: center; letter-spacing: -.01em;
}
/* 翻月按钮给个描边底, 让它看起来"可以点"（原来是无边框的裸箭头） */
.calendar-toolbar .cal-nav {
  width: 30px; height: 30px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}
.calendar-toolbar .cal-nav:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-primary); }
.calendar-toolbar .cal-today { position: absolute; right: 0; }
.weekday-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; margin-bottom: 0; background: #fafafa; border: 0.5px solid var(--border-default); border-bottom: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
[data-theme="dark"] .weekday-row, html:not([data-theme="light"]) .weekday-row { background: rgba(255,255,255,.03); }
.weekday-row span { text-align: center; font-size: var(--fs-xs); font-weight: 600; color: var(--text-tertiary); padding: 6px 0; letter-spacing: .04em; border-right: 0.5px solid var(--border-default); }
.weekday-row span:last-child { border-right: none; }
/* 周末（第 6/7 列）抬一档灰给出提示；不用红色，免得太抢眼 */
.weekday-row span:nth-child(6), .weekday-row span:nth-child(7) { color: var(--text-secondary); }
/* 方案三·彩色标签 (2026-09-27 用户选定): 细网格线 + 标签化节日 */
.month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
  background: var(--surface-card);
  border: 0.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.day-cell {
  aspect-ratio: 1 / 1.02;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  padding: 5px 6px;
  border: none;
  border-right: 0.5px solid var(--border-default);
  border-bottom: 0.5px solid var(--border-default);
  border-radius: 0;
  background: var(--surface-card);
  color: var(--text-secondary); cursor: pointer;
  font-size: var(--fs-sm);
  transition: background var(--fast) var(--ease);
  overflow: hidden; min-height: 0;
}
.day-cell:nth-child(7n) { border-right: none; }
.day-cell:hover { background: var(--bg-hover); }
.day-cell.has-tasks:hover { background: var(--bg-hover); }
/* 非本月：做成"凹陷的空格"（容器底色 + 弱文字）。
   旧版是白卡片 + 整格 opacity .45 —— 浅色下发灰、深色下直接糊掉，
   而且整格透明也把网格线一起压淡了。 */
.day-cell.other-month { background: #fafafa; }
.day-cell.other-month .day-num { color: var(--text-tertiary); opacity: .7; }
html:not([data-theme="light"]) .day-cell.other-month { background: rgba(255,255,255,.02); }
.day-cell.other-month .day-titles { opacity: .5; }
/* 本月视图里, 下月/上月格只显示节假日信息 (2026-09-27 用户要求):
   隐藏任务小条和 +N, 保留日期数字和假日名 */
.day-cell.other-month .day-titles { display: none; }
.day-cell.other-month .day-hol-name { background: #eef0f8; color: #8b93c8; }
/* 周末淡底已取消 (2026-09-27 用户要求)。节假日淡红底见 .is-holiday */
/* 有任务的格子: 日期数字加重 + 左上角一个小圆点, 扫一眼就知道哪天有活 */
.day-cell.has-tasks .day-num { font-weight: 600; color: var(--text-primary); }
/* 节假日 (2026-09-27): 法定节假日整格淡红底 + 日期数字红色;
   调休补班日只给数字上标「班」角标, 不染色 —— 补班是要上班的, 不能像放假那样标 */
.day-cell.is-holiday { background: transparent; }
.day-cell.is-holiday:hover { background: var(--bg-hover); }
.day-cell.is-holiday.other-month { background: #fafafa; }
.day-cell.is-holiday.other-month .day-num { color: var(--text-tertiary); font-weight: 500; }
/* 今天：主色圆徽章 + 极淡的主色底（旧版只描了一圈边，跟「选中」长得一样） */
/* 今天：淡主色底 + 数字主色 + 2px 靛蓝外描边 (v=163 用户选 B 方案) */
.day-cell.is-today {
  background: transparent;
  box-shadow: inset 0 0 0 2px #4353D6;
}
.day-cell.is-today:hover { background: var(--bg-hover); }
.day-cell.is-today .day-num {
  background: #EEF1FC; color: #4353D6; font-weight: 600;
  border-radius: 50%;
}
/* 日期头部行: 数字靠右, 假日名/班角标靠左 —— 上下分离不再挤在一起 (v=178) */
.day-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px; min-height: 20px; flex: none;
}
.day-num {
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-primary);
  line-height: 1;
  min-width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  flex: none;
}
/* v=199: 今天标签 (格子头部左侧) + 右侧数字/假日组 */
.day-today-tag {
  font-size: var(--fs-2xs); font-weight: 600; line-height: 1.4;
  color: #4353D6; background: #EEF1FC;
  padding: 0 5px; border-radius: 3px; flex: none;
}
html:not([data-theme="light"]) .day-today-tag { color: #fff; background: #2E386D; }
.day-head-right { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.day-titles {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
.day-title {
  font-size: var(--fs-2xs);
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.4;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  padding: 1.5px 5px;
  border-left: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.04);
  /* ⚠️ 必须 flex:none —— .day-titles 是列方向 flex 容器，子项默认可收缩。
     格子高度不够时（手机上格内只有 ~40px 却要塞 3 条）子项会被压到不足一行高，
     文字直接叠在一起：实测 320px 下每个小条只剩 6.75px 高。
     宁可让 overflow:hidden 裁掉，也不能压扁。 */
  flex: none;
}
/* 小条也走分类语义色（旧版三档全是灰）。
   只有「列表第一档」（= 用户自己拖出来的最重要那档）给淡底强调，其余只给左侧色条 ——
   原来写死成"只有紧急有底"，档位可自定义、顺序可拖动之后必须跟着顺序走。 */
.day-title { border-left-color: var(--pri-bar, transparent); }
.day-title.is-pri-top {
  background: var(--pri-soft, var(--bg-elevated));
  color: var(--pri-text, var(--text-secondary));
}
.day-title:hover { box-shadow: 0 0 0 1px var(--border-hover); }
.day-title.done { text-decoration: line-through; color: var(--text-tertiary); opacity: .55; }
.day-title.done.archived { opacity: .35; }

/* 节假日角标 (2026-09-27):
   .day-hol-name = 法定假日名称小字 (红色, 跟在日期数字后)
   .day-hol-work = 调休补班「班」角标 (灰蓝小方块, 提示要上班) */
.day-hol-name {
  font-size: .58rem; color: #fff; font-weight: 600;
  line-height: 1.5; padding: 1px 5px;
  background: #4353D6;
  border-radius: 3px;
  align-self: flex-start;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; min-width: 0;
}
/* 今天的格子已带主色淡底, 假日胶囊换成实底白字避免两底相叠脏 */
.day-cell.is-today .day-hol-name {
  background: #eef1fc; color: #4353D6;
}

/* 深色主题 (方案三): 实底靛蓝标签 + 橙标签 + 跨月灰标签 */
html:not([data-theme="light"]) .day-cell.is-holiday {
  background: transparent;
}
html:not([data-theme="light"]) .day-cell.is-holiday:hover {
  background: var(--bg-hover);
}
html:not([data-theme="light"]) .day-hol-name {
  color: #fff;
  background: #4353D6;
}
html:not([data-theme="light"]) .day-cell.is-today .day-hol-name {
  color: #c9cfff;
  background: rgba(67, 83, 214, .34);
}
html:not([data-theme="light"]) .day-cell.is-today.is-holiday .day-hol-name {
  color: #c9cfff;
  background: rgba(67, 83, 214, .34);
}
html:not([data-theme="light"]) .day-cell.other-month .day-hol-name {
  background: rgba(255,255,255,.06);
  color: var(--text-tertiary);
}
html:not([data-theme="light"]) .day-cell.is-today .day-num { background: #2E386D; color: #fff; }
html:not([data-theme="light"]) .day-cell.is-today {
  box-shadow: inset 0 0 0 2px #6474e8;
}
html:not([data-theme="light"]) .day-lunar.is-term,
html:not([data-theme="light"]) .day-lunar.is-fest {
  color: #ffa348; background: rgba(255, 163, 72, .12);
}

/* 深色主题: 跨月的假日格不上假日色 (2026-09-27 用户要求) ——
   底色/数字与普通跨月格完全一致 (⚠️ 不能用 --bg-surface: 深色下它比日历
   卡片底色 #171c26 还黑一档, 国庆 1-7 号会整格发黑 —— v=160 用户反馈修复),
   只留假日名灰胶囊提示 */
html:not([data-theme="light"]) .day-cell.is-holiday.other-month {
  background: rgba(255,255,255,.02);
}
html:not([data-theme="light"]) .day-cell.is-holiday.other-month .day-num {
  color: var(--text-tertiary);
  opacity: .7;
  font-weight: 500;
}
html:not([data-theme="light"]) .day-cell.is-holiday.other-month .day-hol-name {
  background: rgba(255,255,255,.06);
  color: var(--text-tertiary);
}
.day-hol-work {
  font-size: .56rem; color: #8a6d3b; background: rgba(230, 162, 60, .14);
  border-radius: 3px; padding: 1px 4px; line-height: 1.4;
  font-weight: 600; flex: none;
}

/* 农历行 (2026-09-27): 日期数字下方一行小字
   普通日子 = 农历日 (初五/十五) 或初一显示月份 (八月);
   节气 (立秋/冬至) 和传统节日 (七夕/重阳/除夕) 用主题靛蓝强调 */
.day-lunar {
  font-size: .56rem; color: var(--text-tertiary);
  line-height: 1.5; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: none; align-self: flex-start; max-width: 100%;
}
.day-lunar.is-term, .day-lunar.is-fest {
  color: #e0862c; font-weight: 600;
  background: #fdf3e7; padding: 0 4px; border-radius: 3px;
}
.day-cell.other-month .day-lunar { opacity: .6; }
html:not([data-theme="light"]) .day-lunar.is-term,
html:not([data-theme="light"]) .day-lunar.is-fest { color: #ffa348; }

/* ===== 日子 (Memorials) v=181: 日历徽章 + 列表页 + 抽屉 ===== */
/* 日历格内的日子徽章行 */
.day-mems {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 2px; overflow: hidden; flex: none;
}
.mem-badge {
  font-size: .56rem; font-weight: 600; line-height: 1.5;
  padding: 0 4px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; align-self: flex-start;
}
/* 生日 = 粉红系 (与假日靛蓝/节气橙都区分) */
.mem-badge.mem-bd { color: #c2255c; background: #fdeef4; }
/* 倒计时 = 青绿系 */
.mem-badge.mem-cd { color: #0b7285; background: #e6f7fa; }
.mem-badge.mem-soon { color: #fff; background: #0b7285; }  /* 临近(见 MEM_SOON_DAYS 天)实底强调 */
/* 纪念日 = 紫系 */
.mem-badge.mem-an { color: #6741d9; background: #f1edfc; }
/* 当天命中 (v=184): 类别色实底 (v=199 不再强制红底, 颜色跟类别走) */
.mem-badge.mem-hit { color: #fff; background: #f03e3e; font-weight: 700; }
html:not([data-theme="light"]) .mem-badge.mem-bd { color: #f783ac; background: rgba(247,131,172,.12); }
html:not([data-theme="light"]) .mem-badge.mem-cd { color: #66d9e8; background: rgba(102,217,232,.1); }
html:not([data-theme="light"]) .mem-badge.mem-soon { color: #10181c; background: #66d9e8; }
html:not([data-theme="light"]) .mem-badge.mem-an { color: #b197fc; background: rgba(177,151,252,.12); }
html:not([data-theme="light"]) .mem-badge.mem-hit { color: #fff; background: #e03131; }
.day-cell.other-month .mem-badge { opacity: .55; }

/* 日历工具条: 数据源切换 (全部/待办/日子) */
/* 「今天」是绝对定位贴右 (历史布局), 切换开关绝对定位在它左边, 留出间距 */
.cal-src-switch {
  position: absolute; right: 64px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 0;
  background: var(--bg-surface); border-radius: var(--radius-md);
  padding: 2px; border: 0.5px solid var(--border-default);
}
.cal-src-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: var(--fs-xs); color: var(--text-secondary);
  padding: 3px 10px; border-radius: var(--radius-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.cal-src-btn.active { background: var(--surface-card); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* 日子列表页 */
.mem-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
/* v=190~194 桌面端两栏: 左栏类别卡片, 右栏列表 (最多 3 列) */
.mem-layout { display: flex; gap: 16px; align-items: flex-start; }
.mem-side {
  flex: none; width: 172px;
  background: var(--surface-card);
  border: 0.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 12px;
}
.mem-side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 6px; border-bottom: 0.5px solid var(--border-default); margin-bottom: 2px;
}
.mem-side-title { font-size: var(--fs-xs); font-weight: 600; color: var(--text-tertiary); letter-spacing: .04em; }
.mem-side-add {
  border: none; background: transparent; color: var(--text-tertiary); cursor: pointer;
  width: 20px; height: 20px; border-radius: var(--radius-sm); display: inline-flex;
  align-items: center; justify-content: center; padding: 0;
}
.mem-side-add:hover { background: var(--bg-hover); color: var(--text-primary); }
.mem-cats { display: flex; flex-direction: column; gap: 1px; }
.mem-cat-row { position: relative; display: flex; align-items: center; }
.mem-cat {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  border: none; background: transparent; cursor: pointer;
  padding: 7px 8px; border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: var(--fs-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.mem-cat:hover { background: var(--bg-hover); }
.mem-cat.active {
  background: color-mix(in srgb, var(--tc, #4353D6) 13%, transparent);
  color: var(--tc, #4353D6);
  font-weight: 600;
}
.mem-cat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mem-cat-name { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-cat-count { font-size: var(--fs-2xs); color: var(--text-tertiary); font-variant-numeric: tabular-nums; flex: none; }
/* 编辑/删除钮: 桌面 hover 才出, 触屏常显 */
.mem-cat-acts { display: none; position: absolute; right: 4px; gap: 1px; background: var(--surface-card); border-radius: var(--radius-sm); }
.mem-cat-row:hover .mem-cat-acts { display: inline-flex; }
.mem-cat-act {
  border: none; background: transparent; color: var(--text-tertiary); cursor: pointer;
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.mem-cat-act:hover { background: var(--bg-hover); color: var(--text-primary); }
.mem-cat-act.is-danger:hover { background: rgba(224,49,49,.1); color: #e03131; }
.mem-side .mem-new-btn { margin-top: 4px; width: 100%; justify-content: center; }
/* v=211: 全局「显示到秒」开关 —— 幽灵按钮, 开启态描边+文字用主色 (对齐看板列头计数徽章的开/关观感) */
.mem-sec-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: 100%; margin-top: 2px; padding: 6px 12px;
  border: 0.5px solid var(--border-default); border-radius: var(--radius-full);
  background: var(--surface-card); color: var(--text-secondary);
  font-size: var(--fs-xs); cursor: pointer;
  transition: all var(--fast) var(--ease);
}
.mem-sec-toggle:hover { border-color: var(--accent); color: var(--text-primary); }
.mem-sec-toggle.is-on {
  border-color: #4353D6; color: #4353D6; font-weight: 600;
  background: color-mix(in srgb, #4353D6 8%, var(--surface-card));
}
.mem-sec-toggle svg { flex: none; }
.mem-body { flex: 1; min-width: 0; }
/* 列表: 最多 3 列 (v=194 去掉旧 max-width:760, 卡片窄时自动换行) */
.mem-body .mem-list {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; max-width: none;
}
@media (max-width: 1180px) {
  .mem-body .mem-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.mem-card { align-items: center; flex-wrap: wrap; }
.mem-card .mem-main { flex: 1 1 100%; min-width: 0; }
/* v=302: 第二行 = 「状态 …………… 操作」两端对齐。
   ⚠️ 原来是 .mem-status{margin-left:auto} + .mem-ops{margin-left:8px}:
      有操作钮的自建卡 → auto 吃掉剩余空间, 状态被顶到中间;
      没操作钮的节假日卡 → auto 把状态顶到最右。
      同一列里两种卡的倒计时数字一左一右, 就是用户报的"位置不一致"。
   改成状态永远左对齐、操作钮 margin-left:auto 靠右, 两种卡的数字落在同一条竖线上。 */
.mem-card .mem-status { margin-left: 0; text-align: left; }
.mem-card .mem-ops { margin-left: auto; }
/* 3 列窄卡: 标题/副标题各自省略, 状态行独立一行不挤压标题 */
.mem-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mem-title { min-width: 0; }

/* ===== flatpickr 主题适配 (v=194): 跟随应用明暗主题 ===== */
.flatpickr-calendar {
  background: var(--bg-elevated) !important;
  border: 0.5px solid var(--border-default) !important;
  box-shadow: 0 8px 28px rgba(0,0,0,.14) !important;
  border-radius: var(--radius-lg) !important;
  font-family: inherit !important;
}
.flatpickr-calendar.arrowTop:before, .flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before, .flatpickr-calendar.arrowBottom:after { display: none !important; }
.flatpickr-months, .flatpickr-month { background: transparent !important; color: var(--text-primary) !important; }
.flatpickr-current-month { font-size: .95rem !important; font-weight: 600 !important; color: var(--text-primary) !important; }
.flatpickr-current-month .numInputWrapper span.arrowUp, .flatpickr-current-month .numInputWrapper span.arrowDown { border: none !important; }
.flatpickr-current-month input.cur-year { color: var(--text-primary) !important; font-weight: 600 !important; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { fill: var(--text-secondary) !important; }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: #4353D6 !important; }
span.flatpickr-weekday { color: var(--text-tertiary) !important; font-weight: 500 !important; }
.flatpickr-day {
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.1 !important;
}
.flatpickr-day:hover, .flatpickr-day.prevMonthDay:hover, .flatpickr-day.nextMonthDay:hover { background: var(--bg-hover) !important; border-color: transparent !important; }
.flatpickr-day.today { border-color: #4353D6 !important; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: #4353D6 !important; border-color: #4353D6 !important; color: #fff !important; }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--text-tertiary) !important; }
/* 农历模式: 月份标题换成农历月名 */
.fp-lunar-month { font-size: .95rem; font-weight: 600; color: var(--text-primary); }
/* 农历模式: 每格显示「农历日 + 公历小字」 */
.fp-ln-day { font-size: .72rem; line-height: 1.05; }
.fp-ln-solar { font-size: .55rem; opacity: .55; line-height: 1.05; }
.flatpickr-day.selected .fp-ln-solar, .flatpickr-day.selected .fp-ln-day { color: #fff; opacity: .85; }
.flatpickr-time { background: transparent !important; border-top: 0.5px solid var(--border-default) !important; }
.flatpickr-time input, .flatpickr-time .flatpickr-time-separator { color: var(--text-primary) !important; }
.flatpickr-time input:hover, .flatpickr-time input:focus { background: var(--bg-hover) !important; }
.flatpickr-time .numInputWrapper span.arrowUp:after { border-bottom-color: var(--text-secondary) !important; }
.flatpickr-time .numInputWrapper span.arrowDown:after { border-top-color: var(--text-secondary) !important; }
/* 触发输入框 */
.mem-date-field {
  width: 100%; padding: 8px 11px; font-size: var(--fs-sm);
  border: 1px solid var(--border-control); border-radius: var(--radius);
  background: var(--bg-elevated); color: var(--text-primary); cursor: pointer;
}
.mem-date-field:focus { outline: none; border-color: #4353D6; }
/* 类型行横向滑动 (v=186): 类型多了不换行, 左右滑, 滚动条隐藏 */
.mem-tabs {
  display: flex; gap: 6px;
  flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}
.mem-tabs::-webkit-scrollbar { display: none; }
.mem-tabs .mem-tab-wrap, .mem-tabs .mem-tab-add { flex: none; }
.mem-tab {
  border: 0.5px solid var(--border-default); background: var(--surface-card);
  color: var(--text-secondary); cursor: pointer;
  font-size: var(--fs-sm); padding: 5px 14px; border-radius: var(--radius-full);
  transition: all var(--fast) var(--ease);
}
.mem-tab.active { background: #4353D6; border-color: #4353D6; color: #fff; font-weight: 600; }
/* 标签 tab 组: tab 内嵌 色点(点=编辑) + 删除小钮贴内上角 (v=185 修复 × 被裁切) */
.mem-tab-wrap { position: relative; display: inline-flex; align-items: center; }
.mem-tab { display: inline-flex; align-items: center; gap: 5px; }
.mem-tab-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  cursor: pointer; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.15);
}
.mem-tab-del {
  position: absolute; top: -1px; right: -1px; z-index: 1;
  width: 14px; height: 14px; border-radius: 0 var(--radius-full) 0 var(--radius-full);
  border: 0; background: #f03e3e; color: #fff; font-size: 10px; line-height: 14px;
  cursor: pointer; display: none; padding: 0; text-align: center;
}
.mem-tab-wrap:hover .mem-tab-del { display: block; }
.mem-tab-add {
  width: 26px; border: 0.5px dashed var(--border-default); background: transparent;
  color: var(--text-tertiary); cursor: pointer; font-size: var(--fs-md);
  padding: 5px 0 6px; border-radius: var(--radius-full); line-height: 1;
}
.mem-tab-add:hover { color: #4353D6; border-color: #4353D6; }
/* 新建按钮 (v=182 重做): 主色实底 + 圆角 + 内嵌加号, 替换沿用任务样式的旧按钮 */
.mem-new-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; cursor: pointer;
  background: linear-gradient(135deg, #4353D6, #5a6ae8);
  color: #fff; font-size: var(--fs-sm); font-weight: 600;
  padding: 8px 18px; border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(67, 83, 214, .35);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.mem-new-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(67, 83, 214, .45); }
.mem-new-btn:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(67, 83, 214, .35); }
.mem-new-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255,255,255,.22); font-size: 13px; line-height: 1;
}
/* 卡片上的标签小片 */
.mem-tag {
  font-size: var(--fs-2xs); color: var(--text-tertiary);
  background: var(--bg-surface); border: 0.5px solid var(--border-default);
  padding: 0 6px; border-radius: 3px; flex: none; line-height: 1.6;
}
/* 抽屉里的标签勾选组 */
.mem-tags-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.mem-tag-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer;
  border: 0.5px solid var(--border-default); border-radius: var(--radius-full);
  padding: 4px 12px; transition: all var(--fast) var(--ease);
}
.mem-tag-check:has(input:checked) { background: #eef1fc; border-color: #4353D6; color: #4353D6; font-weight: 600; }
/* v=183 重构: 日期类型 seg 与下方输入框的间距 */
#mem-solar-row input[type="date"] {
  padding: 8px 11px; font-size: var(--fs-md);
  border: 1px solid var(--border-control); border-radius: var(--radius);
  background: var(--bg-elevated); color: var(--text-primary);
}
#mem-solar-row input[type="date"]:focus { border-color: var(--border-focus); outline: none; box-shadow: var(--ring); }
/* 农历下拉与任务抽屉 select 同宽同风格 */
#mem-lunar-row .mem-lunar-picker select {
  flex: 1; padding: 8px 11px; padding-right: 30px;
  font-size: var(--fs-md);
}
#mem-lunar-row .mem-lunar-picker select:focus { border-color: var(--border-focus); outline: none; box-shadow: var(--ring); }
.mem-list { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.mem-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-card); border: 0.5px solid var(--border-default);
  border-radius: var(--radius-md); padding: 12px 16px; cursor: pointer;
  transition: box-shadow var(--fast) var(--ease);
}
.mem-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
/* v=304: 置顶标记改用 inset 阴影, **不再加粗 border-left**。
   ⚠️ 原来写 border-left:3px 会把 border-box 里的内容整体右推 2.5px
      (普通卡是 0.5px 描边) → 置顶卡的倒计时数字比旁边节假日卡右移 2px,
      同一列里数字又对不齐了 (用户报的"位置不一致"会以另一种形式复发)。
      inset 阴影画在 padding 区里, 不占布局, 卡片内边距保持 16px 不变。 */
.mem-card.is-pinned { box-shadow: inset 3px 0 0 0 #f59f00; }
.mem-card.is-pinned:hover { box-shadow: inset 3px 0 0 0 #f59f00, 0 2px 8px rgba(0,0,0,.08); }
.mem-main { flex: 1; min-width: 0; }
.mem-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mem-kind {
  font-size: var(--fs-2xs); font-weight: 600; padding: 1px 6px; border-radius: 3px; flex: none;
}
.mem-kind-countdown { color: #0b7285; background: #e6f7fa; }
.mem-kind-anniversary { color: #6741d9; background: #f1edfc; }
.mem-kind-birthday { color: #c2255c; background: #fdeef4; }
/* 自定义类型 (v=184): 中性灰蓝 */
.mem-kind-custom { color: var(--text-secondary); background: var(--bg-surface); border: 0.5px solid var(--border-default); }
html:not([data-theme="light"]) .mem-kind-countdown { color: #66d9e8; background: rgba(102,217,232,.1); }
html:not([data-theme="light"]) .mem-kind-anniversary { color: #b197fc; background: rgba(177,151,252,.12); }
html:not([data-theme="light"]) .mem-kind-birthday { color: #f783ac; background: rgba(247,131,172,.12); }
html:not([data-theme="light"]) .mem-kind-custom { color: var(--text-secondary); background: rgba(255,255,255,.04); }

/* ===== v=242: 计时器板块的「节假日倒计时」 =====
   只读展示, 不是 DB 记录 —— 所以没有操作按钮, 光标也不该是 pointer。
   整块和用户自己的计时之间用虚线分隔, 避免"这些是不是我建的"这种困惑。 */
/* ⚠️ 列表是 3 列 grid (`.mem-body .mem-list`), 所以头部/分隔线要显式跨列;
   卡片本身不跨列 —— 它们和自己的计时卡保持同一列宽, 视觉上才是一套。
   (套一层容器会让整块被挤进第 1 列, 并把同行的用户卡片撑成一个大空盒 —— 实测过) */
.mem-holiday-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px; padding: 0 2px;
  font-size: var(--fs-2xs); font-weight: 600; color: var(--text-secondary);
}
.mem-holiday-sep { grid-column: 1 / -1; height: 1px; background: var(--border-subtle); margin: 2px 0 6px; }
.mem-holiday-hint { margin-left: auto; font-weight: 400; color: var(--text-muted-label); }
.mem-holiday-empty { grid-column: 1 / -1; font-size: var(--fs-2xs); color: var(--text-muted-label); padding: 2px 2px 0; }
.mem-kind-holiday { color: #c92a2a; background: #fff0f0; }
html:not([data-theme="light"]) .mem-kind-holiday { color: #ffa8a8; background: rgba(255,168,168,.12); }
.mem-card-holiday { cursor: default; }
.mem-card-holiday:hover { box-shadow: none; }
/* v=302: 节假日是只读的, 没有置顶/编辑/删除 —— 但**必须占住同样的位置**,
   否则第二行的布局和自建卡差一截 (卡片也会矮 2px)。这里放一枚不可点的
   「自动」标记: 高度与 .mem-op 完全一致, 视觉上说明"这条不用你管"。 */
.mem-ops-readonly { opacity: 1 !important; pointer-events: none; }
.mem-op-auto {
  cursor: default; color: var(--text-muted-label);
  background: transparent; border-style: dashed;
}
.mem-card-holiday .mem-status { cursor: default; }
/* 类别 pill 高度对齐: 自建卡的 pill 带 0.5px 描边 (内联 style / .mem-kind-custom),
   节假日 pill 没有 → 矮 1px, 标题基线跟着错位。统一给一层透明描边占位。 */
.mem-kind { border: 0.5px solid transparent; }

/* 自定义弹窗 (v=184: 替代浏览器 prompt/confirm) */
.mem-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  animation: memModalIn 120ms ease;
}
@keyframes memModalIn { from { opacity: 0; } to { opacity: 1; } }
.mem-modal {
  width: min(360px, calc(100vw - 48px));
  background: var(--surface-card, #fff);
  border: 0.5px solid var(--border-default);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  padding: 20px;
}
.mem-modal-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); }
.mem-modal-body { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 8px; line-height: 1.6; }
.mem-modal-input {
  width: 100%; margin-top: 14px; padding: 9px 11px;
  border: 1px solid var(--border-control); border-radius: var(--radius, 8px);
  background: var(--bg-elevated); color: var(--text-primary);
  font-size: var(--fs-md); outline: none; font-family: var(--font-sans);
}
.mem-modal-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
.mem-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.mem-modal-btn {
  border: 0.5px solid var(--border-default); background: var(--bg-surface);
  color: var(--text-secondary); cursor: pointer;
  font-size: var(--fs-sm); padding: 7px 16px; border-radius: var(--radius, 8px);
}
.mem-modal-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }
.mem-modal-btn.mem-modal-ok { background: #4353D6; border-color: #4353D6; color: #fff; font-weight: 600; }
.mem-modal-btn.mem-modal-ok:hover { background: #3743b8; }
.mem-modal-btn.mem-modal-danger { background: #f03e3e; border-color: #f03e3e; color: #fff; font-weight: 600; }
.mem-modal-btn.mem-modal-danger:hover { background: #d63030; }

/* 看板模块: 分类管理条 (v=185, 从个人设置迁来, 与计时器 tab 同位) */
.kanban-module { display: flex; flex-direction: column; min-height: 0; }
.kanban-module.hidden { display: none; }
.board-pri-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-card); border: 0.5px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 8px 12px; margin-bottom: 14px;
}
.board-pri-bar-head { display: flex; flex-direction: column; gap: 1px; flex: none; }
.board-pri-bar-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.board-pri-bar-hint { font-size: var(--fs-2xs); color: var(--text-tertiary); }
.board-pri-bar .pri-manage {
  /* v=187: 移动端单行横向滑动 (与 .mem-tabs 一致), 不再 wrap 堆叠 */
  display: flex; flex-direction: row; flex-wrap: nowrap; gap: 6px;
  flex: 1; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}
.board-pri-bar .pri-manage::-webkit-scrollbar { display: none; }
.board-pri-bar .pri-manage .pri-row { flex: none; }
/* 管理行在条里收成胶囊 (原是设置面板里的整行列表) */
.board-pri-bar .pri-row {
  border: 0.5px solid var(--border-default); border-radius: var(--radius-full);
  padding: 2px 8px; gap: 5px; white-space: nowrap;
}
.board-pri-bar .pri-row-grip { cursor: grab; display: inline-flex; color: var(--text-tertiary); }
.board-pri-bar .pri-row-name { font-size: var(--fs-xs); }
/* 设置面板里的下拉 */
.settings-select {
  padding: 6px 30px 6px 11px; font-size: var(--fs-sm);
  border: 1px solid var(--border-control); border-radius: var(--radius);
  background: var(--bg-elevated); color: var(--text-primary); cursor: pointer;
}

/* 移动端 / 触屏: 计时卡片纵向堆叠 + 操作钮常显 (无 hover)
   v=194 移动端: 类别栏变顶部横向卡片条 (常显编辑/删除), 列表单列 */
@media (max-width: 768px), (pointer: coarse) {
  .mem-card { flex-wrap: wrap; row-gap: 6px; }
  .mem-main { flex-basis: 100%; }
  .mem-status { text-align: left; flex: 1; }
  .mem-card .mem-ops { opacity: 1; }
  .mem-new-btn { padding: 7px 14px; }
  .board-pri-bar { padding: 8px 10px; }
  .mem-layout { display: block; }
  .mem-side {
    width: auto; position: static; margin-bottom: 12px;
    flex-direction: column; gap: 6px;
  }
  .mem-cats { flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .mem-cats::-webkit-scrollbar { display: none; }
  .mem-cat-row { flex: none; }
  .mem-cat-acts { position: static; display: inline-flex; background: transparent; }
  /* v=209: 20px 低于本项目触控标准 (34-44px 为理想, 30 是行高允许的上限),
     小屏手指按 20px 图标经常点空 —— 放大到 30 (行高 30, 撑满整行) */
  .mem-cat-acts .mem-cat-act { width: 30px; height: 30px; }
  .mem-cat-act svg { width: 13px; height: 13px; }
  .mem-body .mem-list { display: flex; flex-direction: column; gap: 8px; }
}
/* 桌面端宽屏: 分类条空间足够, 恢复 wrap 自然铺开 */
@media (min-width: 769px) {
  .board-pri-bar .pri-manage { flex-wrap: wrap; overflow: visible; padding: 0; }
}
@media (pointer: fine) and (min-width: 769px) {
  .mem-card .mem-ops { opacity: 0; transition: opacity var(--fast) var(--ease); }
  .mem-card:hover .mem-ops { opacity: 1; }
}
.mem-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-pin { color: #f59f00; font-size: var(--fs-sm); flex: none; }
.mem-sub { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-status { font-size: var(--fs-sm); font-weight: 600; flex: none; text-align: right; cursor: pointer; user-select: none; }
.mem-st-precise { font-variant-numeric: tabular-nums; font-weight: 600; }
/* v=190: 单 span 状态值 (单位循环切换), 精确模式走秒时等宽数字 */
.mem-st-val { white-space: nowrap; }
.mem-st-val.is-precise { font-variant-numeric: tabular-nums; font-weight: 600; }
/* v=190: 抽屉类型 seg 内的色点 */
.mem-kind-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none; margin-left: 6px;
  cursor: pointer; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.15);
  display: inline-block;
}
.mem-st-today { color: #f03e3e; }
.mem-st-soon { color: #0b7285; }   /* 临近 (阈值 = JS 的 MEM_SOON_DAYS, 现 3 天) */
.mem-st-far { color: var(--text-secondary); font-weight: 500; }
.mem-st-past { color: var(--text-tertiary); font-weight: 400; }
html:not([data-theme="light"]) .mem-st-soon { color: #66d9e8; }
.mem-ops { display: flex; gap: 4px; flex: none; opacity: 0; transition: opacity var(--fast) var(--ease); }
.mem-card:hover .mem-ops { opacity: 1; }
.mem-op {
  border: 0.5px solid var(--border-default); background: var(--bg-surface);
  color: var(--text-secondary); font-size: var(--fs-2xs); cursor: pointer;
  padding: 2px 8px; border-radius: var(--radius-sm);
}
.mem-op:hover { color: var(--text-primary); border-color: var(--border-hover); }
.mem-op-del:hover { color: #f03e3e; border-color: #f03e3e; }
.mem-empty {
  text-align: center; color: var(--text-tertiary); font-size: var(--fs-sm);
  padding: 48px 0; border: 1px dashed var(--border-default); border-radius: var(--radius-md);
}
/* 抽屉表单复用项 */
.mem-kind-picker { display: flex; gap: 6px; }
.mem-kind-opt {
  border: 0.5px solid var(--border-default); background: var(--surface-card);
  color: var(--text-secondary); cursor: pointer; font-size: var(--fs-sm);
  padding: 5px 14px; border-radius: var(--radius-sm);
}
.mem-kind-opt.active { background: #4353D6; border-color: #4353D6; color: #fff; font-weight: 600; }
.mem-lunar-picker { display: flex; align-items: center; gap: 8px; }
.mem-lunar-picker select {
  border: 0.5px solid var(--border-default); background: var(--surface-card);
  color: var(--text-primary); font-size: var(--fs-sm); padding: 5px 8px; border-radius: var(--radius-sm);
}
.mem-lunar-hint { font-size: var(--fs-2xs); color: var(--text-tertiary); }
.mem-check { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; }

/* 日历多任务日子抽屉 */
.day-list-drawer { padding: 8px 0; }
.day-list-drawer-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 12px;
}
.day-list-drawer-title {
  font-size: .9rem; font-weight: 500; color: var(--text-primary);
  flex: 1;
}
.day-list-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; gap: 12px;
  text-align: center;
}
.day-list-empty-icon {
  font-size: 2.5rem; opacity: .5;
}
.day-list-empty-text {
  font-size: .9rem; color: var(--text-secondary);
}
.day-list-drawer-list { display: flex; flex-direction: column; gap: 8px; }
.day-list-drawer-item {
  display: flex; align-items: stretch; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--fast);
}
.day-list-drawer-item:hover { background: var(--bg-hover); }
.day-list-drawer-item .day-list-bar {
  width: 3px; border-radius: 2px; flex-shrink: 0;
}
.day-list-drawer-item .day-list-content { flex: 1; min-width: 0; }
.day-list-drawer-item .day-list-text {
  font-size: .9rem; color: var(--text-primary); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day-list-drawer-item .day-list-text.done {
  text-decoration: line-through; color: var(--text-tertiary);
}
.day-list-drawer-item .day-list-meta {
  display: flex; gap: 10px; font-size: .72rem;
  color: var(--text-tertiary); margin-top: 4px;
  align-items: center;
}
/* (原 .badge-urgent / .badge-low 已删 —— 2026-09-21 起分类档位可自定义,
   这里改挂通用的 .badge-priority, 颜色由 data-pri-color 决定) */
.day-list-drawer-item .day-list-del-btn {
  border: none; background: transparent;
  color: var(--text-tertiary);
  width: 24px; height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  align-self: center;
  opacity: 0;
  transition: opacity var(--fast), background var(--fast), color var(--fast);
}
.day-list-drawer-item:hover .day-list-del-btn { opacity: 1; }
.day-list-drawer-item .day-list-del-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  opacity: 1;
}

/* (.day-dots / .day-dot 三档规则已删: app.js 里零引用, 是早期"三档全灰"
   版本的遗留死代码; 日历在移动端也早已改用 .day-title 小条, 不再用圆点。) */
/* +N 可点 (2026-09-27): 做成小胶囊按钮的样子, 让用户知道能点 */
.day-more {
  font-size: .62rem; color: var(--text-tertiary); align-self: flex-start;
  cursor: pointer; border-radius: var(--radius-full);
  padding: 1px 6px; background: transparent; line-height: 1.4;
  font-weight: 600;
}
.day-more:hover { background: var(--accent-subtle); color: var(--accent); }

/* ===== 日历当日任务列表抽屉 ===== */
.day-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-default);
}
.day-list-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.day-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day-list-item {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px 8px 8px 0;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--fast);
  overflow: hidden;
}
.day-list-item:hover { background: var(--bg-hover); }
.day-list-bar {
  width: 3px;
  flex-shrink: 0;
  background: var(--pri-bar, var(--border-default));
}
.day-list-content { flex: 1; min-width: 0; }
.day-list-text {
  font-size: .85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.day-list-text.done {
  text-decoration: line-through;
  color: var(--text-tertiary);
  opacity: .6;
}
.day-list-meta {
  display: flex;
  gap: 8px;
  font-size: .68rem;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}
.day-list-priority { color: var(--pri-text, var(--text-tertiary)); }
.day-list-status.status-todo { color: var(--text-secondary); }
.day-list-status.status-doing { color: var(--accent); }
.day-list-status.status-done { color: var(--text-tertiary); opacity: .7; }
.day-list-time { font-family: var(--font-mono); }
.day-list-arrow {
  align-self: center;
  color: var(--text-tertiary);
  font-size: 1.2rem;
  padding-right: 4px;
}

/* ===== 日历多任务抽屉底部切换面板 ===== */
.day-list-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-default);
}
.day-list-footer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: .78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-ghost-sm {
  padding: 4px 10px; border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); font-size: .78rem; cursor: pointer;
  transition: all var(--fast);
}
.btn-ghost-sm:hover { border-color: var(--border-focus); color: var(--text-primary); }

/* ===== Drawer (task detail / new task) ===== */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 60; backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  background: var(--surface-primary); border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-drawer);
  z-index: 70;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--norm) var(--ease);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border-default);
}
.drawer-meta { display: flex; align-items: center; gap: 8px; }
#drawer-id { font-family: var(--font-mono); font-size: .72rem; color: var(--text-tertiary); }
/* 同 .status-pill: 基类给中性底, 自定义板块的 pill 才不是一段裸文字 */
.drawer-status-pill { font-size: .72rem; padding: 2px 8px; border-radius: 100px; background: var(--bg-elevated); color: var(--text-secondary); }
.drawer-status-pill.status-todo { background: var(--bg-elevated); color: var(--text-secondary); }
.drawer-status-pill.status-doing { background: var(--doing-bg); color: var(--text-primary); }
.drawer-status-pill.status-done { background: var(--done-bg); color: var(--done-text); }
.drawer-status-pill.status-cancelled { background: var(--bg-elevated); color: var(--text-tertiary); }
.drawer-actions { display: flex; gap: 4px; }

.drawer-body {
  flex: 1; overflow-y: auto; padding: 16px;
  transition: opacity 150ms ease;
}
.drawer-body.is-switching { opacity: 0; }
.drawer-form { display: flex; flex-direction: column; gap: 18px; }
/* 旧版是无边框 + 下划线，视觉上跟"可点击的链接"撞脸；
   改成实心输入框，明确"这里能打字"。 */
.drawer-title-input {
  font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em;
  padding: 9px 11px; width: 100%;
  border: 1px solid var(--border-control); border-radius: var(--radius);
  background: var(--bg-elevated); color: var(--text-primary);
  outline: none; font-family: var(--font-sans);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.drawer-title-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }

/* v=274: 标题输入由 input 换成 textarea —— 打满一行继续输入会自动折到第二行,
   高度也跟着内容长 (由 app.js 的 initDrawerTitleInput 逐次量 scrollHeight)。
   ⚠️ max-height 必须与 app.js 里的 MAX_H(152) 同值: 两边对不上就会出现
      「JS 以为还能长、CSS 已经截断」, 看起来像最后一行被削掉。
   ⚠️ 不要写 resize:vertical 之外的值给用户 —— 抽屉里允许手动拖高会把手感做坏;
      这里直接 resize:none, 高度由内容决定。 */
.drawer-title-input.drawer-title-auto {
  display: block;
  resize: none;
  overflow-y: hidden;
  line-height: 1.45;
  min-height: calc(1.45em + 20px);   /* 一行文字 + 上下 padding(18) + 边框(2) */
  max-height: 152px;                 /* 约 5 行, 再多改为内部滚动 */
  white-space: pre-wrap;
  word-break: break-word;
}
.drawer-desc-input {
  border: 1px solid var(--border-control); border-radius: var(--radius);
  padding: 9px 11px; background: var(--bg-elevated); color: var(--text-secondary);
  font-size: var(--fs-md); resize: vertical; font-family: var(--font-sans);
  line-height: var(--lh);
}
.drawer-desc-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
.drawer-desc-input:focus { border-color: var(--border-focus); outline: none; }

.drawer-section { display: flex; flex-direction: column; gap: 7px; }
/* 核心字段 → 附加内容 的视觉分界，避免整张表从上到下一条直线 */
.drawer-section-divider { border-top: 1px solid var(--border-subtle); padding-top: 16px; }
/* 旧版 label 加了 uppercase + letter-spacing .04em：对中文无效，只把字距拉散发虚。
   中文标签用「小字 + 次级色 + 常规字重」表达层级就够了。 */
.drawer-section label { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; }

/* ⚠️ 这里原来写的是 background 简写 —— 会连通用 select 的 background-image
（自绘箭头）一起清掉，所以拆成"只管尺寸"，底色/描边/箭头交给通用规则。
   ⚠️ padding-right 必须重新给：上面的 padding 简写会盖掉为箭头留的 30px。 */
/* ⚠️ 2026-10-21: 截止日期改成 flatpickr 的 type="text" 之后, 下面这条
   `input[type="datetime-local"]` 就**不再命中**了 —— 控件退回浏览器原生白框
   (2px inset 边 / 零内边距 / 19px 高), 深色主题下是一块刺眼的白板。
   现在把 #drawer-due 显式列进来, 并单独给它一套"可点击的日期井"外观。 */
.drawer-section select, .drawer-section input[type="datetime-local"], #drawer-due {
  padding: 8px 11px;
  font-size: var(--fs-md);
}
.drawer-section select { padding-right: 30px; }

/* --- 截止日期字段: 左图标 + 右「清除」 --- */
.drawer-due-field { position: relative; display: flex; align-items: center; }
.drawer-due-field .drawer-due-icon {
  position: absolute; left: 11px; display: flex; align-items: center;
  color: var(--text-muted-label); pointer-events: none;
}
#drawer-due {
  width: 100%; height: 38px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.35; cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
#drawer-due:hover { border-color: var(--border-control-hover); }
#drawer-due:focus { border-color: var(--border-focus); outline: none; box-shadow: var(--ring); }
.drawer-due-clear {
  position: absolute; right: 5px;
  height: 26px; padding: 0 9px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: var(--fs-2xs); cursor: pointer;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.drawer-due-clear:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-default); }
.drawer-due-clear:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

/* --- 专注时长字段 (v=268) ---
   select 沿用上面 .drawer-section select 的通用外观；number 输入框没有通用规则，
   得单独给一套，否则会退化成浏览器原生白框（和 #drawer-due 那次的坑同源）。 */
.drawer-focus-field { display: flex; align-items: center; gap: 8px; }
.drawer-focus-field select { flex: 0 0 auto; min-width: 120px; }
.drawer-focus-field input[type="number"] {
  flex: 1; min-width: 0;
  padding: 8px 11px;
  font-size: var(--fs-md);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.drawer-focus-field input[type="number"]:focus {
  border-color: var(--border-focus); outline: none; box-shadow: var(--ring);
}
.drawer-focus-hint { font-size: .7rem; color: var(--text-muted-label); }

/* ===== 专注弹窗 (v=268) =====
   用户要求："点击时候显示一个 css 比较好看的时间流逝弹窗，里面显示标题和一个
   有特效的时间"，"鼠标放上去这个地方才显示暂停时间和删除按钮"。
   → 默认只露标题 + 大号时间，悬停卡片才浮现两个按钮；
     触屏没有 hover，用 @media (hover: none) 改成常显，否则手机上按不到。 */
.focus-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(10, 12, 18, .55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: focus-fade .18s var(--ease);
}
.focus-modal.hidden { display: none; }
@keyframes focus-fade { from { opacity: 0; } }

.focus-card {
  position: relative;
  width: 100%; max-width: 400px;
  padding: 30px 28px 22px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  box-shadow: var(--shadow-cmdk);
  text-align: center;
  animation: focus-pop .26s var(--ease);
  outline: none;   /* 靠 tabindex=-1 接住焦点，但不画 ring（否则像被选中了） */
}
@keyframes focus-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.focus-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.focus-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.focus-close:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

.focus-eyebrow {
  font-size: .72rem; font-weight: 600;
  color: var(--accent);
}
.focus-title {
  margin: 6px 0 20px;
  font-size: .98rem; font-weight: 600; line-height: 1.45;
  color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.focus-clock-wrap { padding: 0 4px; }
.focus-clock {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Consolas, monospace);
  font-size: clamp(46px, 13vw, 68px);
  font-weight: 700; line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  /* "特效"：一层主色光晕。只动 text-shadow 不会引起重排，
     每秒变化也稳（数字本身是文本节点替换）。 */
  text-shadow: 0 0 28px color-mix(in srgb, var(--accent) 42%, transparent);
}
.focus-card.is-paused .focus-clock { color: var(--text-secondary); text-shadow: none; }
.focus-card.is-paused .focus-eyebrow { color: var(--text-secondary); }
.focus-card.is-done .focus-clock {
  color: var(--c-success-text);
  text-shadow: 0 0 26px color-mix(in srgb, var(--c-success-text) 45%, transparent);
  animation: focus-blink 1.8s ease-in-out infinite;
}

.focus-bar {
  height: 3px; margin-top: 20px;
  border-radius: 2px; overflow: hidden;
  background: var(--border-default);
}
.focus-bar-fill {
  display: block; height: 100%; width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg,
      color-mix(in srgb, var(--accent) 45%, transparent), var(--accent));
  /* 900ms linear：每秒更新一次宽度，用 linear 把两次更新接成连续收缩；
     ease 会让它一顿一顿地跳。 */
  transition: width 900ms linear;
}

.focus-actions {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 22px;
  opacity: 0; transform: translateY(4px);
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
/* ⚠️ 这里只能用 :hover + .focus-actions:focus-within，
   不能写 .focus-card:focus-within —— 打开弹窗时焦点若落在某个按钮上，
   "卡片内有焦点"会一直成立，按钮就一直显着，"悬停才出现"等于没做。
   现在初始焦点给关闭键（在 .focus-actions 之外），键盘用户 Tab 到按钮时
   再靠 .focus-actions:focus-within 把它显出来。 */
.focus-card:hover .focus-actions,
.focus-actions:focus-within {
  opacity: 1; transform: none; pointer-events: auto;
}
.focus-hint {
  margin-top: 14px; font-size: .68rem; color: var(--text-muted-label);
  transition: opacity .2s var(--ease);
}
.focus-card:hover .focus-hint { opacity: 0; }

.focus-btn {
  min-width: 84px; height: 36px; padding: 0 16px;
  border: 1px solid var(--border-default); border-radius: 10px;
  background: var(--bg-elevated); color: var(--text-primary);
  font-family: inherit; font-size: .84rem; font-weight: 500;
  cursor: pointer;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.focus-btn:hover { border-color: var(--accent); color: var(--accent); }
.focus-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.focus-btn:disabled { opacity: .45; cursor: not-allowed; }
.focus-btn:disabled:hover { border-color: var(--border-default); color: var(--text-primary); }
.focus-btn.is-danger {
  color: var(--c-danger-text);
  border-color: var(--c-danger-border);
  background: var(--c-danger-bg);
}
.focus-btn.is-danger:hover { color: var(--c-danger-text); border-color: var(--c-danger-text); }

/* ===== v=288 设置态：选时长 =====
   入口从任务抽屉搬到卡片 ··· 菜单后，同一个弹窗要承担"第一次设置"。
   和计时态共用 .focus-card 外壳，只换内部几块。 */
.focus-field { margin-top: 2px; }
.focus-field-label {
  display: block;
  margin-bottom: 10px;
  font-size: .72rem; font-weight: 600;
  color: var(--text-secondary);
}
/* 5 列定宽：15/25/45/60/自定义 正好一行。窄屏也算过：
   375px 手机里卡片内容宽约 335px，(335-8×4)/5 ≈ 60px，「自定义」三个字放得下。 */
.focus-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.focus-preset {
  height: 38px;
  padding: 0 2px;            /* 不留大内边距，靠 1fr 均分，避免窄屏挤字 */
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit; font-size: .8rem; font-weight: 500;
  cursor: pointer;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.focus-preset:hover { border-color: var(--accent); color: var(--text-primary); }
.focus-preset:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.focus-preset.is-active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}
.focus-custom {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px;
  font-size: .78rem; color: var(--text-secondary);
}
/* 项目里没有全局 .hidden，每个组件自己写 —— 漏了这条自定义输入框会一直露着 */
.focus-custom.hidden { display: none; }
.focus-custom input {
  width: 92px; height: 38px;
  padding: 0 8px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;           /* iOS 聚焦时小于 16px 会放大整页 */
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.focus-custom input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
/* 隐藏数字框的上下小箭头：92px 宽里它和「分钟」后缀挤在一起很难看，
   键盘上下键/滚轮照样能调，值域还有 min/max 兜底 */
.focus-custom input::-webkit-outer-spin-button,
.focus-custom input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.focus-custom input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* 设置态的主按钮必须常显 —— .focus-actions 默认是 hover 才浮现的那套，
   而"开始专注"是这一步唯一要做的事，藏着等于没有入口 */
.focus-actions.is-static { opacity: 1; transform: none; pointer-events: auto; }
.focus-btn.is-primary {
  min-width: 132px;
  background: var(--accent);
  border-color: var(--accent);
  /* 跟 .btn-generate-primary 用同一个前景色变量 —— 一处调、两处一起变 */
  color: var(--on-accent);
  font-weight: 600;
}
.focus-btn.is-primary:hover {
  color: var(--on-accent);
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}
.focus-btn.is-primary:disabled { opacity: .55; }
/* 设置态的提示是说明性文字，别跟着 hover 隐没 */
.focus-card.is-setup .focus-hint { opacity: 1; }
/* 计时态现在三个按钮（暂停/重新设置/结束），窄屏要能换行不压扁 */
.focus-actions { flex-wrap: wrap; }

/* 触屏：没有 hover 就永远看不到按钮 → 直接常显 */
@media (hover: none) {
  .focus-actions { opacity: 1; transform: none; pointer-events: auto; }
  .focus-hint { display: none; }
}
@media (max-width: 480px) {
  .focus-card { padding: 26px 20px 18px; border-radius: 16px; }
  .focus-btn { min-width: 92px; height: 44px; }   /* 触控下限 */
}
body.focus-open { overflow: hidden; }
.drawer-section select:focus, .drawer-section input:focus {
  border-color: var(--border-focus); outline: none; box-shadow: var(--ring);
}

.seg-group { display: flex; gap: 6px; }
.seg-group .seg {
  padding: 6px 14px; border: 1px solid var(--border-default); border-radius: var(--radius);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--fast) var(--ease);
}
.seg-group .seg:hover { border-color: var(--border-hover); color: var(--text-primary); }
.seg-group .seg.active { background: var(--bg-active); color: var(--text-primary); border-color: var(--border-focus); }
/* 选中项按分类上色 —— 旧版三个档选中后长得一模一样（都是灰蓝），
   看不出"我选的是紧急还是不急"。 */
.seg-group .seg.active[data-priority="urgent"] { background: var(--c-danger-bg); border-color: var(--c-danger-border); color: var(--c-danger-text); }
.seg-group .seg.active[data-priority="normal"] { background: var(--c-info-bg); border-color: var(--c-info-border); color: var(--c-info-text); }
.seg-group .seg.active[data-priority="low"] { background: var(--c-neutral-bg); border-color: var(--c-neutral-border); color: var(--text-secondary); }

.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist-item { display: flex; align-items: center; gap: 6px; }
.checklist-item input[type="text"] {
  flex: 1; padding: 4px 8px; border: 1px solid var(--border-control); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-primary); font-size: .82rem;
}
.checklist-item input[type="text"]:focus { border-color: var(--border-focus); outline: none; }

.link-btn { border: none; background: none; color: var(--text-secondary); font-size: .78rem; cursor: pointer; padding: 4px 0; }
.link-btn:hover { color: var(--text-primary); }

/* 附件样式已移除 (2026-11-05 任务附件下线); 评论样式同批次下线, 保留注释便于回溯 */

/* ===== 评论 ===== */
.comment-list { display: flex; flex-direction: column; gap: 8px; }
.comment-item { padding: 8px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--bg-elevated); }
.comment-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment-author { font-size: .72rem; font-weight: 600; color: var(--text-secondary); }
.comment-time { font-size: .68rem; color: var(--text-tertiary); font-family: var(--font-mono); }
.comment-content { font-size: .8rem; color: var(--text-primary); line-height: 1.5; word-break: break-word; }
.comment-input-row { display: flex; gap: 8px; margin-top: 6px; }
.comment-input-row input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--border-control);
  border-radius: var(--radius-sm); background: var(--bg-elevated);
  color: var(--text-primary); font-size: .82rem;
}
.comment-input-row input:focus { border-color: var(--border-focus); outline: none; }

.drawer-footer { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-default); }

.drawer-audit { margin-top: 16px; border-top: 1px solid var(--border-default); padding-top: 12px; }
.drawer-audit details { font-size: .78rem; }
.drawer-audit summary { cursor: pointer; color: var(--text-tertiary); }

/* ===== 任务操作历史 · 时间线 (v=268) =====
   原来是「动作 + 原始 details」两行纯文本，用户看不懂也读不出先后。
   改成时间线：左侧圆点按动作类型上色，右侧「动作 + 相对时间」，中间是「旧 → 新」对比。 */
.audit-tl { list-style: none; margin: 10px 0 0; padding: 0 0 0 15px; }
.audit-tl-item { position: relative; padding-bottom: 14px; }
.audit-tl-item:last-child { padding-bottom: 2px; }
/* 竖线从圆点下方开始，不穿过圆点 —— 这样不用给圆点描边去盖它 */
.audit-tl-item::before {
  content: ''; position: absolute; left: -11.5px; top: 12px; bottom: 0;
  width: 1px; background: var(--border-default);
}
.audit-tl-item:last-child::before { display: none; }
.audit-dot {
  position: absolute; left: -15px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-tertiary);
}
.audit-tl-item.is-create  .audit-dot { background: var(--c-success-text, #22a06b); }
.audit-tl-item.is-danger  .audit-dot { background: var(--c-danger-text, #e03131); }
.audit-tl-item.is-info    .audit-dot { background: var(--c-info-text, #4c6ef5); }
.audit-tl-item.is-edit    .audit-dot { background: var(--accent); }
.audit-tl-item.is-archive .audit-dot { background: var(--text-tertiary); }

.audit-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.audit-head strong {
  font-size: .78rem; font-weight: 600; color: var(--text-primary);
  overflow-wrap: anywhere;
}
.audit-head time {
  flex: 0 0 auto; font-size: .68rem; color: var(--text-muted-label); white-space: nowrap;
}
.audit-diff {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-top: 4px; font-size: .72rem;
}
.audit-val {
  padding: 1px 6px; border-radius: 4px; max-width: 100%; overflow-wrap: anywhere;
}
.audit-val.is-old {
  color: var(--text-secondary); background: var(--bg-elevated);
  text-decoration: line-through; text-decoration-color: var(--text-tertiary);
}
.audit-val.is-new { color: var(--text-primary); background: var(--accent-subtle); }
.audit-arrow { color: var(--text-tertiary); font-size: .7rem; }
.audit-note {
  margin-top: 3px; font-size: .72rem; color: var(--text-secondary); overflow-wrap: anywhere;
}
.audit-more {
  margin-top: 8px; border: 0; background: none; padding: 2px 0;
  font: inherit; font-size: .7rem; color: var(--text-muted-label); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.audit-more:hover { color: var(--accent); }
.audit-empty { margin-top: 8px; font-size: .75rem; color: var(--text-muted-label); }

/* ===== Buttons ===== */
.btn-primary {
  padding: 6px 14px; border: 1px solid var(--border-focus); border-radius: var(--radius-sm);
  background: var(--bg-active); color: var(--text-primary); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: all var(--fast);
}
.btn-primary:hover { background: var(--border-focus); border-color: var(--accent); }

.btn-ghost {
  padding: 6px 14px; border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); font-size: .82rem; cursor: pointer;
  transition: all var(--fast);
}
.btn-ghost:hover { border-color: var(--border-focus); color: var(--text-primary); }

/* ===== Command palette (⌘K) ===== */
.cmdk-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; backdrop-filter: blur(3px); }
.cmdk {
  position: fixed; top: 15%; left: 50%; transform: translateX(-50%);
  width: 500px; max-width: 90vw; background: var(--bg-elevated);
  border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.6); z-index: 100;
  padding: 12px;
}
#cmdk-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius);
  background: var(--bg-surface); color: var(--text-primary); font-size: .95rem; outline: none;
}
#cmdk-input:focus { border-color: var(--border-focus); }
#cmdk-input::placeholder { color: var(--text-tertiary); }
.cmdk-list { max-height: 300px; overflow-y: auto; margin-top: 8px; }
.cmdk-item {
  display: block; width: 100%; padding: 8px 12px; border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-secondary); font-size: .85rem;
  text-align: left; cursor: pointer;
}
.cmdk-item:hover { background: var(--bg-hover); color: var(--text-primary); }
/* v2.27: 搜索结果行 = 主区点击 + 右侧「↩ 恢复」按钮 (归档项才出现) */
.cmdk-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cmdk-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-restore {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; line-height: 1; font-size: .8rem;
  border: 1px solid var(--border-default); border-radius: 6px;
  background: var(--bg-elevated); color: var(--text-secondary); cursor: pointer;
}
.cmdk-restore:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-hover); }
.cmdk-footer { display: flex; gap: 16px; padding: 8px 0 0; border-top: 1px solid var(--border-default); margin-top: 8px; font-size: .68rem; color: var(--text-tertiary); }
.cmdk-footer kbd { padding: 1px 5px; border-radius: 4px; background: var(--bg-active); font-family: var(--font-mono); font-size: .68rem; }

/* ===== 小记: 导入任务面板 (小记视图内 Alt+I 唤起, 1-5 选范围) ===== */
.note-import-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55); z-index: 95;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.note-import {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  width: 420px; max-width: 92vw; padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6); z-index: 105;
}
.note-import-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 4px 10px;
  font-size: .85rem; font-weight: 600; color: var(--text-primary);
}
.note-import-hint { font-size: .68rem; font-weight: 400; color: var(--text-tertiary); }
.note-import-list { display: flex; flex-direction: column; gap: 2px; }
.note-import-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: .85rem; text-align: left; cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.note-import-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.note-import-key {
  flex: none; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; background: var(--bg-active);
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-tertiary);
}
.note-import-item:hover .note-import-key { color: var(--text-primary); }
.note-import-label { flex: 1; min-width: 0; }
.note-import-desc { font-size: .72rem; color: var(--text-tertiary); }
.note-import-count {
  flex: none; min-width: 22px; text-align: right;
  font-family: var(--font-mono); font-size: .75rem; color: var(--text-tertiary);
}
.note-import-item.is-empty { opacity: .4; }
.note-import-footer {
  display: flex; gap: 16px; padding: 8px 4px 0; margin-top: 8px;
  border-top: 1px solid var(--border-default);
  font-size: .68rem; color: var(--text-tertiary);
}
.note-import-footer kbd {
  padding: 1px 5px; border-radius: 4px; background: var(--bg-active);
  font-family: var(--font-mono); font-size: .68rem;
}

/* ===== 全文搜索 (v2.22) ===== */
.cmdk-group-label {
  padding: 6px 12px 4px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cmdk-empty {
  padding: 16px;
  text-align: center;
  font-size: .85rem;
}
.cmdk-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 4px;
  font-size: .68rem;
  background: var(--surface-tertiary);
  color: var(--text-tertiary);
  border-radius: 3px;
}

/* v2.26: Cmd+K 定位后的高亮动画 (笔记卡片 / 书签项) */
@keyframes cmdk-flash {
  0%   { background: rgba(255, 220, 100, 0.5); box-shadow: 0 0 0 3px rgba(255, 220, 100, 0.5); }
  70%  { background: rgba(255, 220, 100, 0.15); box-shadow: 0 0 0 3px rgba(255, 220, 100, 0.15); }
  100% { background: transparent; box-shadow: 0 0 0 3px transparent; }
}
.cmdk-flash {
  animation: cmdk-flash 1.5s ease-out;
  border-radius: 6px;
}

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column-reverse; gap: 8px; }
.toast {
  padding: 10px 16px; border-radius: var(--radius); background: var(--bg-elevated);
  border: 1px solid var(--border-default); color: var(--text-primary); font-size: .82rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: toastIn var(--fast) var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Drag & drop ===== */
.sortable-ghost { opacity: .3; background: var(--bg-active) !important; border: 2px dashed var(--border-focus) !important; }
.sortable-chosen { cursor: grabbing; }
/* 板块整体拖拽时的占位态: 用**完整 border 简写**盖掉上面那条通用规则。
   通用规则是 2px 虚线, 套在列上会让 grid 行高跳一下 (卡片无所谓, 整列很显眼);
   这里保持 1px 实线, 虚线描边改用 outline —— outline 不参与布局, 不产生抖动。 */
.board .column.sortable-ghost {
  opacity: .4;
  border: 1px solid var(--border-focus) !important;
  background: var(--bg-active) !important;
  outline: 2px dashed var(--border-focus);
  outline-offset: -2px;
}
/* 列的 cursor 写在 .column-header 上, 通用 .sortable-chosen 盖不住它, 单独补 */
.board .column.sortable-chosen .column-header { cursor: grabbing; }

/* ===== Empty state ===== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; color: var(--text-tertiary);
}
.empty-state svg { opacity: .3; margin-bottom: 16px; }
.empty-state h3 { font-size: 1rem; color: var(--text-primary); margin-bottom: 4px; }
.empty-state p { font-size: .82rem; margin-bottom: 16px; }
.empty-state kbd {
  padding: 1px 6px; border-radius: 4px; background: var(--bg-active);
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-secondary);
}

/* ===== 书签面板 ===== */
/* ===== 书签栏 (顶部, 横排 chip) ===== */
.bookmarks-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
}
.bookmarks-bar-chips {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}
.bookmarks-bar-manage {
  font-size: .72rem;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.bookmarks-bar-manage:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}
.bookmark-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.bookmark-chip {
  display: flex;
  align-items: stretch;
  padding: 0;
  font-size: .78rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--fast);
  overflow: hidden;
  max-width: 280px;
  height: 40px;
  flex-shrink: 0;
}
.bookmark-chip:hover {
  border-color: var(--border-focus);
  background: var(--bg-hover);
  text-decoration: none;
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.bookmark-chip-bar {
  width: 4px;
  flex-shrink: 0;
}
.bookmark-chip-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 10px;
  gap: 0;
  overflow: hidden;
}
.bookmark-chip-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bookmark-chip-host {
  font-size: .68rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bookmark-chip-desc {
  flex-shrink: 0;
  font-size: .68rem;
  color: var(--text-tertiary);
  padding: 4px 10px;
  border-left: 1px solid var(--border-default);
  background: var(--bg-surface);
  align-self: stretch;
  display: flex;
  align-items: center;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ===== 书签管理抽屉 (用 task-drawer 复用) ===== */
.bookmark-manager-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-default);
}
.bookmark-manager-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
}
.bookmark-manager-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 12px;
  font-size: .78rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--fast);
}
.bookmark-manager-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.bookmark-manager-tab.is-active {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
  font-weight: 500;
}
.bookmark-tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  background: var(--bg-surface);
  border-radius: 10px;
  font-size: .68rem;
  color: var(--text-tertiary);
  font-weight: 400;
}
.bookmark-manager-tab.is-active .bookmark-tab-count {
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.bookmark-empty-trash {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-default);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.bookmark-empty-trash:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.bookmark-manager-sort {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.bookmark-manager-sort-label {
  font-size: .72rem;
  color: var(--text-tertiary);
  margin-right: 2px;
}
.bookmark-sort-btn {
  font-size: .72rem;
  padding: 3px 10px;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.bookmark-sort-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}
.bookmark-sort-btn.is-active {
  color: var(--text-primary);
  border-color: var(--accent, var(--border-focus));
  background: var(--bg-elevated);
}
.bookmark-manager-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bookmark-manager-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.bookmark-manager-item.is-trash { opacity: .6; }
/* --- v=313 书签拖动排序 --- */
.bm-drag-handle {
  flex: none;
  align-self: center;
  width: 22px;
  min-height: 32px;              /* 触控目标别太小 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted-label, var(--text-secondary));
  font-size: .95rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;            /* 手柄上按住即拖, 不让页面滚动抢走手势 */
  border-radius: var(--radius-sm);
}
.bm-drag-handle:hover { background: var(--bg-hover, rgba(127,127,127,.12)); color: var(--text-primary); }
.bm-drag-handle:active { cursor: grabbing; }
/* Sortable 落点占位 (书签栏 chip 与管理列表共用) */
.bookmark-chip.sortable-ghost,
.bookmark-manager-item.sortable-ghost { opacity: .35; }
.bookmark-chip { cursor: pointer; }
/* 新增书签: 自动取名的状态提示 */
.bm-title-hint { font-size: .68rem; color: var(--text-muted-label, var(--text-secondary)); min-height: 14px; margin-top: 3px; }
.bm-title-hint.is-ok { color: var(--c-success-text, #2f9e44); }
.bm-title-hint.is-fix { color: var(--c-warn-text, #d97706); }
.bookmark-manager-link {
  flex: 1;
  display: block;
  color: var(--text-primary);
  text-decoration: none;
  min-width: 0;
}
.bookmark-manager-link:hover { text-decoration: none; }
.bookmark-manager-name {
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bookmark-manager-url {
  font-size: .68rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bookmark-expires {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  font-size: .68rem;
  color: #d97706;
  background: rgba(217, 119, 6, 0.1);
  border-radius: 3px;
}
.bookmark-manager-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.icon-btn-danger:hover {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

/* ===== 设置抽屉 ===== */
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* v=285: 同一份 HTML 切两个视图, 靠 data-view 决定显示哪几节 ——
   profile = 账号 + 安全 + 数据 (我是谁 / 我在哪登着 / 我的东西怎么带走),
   settings = 其余 (应用怎么跑)。
   用 <div data-sec> 加显示名单, 而不是写两坨结构: 以后加一个开关只要改一处。
   ⚠️ 隐藏用 display:none 而不是 visibility/height —— 后者仍占 flex gap, 会留一条空缝。 */
.settings-panel[data-view="profile"] .settings-section:not([data-sec="account"]):not([data-sec="security"]):not([data-sec="data"]),
.settings-panel[data-view="settings"] .settings-section[data-sec="account"],
.settings-panel[data-view="settings"] .settings-section[data-sec="security"],
.settings-panel[data-view="settings"] .settings-section[data-sec="data"] {
  display: none;
}
/* 个人资料页没有"可保存的偏好"(账号改完在弹窗里自己存, 导入导出点了就执行),
   底部「恢复默认/保存设置」跟着藏。
   ~ 是同级选择器: footer 与 panel 都是 drawer-body 的直接子节点。 */
.settings-panel[data-view="profile"] ~ .settings-footer { display: none; }

/* --- 账号: 昵称 + 头像 --- */
.account-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
}
/* .muted 全局带 padding:20px + text-align:center (给空态用的),
   账号块里的小字会被顶得乱飘, 这里压回正常小字排版 */
.account-row .settings-days-hint {
  padding: 0;
  text-align: left;
  margin-top: 0;
}
.account-avatar-preview {
  position: relative;
  width: 56px; height: 56px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 1.2rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease);
}
.account-avatar-preview:hover { border-color: var(--border-focus); }
.account-avatar-preview img {
  width: 100%; height: 100%;
  object-fit: cover; display: block; border-radius: 50%;
}
.account-avatar-edit-hint {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: .6rem; line-height: 1.5;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
  pointer-events: none;
}
.account-avatar-preview:hover .account-avatar-edit-hint { opacity: 1; }
.account-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.account-field-label {
  font-size: .78rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.account-fields input[type="text"] {
  padding: 8px 10px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: .85rem;
  transition: all var(--fast);
}
.account-fields input[type="text"]:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--accent-subtle);
}
.account-actions { margin-top: 4px; flex-wrap: wrap; }
/* 抽屉里的昵称展示 (只读, 大一号) */
.account-display-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- 「编辑资料」弹窗 --- */
.account-edit-modal { max-width: 380px; }
/* 信息性提示默认灰色, 只有校验错误才红 (modal-prompt-hint 默认是 --danger) */
.modal-prompt-hint.modal-hint-info { color: var(--text-tertiary); }
.account-edit-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.account-edit-avatar-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* 弹窗里的大号头像预览 (复用抽屉预览样式, 只放大) */
.account-avatar-preview-lg {
  width: 72px; height: 72px;
  font-size: 1.5rem;
}

/* --- v=312 修改邮箱弹窗: 验证码输入 + 发送按钮并排 ---
   ⚠️ 定位放容器 (flex + gap), 不给两个控件各写 right ——
   按钮文案在「发送验证码 / 60s 后重发 / 发送中…」之间切换, 宽度会变,
   各写定位的话输入框右边缘会跟着按钮宽度漂。 */
.cred-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cred-code-row .modal-prompt-input { flex: 1; min-width: 0; }
.cred-code-row .btn-ghost-sm {
  flex: none;
  min-height: 38px;          /* 与输入框等高, 别一高一矮 */
  white-space: nowrap;       /* 倒计时文案不换行 */
}
.cred-code-row .btn-ghost-sm:disabled { opacity: .6; cursor: not-allowed; }

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-section-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.settings-section-desc {
  font-size: .78rem;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.5;
}
.settings-days-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
  transition: all var(--fast);
}
.settings-days-row:focus-within {
  border-color: var(--border-focus);
  background: var(--accent-subtle);
}
.settings-days-prefix,
.settings-days-suffix {
  font-size: .85rem;
  color: var(--text-secondary);
}
.settings-days-hint {
  margin-top: 8px;
  /* ⚠️ 这个类常常写成 `class="settings-days-hint muted"`, 而 `.muted` 是
     **空态样式**(padding:20px + text-align:center + --text-tertiary), 不是
     "通用弱化色" —— 不覆盖的话提示会跑到中间、离控件 28px 远, 颜色也只有
     ~3.1 对比度。这里显式归零并改用可读性达标的 muted-label (4.8/8.8)。 */
  padding: 0;
  text-align: left;
  color: var(--text-muted-label);
  font-size: .72rem;
  line-height: 1.45;
}
/* v=243: 「换日」说明与上一行同属一条提示, 只换行不留空 */
.settings-days-hint .settings-day-cut { display: block; margin-top: 2px; }
#setting-archive-days {
  width: 90px;
  padding: 6px 12px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
  font-family: var(--font-mono);
  line-height: 1.4;
  -moz-appearance: textfield;
}
#setting-archive-days::-webkit-outer-spin-button,
#setting-archive-days::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#setting-archive-days:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
/* 小记模板面板 (工具栏「模板」按钮) */
.ntpl { display: grid; grid-template-columns: 150px 1fr; gap: 14px; }
.ntpl-side { display: flex; flex-direction: column; gap: 8px; }
.ntpl-list { display: flex; flex-direction: column; gap: 4px; }
.ntpl-item {
  padding: 7px 10px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: .8rem;
  text-align: left;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ntpl-item:hover { border-color: var(--accent); color: var(--text-primary); }
.ntpl-item.is-on { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.ntpl-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ntpl-field { display: flex; align-items: center; gap: 8px; }
.ntpl-field > span { flex: none; width: 30px; font-size: .78rem; color: var(--text-tertiary); }
.ntpl-field input {
  flex: 1; min-width: 0;
  padding: 7px 10px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .82rem;
}
.ntpl-field input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
/* v=268: 模板标签改成点选 chip，标签行需要纵向排（标签在上、新建框在下） */
.ntpl-field-stack { align-items: flex-start; }
.ntpl-field-stack > span { padding-top: 7px; }
.ntpl-tag-area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.ntpl-tag-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 26px; }
/* v=275: .ntpl-tag-new（模板面板里的「新建标签」输入框）已随功能一起删除，
   样式不留在文件里 —— 留着下次有人照着它把入口加回来。 */
.ntpl-tag-empty { font-size: .72rem; color: var(--text-muted-label); }
/* 标签池里已经不存在的名字：虚线边，点一下移除 */
.note-tag-chip.is-ghost { border-style: dashed; opacity: .7; }
.ntpl-ph-box { padding: 8px 10px; border: 1px dashed var(--border-default); border-radius: 8px; }
.ntpl-ph-title { display: block; margin-bottom: 6px; font-size: .72rem; color: var(--text-tertiary); }
.ntpl-ph-group { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.ntpl-ph-group:last-child { margin-bottom: 0; }
.ntpl-ph-label { flex: none; width: 26px; font-size: .7rem; color: var(--text-tertiary); }
.ntpl-ph {
  padding: 3px 7px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: .7rem;
  cursor: pointer;
}
.ntpl-ph:hover { color: var(--accent); border-color: var(--accent); }
.ntpl-content {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 180px;
}
.ntpl-content:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
.ntpl-preview-wrap { display: flex; flex-direction: column; gap: 4px; }
.ntpl-preview-label { font-size: .72rem; color: var(--text-tertiary); }
.ntpl-preview {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-secondary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: .76rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
.ntpl-footer { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ntpl-spacer { flex: 1; }
@media (max-width: 640px) {
  .ntpl { grid-template-columns: 1fr; }
  .ntpl-side { flex-direction: row; align-items: center; gap: 8px; }
  .ntpl-list { flex: 1; flex-direction: row; overflow-x: auto; }
  .ntpl-item { white-space: nowrap; }
}
/* 设置面板里的开关 (目前用于「显示书签栏」) */
.settings-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--fast) var(--ease);
}
.settings-switch:hover { border-color: var(--border-hover); }
/* 原生 checkbox 隐藏但保留可聚焦/可访问 */
.settings-switch input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.settings-switch-track {
  position: relative;
  flex: none;
  width: 34px; height: 20px;
  border-radius: 100px;
  background: var(--bg-active);
  border: 1px solid var(--border-default);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.settings-switch-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.settings-switch input:checked + .settings-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}
.settings-switch input:checked + .settings-switch-track .settings-switch-thumb {
  transform: translateX(14px);
  background: #fff;
}
.settings-switch input:focus-visible + .settings-switch-track {
  box-shadow: var(--ring);
}
.settings-switch-text { font-size: .85rem; color: var(--text-secondary); }

.settings-footer {
  display: flex;
  gap: 8px;
  margin: 24px -20px -20px;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface);
}

/* ===== v=289: 设置页的「恢复默认 / 保存设置」固定在抽屉最下面 =====
   以前 footer 只是 body 里的普通块级元素：桌面端内容不够长时它停在半空，
   下面空一大截（实测底部空 64px），看着像没做完；手机上又要滚到底才看得见。

   改成 flex 列：**body 不再滚动，滚动交给 .settings-panel，footer 天然沉底** ——
   内容多长都不影响它待在最下面。

   ⚠️ 为什么不用 position:absolute/sticky：
      · absolute —— `#drawer-body` 自己就是滚动容器，absolute 相对它定位后
        会**跟着内容一起滚**，根本不是"固定"；
      · sticky —— 内容不足一屏时它不会往下走，桌面端那个"停在半空"的毛病还在。
   :has() 在本项目已有先例（见 `.drawer-body:has(.note-editor-body)`）。 */
.drawer-body:has(> .settings-panel) {
  display: flex;
  flex-direction: column;
  overflow: hidden;      /* 滚动权交给下面的 panel，否则会出现两条滚动条 */
  padding: 0;            /* 内边距下放到 panel，footer 才能贴满整宽 */
}
.drawer-body:has(> .settings-panel) > .settings-panel {
  flex: 1 1 auto;
  min-height: 0;         /* 缺这行 flex 子项不肯收缩，溢出就变成裁剪而不是滚动 */
  overflow-y: auto;
  padding: 16px;
}
.drawer-body:has(> .settings-panel) > .settings-footer {
  flex: none;
  margin: 0;             /* 不再靠负 margin 撑满宽，现在由 flex 布局给它整行 */
}

/* ===== 主操作按钮 (恢复: 删报表模块时被误删, 导致日历/设置/AI 的按钮变裸) ===== */
.btn-generate-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
}
.btn-generate-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(91,108,240,.28);
}
.btn-generate-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-generate-primary .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.settings-footer .btn-generate-primary {
  flex: 1;
}

/* ================================================================
   Login page（2026-09-22 重做）
   改了三件事，都是为了"和主应用是同一个产品"：
   ① 补主题预设（见 login.html 的内联脚本）。此前登录页没有 data-theme，
      CSS 回落到默认暗色 → 浅色用户一进来是一片黑，和主应用直接断层。
   ② 从「裸表单浮在纯色背景上」改成一张有层次的卡片：
      三层表面 + 发丝描边 + 大留白 + 品牌标记（与 favicon/首屏加载页同形）。
   ③ 中文标签去掉 uppercase + letter-spacing —— 对中文完全无效，
      只会把「用户名」三个字撑得松松垮垮。
   ⚠️ 本块的移动端覆盖写在**块内**（不是文件中部那个小屏块）：
      媒体查询不增加权重，同权重下后写的赢，写早了会被后面的规则整条盖掉。
      同理，原先散在小屏块里的 `.login-form input{min-height:42px}` 已删除。
   ================================================================ */
.login-body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;          /* 移动端地址栏收放时 100vh 不跟着变，会切掉底部 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px calc(40px + env(safe-area-inset-bottom));
  overflow: hidden;            /* 光晕超出视口不要带出滚动条 */
  background: var(--bg-root);
  color: var(--text-primary);

  /* 登录页专用令牌：只在本页生效，不外溢到应用其他部分。
     深色下靠"提亮"给出纵深，浅色下靠"加一点色相"，两者都很淡 —— 
     它只负责让画面不是一块死板的纯色，不该被看见。 */
  --login-glow-a:      rgba(124, 134, 245, .16);
  --login-glow-b:      rgba(45, 212, 191, .10);
  --login-brand-glow:  rgba(124, 134, 245, .45);
}
html[data-theme="light"] .login-body {
  --login-glow-a:      rgba(91, 108, 240, .13);
  --login-glow-b:      rgba(13, 148, 136, .10);
  --login-brand-glow:  rgba(91, 108, 240, .34);
}

/* 两团径向光晕。fixed 而不是 absolute —— 卡片比视口高时（小屏横屏）
   光晕不会跟着内容漂走。纯装饰，所以 pointer-events:none。 */
.login-aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.login-aurora-a,
.login-aurora-b { position: absolute; border-radius: 50%; }
.login-aurora-a {
  width: 620px; height: 620px; top: -230px; left: calc(50% - 310px);
  background: radial-gradient(circle, var(--login-glow-a) 0%, transparent 68%);
}
.login-aurora-b {
  width: 520px; height: 520px; bottom: -240px; right: -90px;
  background: radial-gradient(circle, var(--login-glow-b) 0%, transparent 70%);
}

/* 右上角工具条 (v=307)：回首页 + 主题开关。
   ⚠️ 定位放在**容器**上，两个控件自己不再 fixed —— 各写一个 right 偏移的话，
      任一控件改宽度另一个就错位，而且两者之间没有真正的 gap。
   ⚠️ 用 `.login-body .xxx`（两个类）而不是单类：.icon-btn / .theme-toggle 都是单类，
      同权重下谁后写谁赢 —— 靠"写在后面"太脆，以后有人往文件末尾追加规则就会翻车。 */
.login-body .login-topbar {
  position: fixed; top: 18px; right: 18px; z-index: 2;
  display: flex; align-items: center; gap: 10px;
}
.login-body .login-home-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  font-size: var(--fs-sm); color: var(--text-secondary);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: all var(--fast) var(--ease);
}
.login-body .login-home-link:hover {
  color: var(--text-primary); border-color: var(--border-hover);
}
.login-body .login-home-link svg { flex: none; }
.login-body .login-theme-toggle {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xs);
}
.login-body .login-theme-toggle:hover { border-color: var(--border-hover); }

.login-main {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 18px;
  animation: login-rise 520ms var(--ease) both;
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.login-card {
  padding: 34px 30px 30px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
}

/* ----- 品牌区 ----- */
.login-brand { margin-bottom: 26px; text-align: center; }
/* 标记与 favicon / .boot-logo 同形（圆角方块 + 白勾），圆角也同为 --radius-lg，
   这样"登录页 → 加载页 → 主界面"三屏是同一个标记，没有第三种画法。 */
.login-logo {
  width: 52px; height: 52px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: var(--on-accent);
  /* 外圈同色辉光让标记"浮"起来；内圈 1px 高光模拟顶光 */
  box-shadow: 0 10px 22px -10px var(--login-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.login-logo svg { width: 30px; height: 30px; }
.login-brand h1 {
  margin-bottom: 6px;
  font-size: var(--fs-2xl); font-weight: 600; line-height: var(--lh-tight);
  color: var(--text-primary);
}
/* ⚠️ 副标题用 --text-muted-label 而不是 --text-tertiary：
   实测 tertiary 对卡片底只有 3.09(浅)/3.54(深) —— 12.5px 的中文达不到 4.5:1。
   muted-label 是专门为"小字但仍要看得清"准备的一档（实测 4.81 / 8.86）。 */
.login-brand p { font-size: var(--fs-sm); color: var(--text-muted-label); }

/* ----- 表单 ----- */
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted-label);
}

.field-box { position: relative; display: flex; align-items: center; }
.field-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--text-tertiary);
  pointer-events: none;                    /* 别把点击从输入框上抢走 */
  transition: color var(--fast) var(--ease);
}
.field-box input {
  width: 100%; height: 44px;
  padding: 0 13px 0 38px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  /* 16px 不是排版选择：iOS 上输入框字号 <16px 会在聚焦时自动放大整页，
      放大后卡片会跑出屏幕。所以这里不能跟着 --fs-lg(15px) 走。 */
  font-size: 1rem;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
/* 密码框要给右侧眼睛按钮让位。
   ⚠️ 用类不写 input[type="password"]：点一下眼睛 type 就变 text 了，
      属性选择器会当场失效、文字被按钮压住。 */
.field-box.has-eye input { padding-right: 44px; }
/* 同上一处：tertiary 当占位符实测只有 2.78(浅)/3.23(深)，太淡了 */
.field-box input::placeholder { color: var(--text-secondary); }
.field-box input:hover { border-color: var(--border-control-hover); }
.field-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
/* 聚焦时图标跟着提亮一档，视线自然落到"正在填哪一格" */
.field-box:focus-within .field-icon { color: var(--text-secondary); }

/* 密码显隐。两个图标落在同一个 grid 格子里叠着 —— 用 grid 而不是 absolute，
   因为 absolute + translate(-50%,-50%) 会把 scale 变换一起卷进来，
   三层 transform 叠在一个属性里，以后改动画很容易写错。 */
.field-eye {
  position: absolute; right: 5px;
  /* ⚠️ 必须自己写 top/transform 居中：绝对定位元素已经脱流，
     虽然 Chromium 会把「绝对定位的 flex 子项」的静态位置按 align-items 摆好，
     但那是实现行为不是规范保证（Safari 上历来不稳）。
     显式写死，任何内核都不会跑偏。 */
  top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.field-eye:hover { color: var(--text-primary); background: var(--bg-hover); }
.field-eye:focus-visible { outline: none; box-shadow: var(--ring); }
.field-eye svg { grid-area: 1 / 1; transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease); }
.field-eye .eye-hide { opacity: 0; transform: scale(.7); }
.field-eye.is-shown .eye-show { opacity: 0; transform: scale(.7); }
.field-eye.is-shown .eye-hide { opacity: 1; transform: none; }

/* 错误提示做成一条告警条，而不是一行裸红字 —— 它是"有边界的一件事"。
   图标用 mask + currentColor 画：颜色永远跟文字一致，深浅主题都不用各写一遍。 */
.login-error {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  font-size: var(--fs-sm); line-height: var(--lh-tight);
  color: var(--c-danger-text);
  background: var(--c-danger-bg);
  border: 1px solid var(--c-danger-border);
  border-radius: var(--radius);
  animation: login-shake 320ms var(--ease);
}
.login-error::before {
  content: ''; flex: 0 0 auto;
  width: 15px; height: 15px; margin-top: 1px;
  background: currentColor;
  -webkit-mask: var(--login-alert) center / contain no-repeat;
  mask: var(--login-alert) center / contain no-repeat;
}
/* 左右各 3px 的轻推 —— 只表达"这次不对"，不演杂技 */
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

/* ----- 提交按钮 ----- */
#submit-btn {
  position: relative;
  height: 46px; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-family: inherit; font-size: var(--fs-lg); font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px var(--login-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--norm) var(--ease), opacity var(--fast) var(--ease);
}
#submit-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px var(--login-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .26);
}
#submit-btn:active { transform: translateY(0); box-shadow: 0 6px 14px -10px var(--login-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .2); }
#submit-btn:focus-visible { outline: none; box-shadow: var(--ring), 0 10px 22px -10px var(--login-brand-glow); }
#submit-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
#submit-btn .btn-label { transition: opacity var(--fast) var(--ease); }
/* ⚠️ busy 规则必须带 #login-form 抬权重：下面 #submit-btn .btn-spin 是**带 id 的**
   选择器 (1,1,0)，而 .login-form.is-busy .btn-spin 只有 (0,3,0) —— 权重更低，
   opacity 永远盖不上去。实测症状：动画确实在跑（animationName 取到了 login-spin），
   但透明度恒为 0，转圈**完全看不见**。 */
#login-form.is-busy .btn-label { opacity: 0; }
/* 转圈只在提交期间存在：动画写进 .is-busy 里，平时这个元素连动画都没有。
   白圈压在 accent 底上，深浅两套主题都成立，不必按主题换色。 */
#submit-btn .btn-spin {
  position: absolute;
  width: 17px; height: 17px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}
#login-form.is-busy .btn-spin { opacity: 1; animation: login-spin 700ms linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-foot { text-align: center; font-size: var(--fs-xs); color: var(--text-muted-label); }

/* ----- 人机验证弹窗 (2026-11-06：滑块从"常驻表单"收进弹窗) -----
   用户的原话是「点击获取验证码才会弹出人机验证弹窗」—— 顺序才是对的：
   先点按钮表明意图，再验人机。
   ⚠️ 没有复用 .generic-modal-overlay：那套是主应用抽屉的尺度（540px / 18px 内边距），
      放到 360px 的登录卡片语境里比例全错；而且登录页不加载 index.html 的任何 JS。
   ⚠️ 卡片宽度决定滑块画布宽度（JS 用 stage.clientWidth 换算拼图位置），
      360 - 20*2 = 320，正好等于 app/captcha.py 的原生 BG_W。改 padding 要同步想这件事。 */
.captcha-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(13, 17, 25, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: captcha-fade 160ms var(--ease);
}
.captcha-modal.hidden { display: none; }
.captcha-modal-card {
  width: 100%; max-width: 360px;
  padding: 20px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-cmdk);
  animation: captcha-pop 200ms var(--ease);
}
@keyframes captcha-fade { from { opacity: 0; } }
/* 只动 transform / opacity（GPU 合成），不碰 height —— 弹窗高度会随图片加载变 */
@keyframes captcha-pop { from { opacity: 0; transform: translateY(6px) scale(.97); } }

.captcha-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 4px;
}
.captcha-modal-title {
  margin: 0;
  font-size: var(--fs-lg); font-weight: 600; line-height: var(--lh-tight);
  color: var(--text-primary);
}
.captcha-modal-close {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  margin: -6px -6px -6px 0;      /* 视觉上贴角，热区仍是 32×32 */
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.captcha-modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.captcha-modal-close:focus-visible { outline: none; box-shadow: var(--ring); color: var(--text-primary); }
.captcha-modal-desc {
  margin: 0 0 14px;
  font-size: var(--fs-sm); line-height: var(--lh-tight);
  color: var(--text-muted-label);
}
/* 复用 .login-error 那组语义色，保证"错误"在整页只有一种红 */
.captcha-modal-msg {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: var(--fs-sm); line-height: var(--lh-tight);
  color: var(--c-danger-text);
  background: var(--c-danger-bg);
  border: 1px solid var(--c-danger-border);
  border-radius: var(--radius-sm);
}
.captcha-modal-msg.hidden { display: none; }
/* 弹窗开着时锁住背景滚动：窄屏登录页比视口高，不锁的话滑动遮罩层会被"透底" */
body.is-captcha-open { overflow: hidden; }

/* ----- 注册表单 (与登录共用一套 field 视觉, 只补差异) ----- */
/* 人机验证 · 滑块拼图 (2026-10-21 替换掉 4 位字符图)
   结构: .sc-stage 放背景+拼图块+换一张按钮, .sc-track 是滑轨。
   ⚠️ 拼图块的 left / width 由 JS 按"背景画布比例"算, 这里只给定位与过渡;
      不要给 .sc-piece 写死宽高 —— 它会随卡片宽度缩放。 */
.slider-captcha { display: flex; flex-direction: column; gap: 8px; }
.slider-captcha.is-loading { opacity: .55; pointer-events: none; }
.slider-captcha.is-error .sc-stage { border-style: dashed; }

.sc-stage {
  position: relative; overflow: hidden;
  border: 1px solid var(--border-control); border-radius: var(--radius);
  background: var(--bg-elevated);
  aspect-ratio: 320 / 170;          /* 与 app/captcha.py 的 BG_W:BG_H 同比例 */
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.sc-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; object-fit: cover;
}
.sc-bg:not([src]), .sc-bg[src=""] { visibility: hidden; }
.sc-piece {
  position: absolute; left: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .45));
  pointer-events: none;
  will-change: left;
}
.sc-piece:not([src]), .sc-piece[src=""] { visibility: hidden; }

.sc-refresh {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(10, 13, 19, .5); color: #fff;
  backdrop-filter: blur(4px);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.sc-refresh:hover { background: rgba(10, 13, 19, .72); }
.sc-refresh:active { transform: scale(.92); }
.sc-refresh:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* 图上不再常驻提示 (滑轨那句已经说清楚了, 压在图底部会挡住缺口区),
   只在加载中 / 加载失败时出现 */
.sc-hint {
  display: none;
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 8px 8px; text-align: center;
  font-size: var(--fs-2xs); color: rgba(255, 255, 255, .92);
  background: linear-gradient(to top, rgba(6, 8, 12, .6), transparent);
  pointer-events: none;
}
.is-loading .sc-hint { display: block; }
.is-error .sc-hint { display: block; color: #ffd9d4; }

/* 滑轨: 高度 40, 手柄 40×40 —— 触屏也够按 (窄屏提到 44) */
.sc-track {
  position: relative; height: 40px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border-control);
  overflow: hidden; cursor: pointer;
  touch-action: none;                /* 关键: 否则手机上拖动会变成滚页面 */
}
.sc-track:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
.sc-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  transition: width 60ms linear;
}
.sc-handle {
  position: absolute; top: 0; left: 0; width: 40px; height: 100%;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--accent); color: #fff;
  cursor: grab; will-change: transform;
}
.sc-handle:active { cursor: grabbing; }
.sc-arrow { display: grid; place-items: center; }
.sc-check { display: none; place-items: center; }
.is-solved .sc-arrow { display: none; }
.is-solved .sc-check { display: grid; }
.is-solved .sc-handle { background: #0f7a44; }   /* 白勾对 #0f7a44 ≈ 5.1:1 */
.is-solved .sc-fill { background: color-mix(in srgb, #0f7a44 24%, transparent); }
.is-solved .sc-track { border-color: #0f7a44; cursor: default; }

.sc-tip {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: var(--fs-xs); color: var(--text-muted-label);
  pointer-events: none;              /* 点击穿透到 track, 否则移动端第一下点不中 */
}
/* 已通过: 提示文字换成绿色「验证通过」, 不要直接隐掉 —— 空着一条轨道
   会让人怀疑"是不是没成功" */
.is-solved .sc-tip { color: #0f7a44; font-weight: 600; }
.is-error .sc-tip { opacity: 0; }
/* 验证码行: 输入框右侧并排一颗"获取验证码"文字按钮。
   ⚠️ 必须有 gap：两者都是带描边的控件，一旦贴在一起（gap:0）就会看成
   "一个框里塞了颗按钮"，输入框右边界和按钮左边界还会叠成一条 2px 的粗线。
   10px 是能明确读出"这是两个独立控件"的最小值，同时按钮右边缘与输入框
   右边缘对齐（所以这里不能再加 padding-right，否则按钮会内缩 4px）。 */
.field-box.has-send-code { gap: 10px; }
#reg-code, #fg-code { flex: 1 1 auto; min-width: 0; }
.send-code-btn {
  flex: 0 0 auto;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--accent); border-radius: calc(var(--radius) - 4px);
  background: transparent; color: var(--accent);
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              opacity var(--fast) var(--ease);
}
.send-code-btn:hover { background: var(--accent-subtle); }
.send-code-btn:disabled { opacity: .55; cursor: not-allowed; }
/* 成功提示: 借 login-error 的布局, 只换配色 (绿) */
.login-ok {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  font-size: var(--fs-sm); line-height: var(--lh-tight);
  color: var(--c-success-text, #22a06b);
  background: var(--c-success-bg, rgba(34, 160, 107, .1));
  border: 1px solid var(--c-success-border, rgba(34, 160, 107, .35));
  border-radius: var(--radius);
}
/* 注册/登录 切换行 */
/* 切模式那一行：加一条发丝分隔线，把"表单"和"换一种方式"分成两块。
   三形态共用一个卡片时，否则"注册账号"那行会像是表单的最后一个字段。 */
.login-mode-switch {
  margin: 12px 0 0; padding-top: 14px; text-align: center;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-sm); color: var(--text-muted-label);
}
.login-mode-switch .link-btn { color: var(--accent); font-size: var(--fs-sm); }
.login-mode-switch .link-btn:hover { color: var(--accent-hover); }
/* 注册按钮与提交态: 完全复刻 #submit-btn 的视觉, 权重规则同理带 id */
#register-btn {
  position: relative;
  height: 46px; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-family: inherit; font-size: var(--fs-lg); font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px var(--login-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--norm) var(--ease), opacity var(--fast) var(--ease);
}
#register-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
#register-btn:active { transform: translateY(0); }
#register-btn:focus-visible { outline: none; box-shadow: var(--ring), 0 10px 22px -10px var(--login-brand-glow); }
#register-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
#register-btn .btn-label { transition: opacity var(--fast) var(--ease); }
#register-btn .btn-spin {
  position: absolute;
  width: 17px; height: 17px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}
#register-form.is-busy .btn-label { opacity: 0; }
#register-form.is-busy .btn-spin { opacity: 1; animation: login-spin 700ms linear infinite; }
/* 找回密码: 表单/按钮完全同构, 选择器并列 */
#forgot-btn {
  position: relative;
  height: 46px; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-family: inherit; font-size: var(--fs-lg); font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px var(--login-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--norm) var(--ease), opacity var(--fast) var(--ease);
}
#forgot-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
#forgot-btn:active { transform: translateY(0); }
#forgot-btn:focus-visible { outline: none; box-shadow: var(--ring), 0 10px 22px -10px var(--login-brand-glow); }
#forgot-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
#forgot-btn .btn-label { transition: opacity var(--fast) var(--ease); }
#forgot-btn .btn-spin {
  position: absolute;
  width: 17px; height: 17px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}
#forgot-form.is-busy .btn-label { opacity: 0; }
#forgot-form.is-busy .btn-spin { opacity: 1; animation: login-spin 700ms linear infinite; }
/* 登录按钮下方的"忘记密码？"小链接 */
.login-forgot-link { margin: -6px 0 0; text-align: right; }
.login-forgot-link .link-btn { color: var(--text-muted-label); font-size: var(--fs-sm); }
.login-forgot-link .link-btn:hover { color: var(--accent); }

/* 动效降级：入场上浮和错误轻推都属装饰，关掉。
   ⚠️ 加载转圈**不关** —— 它是"正在提交"的唯一视觉反馈，关掉用户会以为按钮坏了。 */
@media (prefers-reduced-motion: reduce) {
  .login-main { animation: none; }
  .login-error { animation: none; }
  #submit-btn:hover, #submit-btn:active,
  #register-btn:hover, #register-btn:active,
  #forgot-btn:hover, #forgot-btn:active,
  .sc-refresh:active { transform: none; }
}

/* ----- 登录页 · 窄屏 -----
   卡片铺满可用宽度（380px 上限在 390px 屏上会左右各剩 5px，等于贴边），
   触控目标再放大一档。 */
@media (max-width: 480px) {
  /* v=307: 顶部 64 → 76px。工具条挪进 topbar 后控件升到 44px 触控下限,
     14(top) + 44 = 58, 原来的 64 只剩 6px 缝隙, 看着像贴住卡片。 */
  .login-body { align-items: flex-start; padding: 76px 16px calc(28px + env(safe-area-inset-bottom)); }
  /* ⚠️ 窄屏必须把右上角工具条从 fixed 改成 absolute：
     卡片比视口高时（320×568 上注册表单高出 205px）页面会滚，
     而 fixed 会一直浮在内容上面 —— 滑到中间正好压在输入框的右边框上（实测截图可见）。
     改成 absolute 就跟着页面滚走，小屏上少一个干扰物。
     v=307: 定位已上移到 .login-topbar, 这里改容器而不是改按钮。 */
  .login-body .login-topbar { position: absolute; top: 14px; right: 14px; }
  /* 窄屏触控下限 44px（与本页其他行内控件一致） */
  .login-body .login-home-link { height: 44px; padding: 0 14px; }
  .login-body .login-theme-toggle { width: 44px; height: 44px; }
  .login-card { padding: 28px 22px 24px; }
  /* 窄屏统一 44px 触控下限：输入框与主按钮 48，行内小控件 44。
     44 放在 48 的行里 = 上下各留 2px，既不顶格、也不显小。
     原来偏小的四个：「获取验证码」32、图形码 34、密码小眼睛 34、
     模式切换链接 24（它还是**进注册页的唯一入口**）。 */
  .field-box input { height: 48px; }
  #submit-btn, #register-btn, #forgot-btn { height: 48px; }
  .send-code-btn { height: 44px; padding: 0 14px; }
  /* 滑块触控下限: 轨道 44, 手柄 44 —— 与其它行内控件齐平 */
  .sc-track { height: 44px; }
  .sc-handle { width: 44px; }
  .field-box.has-eye input { padding-right: 52px; }
  .field-eye { right: 2px; width: 44px; height: 44px; }
  .link-btn { min-height: 44px; padding: 0 6px; }
  /* 人机验证弹窗：窄屏留 16px 边、关闭键拉到 44 触控下限 */
  .captcha-modal { padding: 16px; }
  .captcha-modal-card { padding: 18px; }
  .captcha-modal-close { width: 44px; height: 44px; margin: -10px -10px -10px 0; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== 重复 chip ===== */
.recurring-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.recurring-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.recurring-chip input { display: none; }
.recurring-chip span {
  padding: 4px 10px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  font-size: .78rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  transition: all .12s;
}
/* ⚠️ 这两条原来引的是 --accent-primary / --accent-primary-soft ——
   两个 token 在 :root 与浅色块里都不存在，于是回落到写死的 #4a9eff
   （旧调色板的蓝，不是现在的靛蓝）；而 :hover 那条没有回落值，
   整条声明直接失效 —— 表现为鼠标移上去没有任何反应。 */
.recurring-chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}
.recurring-chip:hover span { border-color: var(--accent); }

/* ===== 归档视图 ===== */
.archive-view, .trash-view {
  max-width: 900px;
  margin: 0 auto;
}
.archive-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-default);
}
.archive-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.archive-meta {
  font-size: .78rem;
  color: var(--text-tertiary);
}
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.archive-day {
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  overflow: hidden;
}
.archive-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}
.archive-day-header h3 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.archive-weekday {
  font-size: .72rem;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 6px;
}
.archive-day-count {
  font-size: .72rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 100px;
}
.archive-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
  transition: background var(--fast);
  cursor: default;
}
.archive-item:last-child { border-bottom: none; }
.archive-item:hover { background: var(--bg-hover); }
.archive-item .archive-priority {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--pri-bar, var(--border-default));
}
.archive-item .archive-title {
  flex: 1;
  font-size: .85rem;
  color: var(--text-primary);
  text-decoration: line-through;
  text-decoration-color: var(--text-tertiary);
  text-decoration-thickness: 1px;
}
.archive-item .archive-time {
  font-size: .68rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  /* 时间串（"删除于 … · 29 天后自动清除"）不许折行 —— 折了既难读，
     还会把标题那侧挤窄 */
  white-space: nowrap;
}
.archive-item .archive-restore {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: .72rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--fast);
  white-space: nowrap;   /* 「↩ 恢复」不许折成两行 */
}
.archive-item .archive-restore:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.archive-item .archive-delete {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: .85rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--fast);
}
.archive-item .archive-delete:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}
.archive-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: .85rem;
}

/* 回收站分段（任务 / 小记）
   两类数据共用这一个视图，但用分段切换、不混排成一张列表 ——
   混排的话每行都得挂个"这是任务还是小记"的标记，恢复按钮还要现判类型
   该调哪个接口；分开列，每一边的语义都干净。
   样式沿用 .mobile-status-tab 那一套（选中态 = 主色实底），
   保证全站"分段控件"长一个样。 */
.trash-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.trash-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--fast);
  white-space: nowrap;   /* 「任务 12」不许断成两行 */
}
.trash-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.trash-tab.is-active { background: var(--accent); color: var(--on-accent); }
.trash-tab-count {
  font-size: var(--fs-2xs);
  font-family: var(--font-mono);
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}
.trash-tab.is-active .trash-tab-count {
  background: rgba(255, 255, 255, .22);
  color: var(--on-accent);
}
/* 小记在回收站里的行首标记。
   任务那边是 6px 分类圆点，小记没有分类 —— 用一个同宽度的图标占位，
   两边的标题、时间、按钮才能对齐到同一列 */
.archive-item .archive-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

/* ===== Mobile ===== */
/* 移动端状态 tab 栏：桌面端隐藏，移动端在断点内显示 */
.mobile-status-tabs { display: none; }
/* 状态 Tab 是「看板」专用: 列表/日历/小记/归档/回收站视图下不显示
   (否则小记页顶部会莫名挂着待办/进行中/已完成) */
.main:has(#list-view:not(.hidden)) .mobile-status-tabs,
.main:has(#calendar-view:not(.hidden)) .mobile-status-tabs,
.main:has(#notes-view:not(.hidden)) .mobile-status-tabs,
.main:has(#archive-view:not(.hidden)) .mobile-status-tabs,
.main:has(#trash-view:not(.hidden)) .mobile-status-tabs { display: none; }

@media (max-width: 768px) {
  /* ===== 移动端底部导航栏 =====
     把视图切换组从顶栏挪到屏幕底部。原因是顶栏物理上就装不下：
     320px 下 6 个视图图标 + 搜索框 + 新建/主题/头像，实测搜索框只剩 64×19px、
     图标只剩 24×24px（点不准，而且没有余量放大）。挪到屏幕底部之后，
     每个视图 tab 44px 高、顶栏三个按钮 40×40，两边都够大。
     ⚠️ 两个必须配套的改动，少一个都会坏：
       1) .topbar 在这个断点里**必须去掉 backdrop-filter** —— 带 backdrop-filter 的元素
          会成为 position:fixed 后代的包含块，导航条会被钉死在顶栏内部（48px 高），
          而不是屏幕底部。去掉它顺手也省了手机滚动的合成开销。
       2) .main 要留出等于导航条高度的下内边距，否则页面最后一行被压在导航条下面。 */
  html { --mobile-nav-h: 58px; }
  .topbar {
    padding: 0 8px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-root);
  }
  .topbar-right { gap: 6px; }
  .search-text, .search-trigger .kbd { display: none; }
  .search-trigger { padding: 0 10px; min-height: 40px; }
  /* 顶栏只剩「搜索 + 新建板块 + 主题 + 头像」四个，全部放到 40×40 */
  .topbar-right .icon-btn { width: 40px; height: 40px; }
  .avatar { width: 40px; height: 40px; font-size: .86rem; }
  /* (.main 的下内边距写在下面 —— 必须排在它自己的 padding 简写之后，见那里的注释) */
  /* 浮在底部的东西都要抬到导航条之上，否则被压住点不到。
     .select-bar 的基础定义在本文件更靠后 → 它那条挪到文末「移动端 · 后置覆盖」。 */
  .toast-container { bottom: calc(var(--mobile-nav-h) + 14px + env(safe-area-inset-bottom)); right: 12px; }
  /* 小记工具栏: 附件 / 导入任务收起文字只留图标, 避免窄屏换行 */
  .notes-btn-text { display: none; }
  .notes-attach-btn { padding: 0 8px; }
  /* 书写框底部: 保存按钮保持一行, 别被左侧长提示语挤成竖排 */
  .notes-composer-foot { gap: 8px; }
  .notes-composer-foot .btn-primary { flex: none; white-space: nowrap; }
  /* 视图切换组 = 屏幕底部导航条。
     z-index 40 是刻意排的：在页面内容之上，但在抽屉(70) / 底部多选条(80) / 弹层之下，
     所以打开抽屉时导航条会被盖住，多选时多选条浮在导航条上方。
     active 态不用额外处理：switchView() 本来就在「所有 .view-tab」上同步。 */
  .view-switcher {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: flex; gap: 2px;
    height: var(--mobile-nav-h);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-root) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-default);
  }
  /* 图标在上、文字在下：底部导航的通行做法，也省横向空间 */
  .view-tab {
    flex: 1 1 0; min-width: 0;
    height: 44px; padding: 0; gap: 0;
    flex-direction: column;
    border-radius: var(--radius);
  }
  .view-tab-text { display: block; font-size: var(--fs-2xs); line-height: 1; margin-top: 3px; }
  .view-tab svg { width: 17px; height: 17px; }
  /* 筛选行的「书签 / 管理」按钮已整块移除 (2026-09-14), 这里不再需要收起文字 */

  /* 移动端看板：状态 Tab 切换（一次只看一列，手势不冲突）*/
  .board { display: block; }
  .main { padding: 8px; }
  /* 日历：窄屏收掉网格外圆角；间隙保持 1px（网格线就是间隙，不能放大） */
  .month-grid { border-radius: var(--radius); }
  /* 工具条：窄屏把标题最小宽度与字号都收一档，
     否则 320px 下居中的「‹ 月份 ›」会和右侧绝对定位的「今天」压在一起 */
  .calendar-toolbar h2 { min-width: 118px; font-size: var(--fs-md); }
  .day-cell { padding: 3px; aspect-ratio: 1 / 1.15; }
  .day-head { min-height: 17px; gap: 2px; }
  .day-num { min-width: 17px; height: 17px; font-size: var(--fs-2xs); }
  .day-hol-name { display: none; }
  .day-lunar { display: none; }

  .mobile-status-tabs {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin: 0 8px 8px;
    /* 板块多了横向滚，而不是把整页撑宽。
       实测（390px 视口）：4 个板块 tab 合计 322px < 容器 356px 正常；
       第 5 个起 361px 就溢出 20px，7 个溢出 253px —— 因为下面是 flex:1 的
       tab，等分压不到内容宽度以下，只会把容器顶出去。
       ⚠️ 只在 @media(max-width:768px) 里，桌面端 tab 根本不显示。 */
    overflow-x: auto;
    overscroll-behavior-x: contain;   /* 滚到头不把整页带着一起动 */
    scrollbar-width: none;            /* 细滚动条在 40px 高的 tab 条上很丑 */
  }
  .mobile-status-tabs::-webkit-scrollbar { display: none; }
  .mobile-status-tab {
    /* 1 0 auto 而不是 1：能放大铺满（板块少时不留空档），但不许缩到内容宽度以下
       （缩不动就是缩不动，改成滚）。原写法 flex:1 隐含 flex-shrink:1，
       压不下时不会报错，直接撑破容器。 */
    flex: 1 0 auto;
    padding: 9px 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
  }
  .mobile-status-tab .m-count {
    font-size: .68rem;
    background: var(--bg-elevated);
    padding: 0 6px;
    border-radius: 100px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
  }
  .mobile-status-tab.active { background: var(--accent); color: var(--on-accent); }
  .mobile-status-tab.active .m-count { background: rgba(255,255,255,.22); color: var(--on-accent); }

  /* 看板列：移动端只显示激活列 */
  /* 移动端一次只看一个板块(顶部 tab 切换), board 收成单列 */
  .board { grid-template-columns: 1fr; }
  .column { display: none; min-height: 0; }
  .column.active { display: flex; min-height: 60vh; }
  /* (原 .column-add 移动端样式已随按钮一起删除 —— 建板块走顶栏「＋」,
     该按钮在移动端同样可用, 见 .topbar-right .icon-btn) */

  /* 内容区给底部导航条让位。
     ⚠️ 必须写在 .main 的 padding 简写之后 —— 上面那行 `.main { padding: 8px; }` 是
     简写形式，会连同 padding-bottom 一起覆盖掉，写在它之前等于没写（实测踩过）。 */
  .main { padding-bottom: calc(var(--mobile-nav-h) + 8px + env(safe-area-inset-bottom)); }

  /* 抽屉在手机上改成「从底部升起的面板」：
     旧版是 top:0 + max-height:92vh（贴着屏幕顶、底部空一条），标题和关闭按钮
     全在拇指够不到的最上方。改成高度自适应 + 贴底，短内容就是个矮面板，长内容到 88vh 截止。
     动画方向也要跟着改（原来是横向滑入）。 */
  .drawer {
    top: auto; bottom: 0;
    height: auto;
    width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
  }
  .drawer.open { transform: translateY(0); }

  /* 移动端: 让所有 sticky 区域允许垂直页面滑动 */
  .topbar {
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  /* 移动端: 设置 option 加大触控区 */
  .settings-option {
    min-height: 64px;
    padding: 12px 14px;
  }
  .settings-option-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  /* 移动端小记：左侧筛选栏收成一条横向滚动条, 卡片单列;
     操作按钮常显 —— 触屏根本没有 hover, 藏起来等于点不到 */
  .notes-view { flex-direction: column; gap: 10px; }
  .notes-side {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .notes-side-nav { flex-direction: row; flex: none; }
  .notes-side-item { width: auto; white-space: nowrap; padding: 5px 10px; }
  .notes-side-section { flex: none; flex-direction: row; align-items: center; gap: 6px; }
  .notes-side-title { white-space: nowrap; }
  /* ⚠️ 目录区块在手机上要特殊对待。侧栏是一条横向流, 目录排在 nav 之后
     —— 实测左边界 242px, 而展开后宽 146px, 右边界 388px > 视口 375px,
     多出来的部分被 overflow-x:auto 藏进滚动区, 用户不横滑就看不见 (原来就是这样)。
     对策: ①允许换行 ②展开时 flex-basis:100% 独占一整行 —— 目录树按桌面的纵向样式完整展示。
     收起时只有「▸ 目录 +」约 60px 宽, 挤在 nav 后面也放得下, 不必占整行。 */
  .notes-side { flex-wrap: wrap; }
  .notes-side-nav { overflow-x: auto; max-width: 100%; }   /* 换行后横向滚动交给 nav 自己 */
  .notes-side-section.is-folder-section { flex-direction: column; align-items: stretch; }
  .notes-side-section.is-folder-section > .notes-side-title { white-space: normal; }
  .notes-side-section.is-folder-section:not(.is-folded) { flex: 1 1 100%; }
  .notes-side-toggle { padding: 6px 0; }   /* 触屏可点区域 (纯文字只有 19px 高, 手指点不准) */
  .notes-tag-filter { flex-wrap: nowrap; }
  .notes-main { width: 100%; }
  .notes-main-toolbar { flex-wrap: wrap; }
  .notes-search { flex: 1 1 100%; }
  .notes-grid { grid-template-columns: 1fr; gap: 8px; }
  /* ⚠️ 操作条在手机上是常显的, 而 base 里它是 absolute 浮层 ——
     实测 390px 压住正文第一行 242px(70%)、320px 压住 87%, 等于每条小记的
     开头都被自己的按钮盖死。这里改回文档流: 卡片是 flex column, 且它在
     DOM 里本来就是第一个子元素, position:static 后它自己占一行,
     一像素都不压字。底板 + halo 是给"浮层压在字上"用的, 现在下面没有字了,
     一并撤掉（留着会在同色卡片上画出一个看不见但占 2px 的框）。 */
  .note-card .note-actions {
    position: static;
    justify-content: flex-end;
    flex-wrap: wrap;
    background: transparent;
    box-shadow: none;
    opacity: 1;
  }

  /* ===== 列表视图：窄屏改卡片式两行 =====
     旧版是 4 列表格，实测 390px 下「状态」「分类」两列只剩 61 / 62px，
     药丸被挤成两行（"待 办" / "普 通"），行高在 65~86px 之间乱跳；
     320px 下更糟 —— 任务列只剩 142px，标题疯狂换行。
     4 列在 320~390px 上就是不够分，改成每行两排：
       第一排：分类点 + 标题（铺满整行）
       第二排：截止 · 状态 · 分类（分类靠右）
     表头在窄屏没有信息价值（列宽全变了），直接收起。 */
  .task-table, .task-table tbody, .task-table tr, .task-table td { display: block; }
  .task-table thead { display: none; }
  .task-table tr {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-areas:
      "title  title  title"
      "due    status pri";
    align-items: center;
    gap: 7px 10px;
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .task-table tbody tr:last-child { border-bottom: none; }
  .task-table tbody tr:hover { background: var(--bg-hover); }
  .task-table tbody tr:hover td { background: transparent; }
  .task-table td { padding: 0; border-bottom: none; }
  .task-table td.empty { grid-column: 1 / -1; }
  .task-table td.cell-title { grid-area: title; }
  .task-table td.cell-due {
    grid-area: due;
    font-size: var(--fs-xs); color: var(--text-tertiary); font-family: var(--font-mono);
  }
  /* 没设截止日期时不占位（旧版会留一个孤零零的「—」占着第二排最左） */
  .task-table td.cell-due.is-empty { display: none; }
  .task-table td.cell-status { grid-area: status; }
  .task-table td.cell-pri { grid-area: pri; justify-self: end; }
  .status-pill, .pri-pill { white-space: nowrap; }   /* 药丸一律不许折行 */

  /* ===== 日历：格内改分类圆点 =====
     手机上一格只有 52×53（320px 下 42×48），塞 3 条文字条必然放不下。
     改成「每个任务一个彩色圆点」：一眼看出这天有几件事、急不急；
     任务名点开当日列表看（点格子本来就是打开当日列表）。 */
  .day-titles { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 3px; margin-top: 3px; }
  .day-title {
    width: 6px; height: 6px; padding: 0;
    border: none; border-left: none;
    border-radius: 50%;
    /* 文字保留在 DOM 里（读屏/tootlip 仍可读），视觉上只剩一个点 */
    font-size: 0; line-height: 0; color: transparent;
    overflow: hidden;
  }
  /* 手机上小条缩成 6px 圆点 —— 透明点 = 看不见，所以无色档在这里必须给个实体色 */
  .day-title { background: var(--pri-bar, var(--text-tertiary)); }
  .day-title[data-pri-color=""],
  .day-title[data-pri-color="neutral"] { background: var(--text-tertiary); }
  .day-title.done, .day-title.done.archived { opacity: .3; text-decoration: none; }
  /* 圆点在手机上只有 6px，自己那条 onclick 等于点不中 —— 让它不接管点击，
     整格（52×53）才是唯一目标，点了就进当日列表，行为一致。 */
  .day-title { pointer-events: none; }
  .day-more { font-size: 9px; line-height: 1; }

  /* ===== 触控目标放大 =====
     实测改动前有 38 类交互元素小于 36px，最小 24×24（弹层关闭 22×24、色板 26×26、
     归档按钮 52×23）。24px 在手机上约 3~4mm，低于各平台建议的 44px
     （WCAG 2.2 AA 的下限是 24px，但那个下限的假设是"有足够间距"）。
     这里统一抬到 34~44px，且不动桌面端。 */
  .icon-btn-sm { width: 36px; height: 36px; }
  .task-card-menu-btn { width: 36px; height: 36px; }
  .note-icon-btn { padding: 8px 9px; font-size: 1rem; }        /* ≈34×34 */
  .calendar-toolbar .cal-nav { width: 44px; height: 44px; }
  .calendar-toolbar .cal-today { min-height: 36px; padding: 0 14px; }
  .archive-item .archive-restore { padding: 9px 12px; font-size: .78rem; }
  .archive-item .archive-delete { padding: 9px 12px; font-size: 1rem; }
  /* 回收站分段：抬到约 38px 高（拇指点得准），间距略放大避免误触相邻段 */
  .trash-tabs { gap: 8px; margin-bottom: 10px; }
  .trash-tab { padding: 10px 16px; }

  /* 回收站条目在窄屏改成两行：
       第一行 [标记] 标题（占满整行）
       第二行 时间 + 恢复 + 删除
     ⚠️ 这是实拍踩出来的：时间带上「· N 天后清除」之后，时间/按钮/标题三方
     在同一行抢宽度，390px 下标题被压成一字一行，320px 只剩 43% 宽。
     排版分类按"信息重要性"排：标题（用户靠它认人）独占一行拿到几乎全部宽度，
     时间（有表头说明、可截断）和按钮去第二行。
     ⚠️ 标题 flex-basis 100% 是把后面元素顶到下一行的关键；按钮必须
     flex:0 0 auto + nowrap，否则它们仍会被压成两行文字。 */
  .archive-item { flex-wrap: wrap; row-gap: 4px; }
  .archive-item .archive-priority,
  .archive-item .archive-kind { order: 0; flex: 0 0 auto; }
  .archive-item .archive-title {
    order: 1;
    flex: 1 1 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .archive-item .archive-time {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .archive-item .archive-restore { order: 3; flex: 0 0 auto; }
  .archive-item .archive-delete { order: 4; flex: 0 0 auto; }
  .notes-side-item { min-height: 38px; padding: 8px 12px; }
  .notes-attach-btn { min-height: 38px; padding: 0 10px; }
  .notes-sort-select { min-height: 38px; }
  .seg { min-height: 40px; }
  .drawer .btn-primary, .drawer .btn-ghost-sm { min-height: 38px; padding: 0 14px; }
  .bookmark-sort-btn, .bookmark-manager-tab { min-height: 36px; }
  /* 登录页的窄屏覆盖已移到 Login 块内部（同权重下后写的赢，写在这里会被它盖掉）。 */
  /* ⚠️ 通用弹层 / 色板 / 命令面板那几组规则**不能写在这里**：
     它们的目标组件（.generic-modal-*、.color-swatch、.cmdk-* 等）的基础定义
     排在本文件更靠后的位置，而媒体查询**不增加分类** —— 同分类下后写的赢，
     写在前面等于整条被盖掉（实测：弹层还是居中的、色块还是 26×26）。
     所以它们统一放在文件最末尾的「移动端 · 后置覆盖」块里。 */
}

/* ===== 通用 Modal ===== */
.generic-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.generic-modal-card {
  background: var(--surface-primary);
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.generic-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
}
.generic-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.generic-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 0 4px;
}
.generic-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.generic-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-default);
}

/* 危险确认按钮（删除类操作） */
.modal-confirm-btn.is-danger {
  background: var(--danger);
  color: var(--on-accent);
}
.modal-confirm-btn.is-danger:hover {
  background: var(--danger-hover);
}
/* 确认按钮"执行中": 变暗 + 光标变等待。
   没有这条的话按钮被 disable 后外观毫无变化, 用户看不出已经点上了,
   体验等同于"点了没反应" —— 这正是"点删除莫名其妙卡"的观感来源。 */
.modal-confirm-btn:disabled {
  opacity: .65;
  cursor: progress;
}

/* 确认弹窗正文 */
.modal-text {
  font-size: .88rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
}
/* 带输入框的弹层 (promptModal) —— 新建/重命名板块用 */
.modal-prompt-input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .88rem;
}
.modal-prompt-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
/* 错误提示占一行高度: 出现时不把按钮顶下去 */
/* --- 板块颜色选择器（新建 / 编辑板块弹层）---
   色块用 inline style="--sw: var(--col-blue)" 传色，规则里不写死任何色值。 */
.color-palette {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 10px;
}
/* 单颗色块。26 → 28px：26px 圆点在触屏上偏小，28 是"一眼看清颜色"的最小值，
   而且 8 颗一行 = 8×28 + 7×10 = 294px，仍装得进弹层一行。
   --sw 由 JS 内联写进来（--col-blue / --pri-swatch-danger …），规则里不写死色值。 */
.color-swatch {
  --sw-ring: var(--swatch-ring);
  position: relative;
  width: 28px; height: 28px; border-radius: 50%; padding: 0; border: 0;
  background: var(--sw, var(--text-tertiary));
  box-shadow: inset 0 0 0 1px var(--sw-ring);
  cursor: pointer;
  transition: transform var(--fast, .12s ease), box-shadow var(--fast, .12s ease);
}
/* 悬停：抬起 1px + 放大一点点 + 落下浅阴影。
   只放大不改色 —— 改色会让"我在选哪个颜色"这件事变得含混。 */
.color-swatch:hover {
  transform: translateY(-1px) scale(1.08);
  box-shadow: inset 0 0 0 1px var(--sw-ring), var(--shadow-xs);
}
/* 「无色」是透明底，内描边要换成控件边界色才看得见，外环也拿不到 --sw（透明）
   → 退回中性色。只改两个变量（而不是直接写 box-shadow）—— 这样悬停/选中/聚焦
   三态都自动跟着用它们，不必各写一遍、也不会被后写的规则盖掉。 */
.color-swatch[data-color="none"] {
  --sw-ring: var(--border-control);
  --sw-ring-col: var(--text-secondary);
}
/* 「无色」的斜杠：透明块没有任何形状信息，一根 45° 斜线才是"没有颜色"的通用记号。
   用 --text-secondary 而不是 tertiary —— 实测 tertiary 在浅底上细看才勉强看见。 */
.color-swatch[data-color="none"]::before {
  content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 1.5px;
  background: var(--text-secondary); transform: rotate(-45deg); border-radius: 1px;
}
/* 选中：**自身颜色的外环** + 勾。
   原来的实现只有一圈 --text-primary 的黑环 —— 跟"选了哪个颜色"完全无关，
   6 颗里选了哪颗还得回头看位置。现在外环就是这颗的颜色，一眼认出来。
   环用两层 shadow 画（弹层底色挖出缝隙 + 颜色环），不用 outline：
   outline 在 overflow:hidden 的弹层里会被裁掉一段。 */
.color-swatch.is-active {
  box-shadow: inset 0 0 0 1px var(--sw-ring),
              0 0 0 2px var(--surface-popover),
              0 0 0 4px var(--sw-ring-col, var(--sw, var(--text-tertiary)));
}
.color-swatch.is-active::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--check-mark-outlined) center / 13px 13px no-repeat;
}
/* 选中的「无色」不再画斜杠 —— 28px 里同时塞斜杠+勾会糊成一团，
   选中态的信息由"环 + 勾"承担就够。 */
.color-swatch.is-active[data-color="none"]::before { display: none; }
.color-swatch:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--sw-ring),
              0 0 0 2px var(--surface-popover), 0 0 0 4px var(--accent);
}
.modal-field-label {
  display: block; margin: 14px 0 0;
  font-size: var(--fs-sm); color: var(--text-secondary);
}

.modal-prompt-hint {
  min-height: 1.1em;
  margin: 6px 0 0;
  font-size: .76rem;
  color: var(--danger);
}

/* ================================================================
   v2.28 新增: 命令面板键盘导航 / 数据库备份 / 批量多选
   ================================================================ */

/* ----- 命令面板: 键盘选中态 + 关键词高亮 + 快捷键角标 ----- */
.cmdk-item.is-active {
  background: var(--bg-active);
  color: var(--text-primary);
  box-shadow: inset 2px 0 0 var(--accent);
}
.cmdk-mark {
  background: var(--accent-subtle);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 1px;
}
.cmdk-kbd {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-active);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: .68rem;
}
.cmdk-more { padding: 2px 12px 6px; font-size: .72rem; }
.cmdk-hint {
  padding: 10px 12px 4px;
  margin-top: 6px;
  border-top: 1px solid var(--border-default);
  font-size: .75rem;
}

/* ----- 设置面板: 按钮行 -----
   一处定义, 设置里的「数据」区块和 picker 弹层的按钮行共用 */
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ----- 批量多选 -----
   勾选框用 ::before 挂在标题/首格上, 不改卡片本身的布局
   (卡片是纵向结构, 直接在 article 上加 ::before 会把勾选框顶到单独一行) */
body.is-selecting .task-card { cursor: pointer; }
body.is-selecting .task-title::before,
body.is-selecting .task-table td.cell-title::before {
  content: '';
  display: inline-block;
  width: 16px; height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 1px solid var(--border-control);
  border-radius: 4px;
  background-color: transparent;
}
body.is-selecting .task-card.is-selected .task-title::before,
body.is-selecting .task-table tr.is-selected td.cell-title::before {
  border-color: var(--accent);
  background: var(--accent) center / 11px no-repeat
    var(--check-mark);
}
body.is-selecting .task-card.is-selected { border-color: var(--accent); }
body.is-selecting .task-table tr.is-selected { background: var(--accent-subtle); }
/* 卡片上的 ··· 菜单在多选模式下没有意义, 且容易误触 */
body.is-selecting .task-card-menu-btn { display: none; }

/* 底部操作条 */
.select-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
  z-index: 80;
}
.select-bar-count { font-size: .82rem; color: var(--text-primary); white-space: nowrap; }
.select-bar-sep { flex: none; width: 1px; height: 18px; background: var(--border-default); }
.select-bar-btn {
  padding: 5px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: .78rem;
  white-space: nowrap;
  cursor: pointer;
}
.select-bar-btn:hover { color: var(--text-primary); border-color: var(--border-hover); background: var(--bg-hover); }
.select-bar-btn.is-danger:hover { color: var(--danger); border-color: var(--danger); }
.select-bar-close {
  flex: none;
  width: 26px; height: 26px;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  line-height: 1;
  cursor: pointer;
}
.select-bar-close:hover { color: var(--text-primary); background: var(--bg-hover); }

@media (max-width: 768px) {
  .select-bar { left: 8px; right: 8px; transform: none; }
}

/* ===================================================================
   移动端 · 后置覆盖
   -------------------------------------------------------------------
   ⚠️ 这一段**必须留在文件最末尾**，不能往前提。
   原因：CSS 媒体查询本身不改变分类，同分类下「后写的赢」。
   下面这些选择器所对应的组件，其基础定义散落在本文件靠后的位置
   （.select-bar / .generic-modal-* / .color-swatch / .cmdk-* …），
   所以这些覆盖规则只有写在它们之后才会生效（写在中间会被整条盖掉，实测踩过）。
   =================================================================== */
@media (max-width: 768px) {
  /* 底部多选条：抬到底部导航栏之上，否则被压住点不到 */
  .select-bar { bottom: calc(var(--mobile-nav-h) + 10px + env(safe-area-inset-bottom)); }

  /* 通用弹层：改为贴底 + 收边距。
     居中弹层在手机上会正对着弹出的软键盘；贴底顺带让按钮落在拇指区。 */
  .generic-modal-overlay { padding: 12px; align-items: flex-end; }
  .generic-modal-card { max-height: 84vh; }
  .generic-modal-body { padding: 14px 16px; }
  .generic-modal-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .generic-modal-close { width: 40px; height: 40px; padding: 0; font-size: 1.5rem; }
  .modal-prompt-input { min-height: 42px; }
  /* 色板：桌面 28px 在手机上点不准（28 < 44 的触摸目标），放大到 34px；
     勾也跟着放大，否则色块变大、勾显得更小。 */
  .color-swatch { width: 34px; height: 34px; }
  .color-swatch.is-active::after { background-size: 16px 16px; }

  /* 命令面板 */
  .cmdk { top: 8%; width: calc(100% - 20px); max-width: none; }
  .cmdk-list { max-height: 50vh; }

  /* --- 收尾补漏：首轮审计后仍小于 34px 的几处 --- */
  /* 小记搜索框：外壳 32px 高，但里面的 input 只有 17px（文字行高），
     结果上下各 7px 是"死区"，戳上去不聚焦 —— 让 input 撑满外壳。 */
  .notes-search { height: 40px; }
  .notes-search input { align-self: stretch; }
  .notes-search-clear { width: 32px; height: 32px; }
  /* 小记卡片右上那排图标（编辑/链接/复制/归档/置顶/删除）：32×33 → 34×35 */
  .note-icon-btn { padding: 9px 10px; }
  /* 书写框的「保存」按钮（实测 56×31） */
  .notes-composer-foot .btn-primary { min-height: 38px; padding: 0 18px; }
  /* 小记编辑器的 Markdown 快捷按钮：桌面 28px 在触屏上点不准 → 36px。
     ⚠️ 必须写在这个文件末尾的块里：.note-md-btn 的基础定义在文件中部,
     同权重靠源码顺序定胜负, 写在基础定义附近会被后面的规则盖掉。 */
  .note-md-btn { height: 36px; min-width: 38px; padding: 0 10px; font-size: .78rem; }
  /* 移动端书写区不必强留 300px（窄屏抽屉是底部弹出，可视高度本来就小） */
  .note-edit-pane textarea,
  .note-edit-pane .note-edit-rich { min-height: 220px; }
  /* 看板上方板块切换条：一行 4 个时每个只有 35px 高 */
  .mobile-status-tab { padding: 11px 6px; }
}

/* 触屏：命令面板里的键盘提示没有意义
   「⌘N / G K / ↑↓ 选择 / ↵ 打开 / Esc 关闭」在手机上全是噪声 ——
   手指没有 Esc 键，也按不出 G K。只在"没有 hover + 指针粗糙"（= 真触屏）时收起；
   触屏笔记本接鼠标时 (hover:hover) 不受影响，提示照常显示。
   同样后置（.cmdk-kbd 的基础定义也在文件后段）。 */
@media (hover: none) and (pointer: coarse) {
  .cmdk-kbd { display: none; }
  .cmdk-footer { display: none; }
  /* 列表项行高抬到 44px：手指点得准 */
  .cmdk-item { min-height: 44px; display: flex; align-items: center; }
  .cmdk-restore { width: 36px; height: 36px; }
}

/* ================================================================
   加载界面（2026-09-16 第十九轮）
   一套视觉、两处用途：
     .boot-loader    首屏加载页 —— 打开/刷新时的全屏过渡，数据就绪后淡出
     .global-loading 通用遮罩   —— 切视图 / 导入导出 / 批量操作的等待反馈
   两者只从 CSS 变量取色，深浅主题自动跟随，不硬编码任何色值。
   ⚠️ z-index 取 10000 / 10001：必须高于 .generic-modal-overlay(9999)，
      否则"从弹层里触发的耗时操作"遮罩会被弹层压住、等于没加。
   ================================================================ */

/* --- 共用：不确定态细进度条 ---
   3px + 圆头 + 40% 宽的滑块来回跑：不表达"还剩多少"，只表达"还在动"。
   真百分比需要后端配合，这里不做假进度。
   ⚠️ 行程必须卡在 -100% → 250%：滑块宽 40% 时 250% 恰好等于轨道宽度，
      即"左边缘刚贴右端"。写 350% 会让滑块有两成时间跑在轨道外 —— 截图上
      就只看得到一条空轨道。同理用 linear 不用 --ease：后者快出慢入，
      会把滑块长时间甩在右侧不见。 */
.load-bar {
  position: relative;
  width: 132px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--border-default);
  overflow: hidden;
}
.load-bar > span {
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  animation: load-slide 1600ms linear infinite;
}
/* 往返（乒乓球）而不是单向循环：单向滑到右端会"瞬间跳回"左端，那一跳很扎眼；
   往返在端点只是反向，没有跳变。linear 保证滑块始终有一部分留在轨道里。 */
@keyframes load-slide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(250%); }
  100% { transform: translateX(-100%); }
}

/* --- 1) 首屏加载页 ---
   默认即不透明：页面一渲染就盖住，不留白屏。收起只改 opacity，
   过渡走完再由 JS 移除节点。 */
.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-root);
  opacity: 1;
  transition: opacity 260ms var(--ease);
}
.boot-loader.is-done { opacity: 0; pointer-events: none; }

.boot-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* logo 与 favicon 同形（圆角方块 + 白勾），放大到 46px。
   呼吸感用 scale + opacity，不用旋转 —— 旋转在"应用启动"语境下太吵。 */
.boot-logo {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  animation: boot-breathe 1800ms var(--ease) infinite;
}
.boot-logo svg { width: 26px; height: 26px; }
@keyframes boot-breathe {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(.93); opacity: .78; }
}

/* 应用名。中文这里只加字距，不用 text-transform —— 那对中文无效，只会把字距拉松。 */
.boot-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--text-tertiary);
}

/* --- 2) 通用加载遮罩 ---
   不用 .hidden 开关：那会打断 opacity 过渡。改用 opacity + visibility，
   visibility:hidden 还能把它从无障碍树里摘掉 —— 没加载时不会被读屏念到。 */
.global-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms var(--ease), visibility 0s linear 180ms;
}
.global-loading.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 180ms var(--ease), visibility 0s;
}

/* 卡片托在中央：popover 表面 + 菜单级阴影，与命令面板同一档"浮起"程度。 */
.global-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 26px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-popover);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-menu);
}
.global-loading-text {
  max-width: 260px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

/* --- 移动端 --- */
@media (max-width: 768px) {
  .boot-logo { width: 42px; height: 42px; border-radius: 11px; }
  .boot-logo svg { width: 24px; height: 24px; }
  .global-loading-card { padding: 18px 22px 16px; }
  .global-loading-text { font-size: var(--fs-md); }
}

/* --- 减弱动效偏好 ---
   进度条不能停（停了就看不出在加载），只放慢；logo 呼吸与淡出直接去掉。 */
@media (prefers-reduced-motion: reduce) {
  .boot-loader { transition: none; }
  .boot-logo { animation: none; }
  .load-bar > span { animation-duration: 2400ms; }
  .global-loading,
  .global-loading.is-on { transition: none; }
}

/* ===== 占位符速查手册 (phcs v2: 左目录右内容) ===== */
.ntpl-cheat-row { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.phcs-card {
  width: min(920px, 94vw);
  height: min(640px, 88vh);
  display: flex;
  flex-direction: column;
}
.phcs-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}
.phcs-toc {
  width: 132px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-default);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-hover);
  overflow-y: auto;
}
.phcs-toc-item {
  font-size: .84rem;
  color: var(--text-secondary);
  padding: 7px 10px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}
.phcs-toc-item:hover { background: var(--bg-active, rgba(0,0,0,.06)); color: var(--text-primary); }
.phcs-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.phcs-tip {
  color: var(--text-tertiary);
  font-size: .8rem;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-default);
}
.phcs-group { margin-bottom: 22px; }
.phcs-group-title {
  font-size: .95rem;
  font-weight: 600;
  margin: 0 0 4px;
}
.phcs-group-intro {
  font-size: .8rem;
  color: var(--text-tertiary);
  margin: 0 0 10px;
}
.phcs-row {
  display: flex;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  align-items: flex-start;
}
.phcs-row:nth-child(odd) { background: var(--bg-hover); }
.phcs-row .ntpl-ph { flex-shrink: 0; min-width: 110px; }
.phcs-row-main { flex: 1; min-width: 0; }
.phcs-desc { font-size: .82rem; color: var(--text-secondary); margin-bottom: 3px; }
.phcs-sample {
  font-size: .78rem;
  color: var(--text-tertiary);
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
  margin: 0;
  padding: 4px 8px;
  background: var(--bg-active, rgba(0,0,0,.04));
  border-left: 2px solid var(--border-default);
  border-radius: 0 4px 4px 0;
}
.phcs-combo {
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.phcs-rule {
  padding: 9px 12px;
  border-left: 3px solid var(--border-default);
  background: var(--bg-hover);
  border-radius: 0 8px 8px 0;
  margin-bottom: 8px;
}
.phcs-rule:nth-child(even) { border-left-color: var(--primary, #4a7dff); }
.phcs-rule-title { font-size: .84rem; font-weight: 600; margin-bottom: 2px; }
.phcs-rule-desc { font-size: .8rem; color: var(--text-secondary); line-height: 1.5; }
.phcs-combo-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.phcs-combo-name { font-weight: 600; font-size: .88rem; }
.phcs-combo-head .btn-ghost-sm { margin-left: auto; }
.phcs-combo-body {
  margin: 0;
  font-size: .8rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 8px 10px;
}

/* ===== 登录设备管理 (v=200) ===== */
/* 设备行: 图标 + 名称/元信息 + 操作。窄屏时操作钮换行到下一行, 不挤压文字 */
.device-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.device-loading, .device-empty { font-size: var(--fs-xs); padding: 6px 0; }
.device-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 0.5px solid var(--border-default);
}
.device-row.is-current { border-color: #4353D6; background: color-mix(in srgb, #4353D6 6%, var(--bg-elevated)); }
.device-icon { flex: none; color: var(--text-secondary); margin-top: 1px; }
.device-main { flex: 1; min-width: 0; }
.device-name {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary);
}
.device-meta { font-size: var(--fs-2xs); color: var(--text-secondary); margin-top: 2px; word-break: break-all; }
/* ⚠️ 这里刻意不用 .muted —— 项目里 .muted 是「空态提示」(居中 + 20px padding),
   不是「弱化文字」; 套在行内文字上会被强行居中 (设备行的 IP 行踩过这个坑) */
.device-meta.is-dim { color: var(--text-tertiary); }
/* v=239: 设备行的「登录 / 最近活跃」时间单独一行。
   ⚠️ 不用 .is-dim 的 --text-tertiary (对卡片/弹窗底只有 ~3.1 的对比度, 小字读不清),
      改 --text-muted-label (浅/深分别 4.8/8.8); tabular-nums 让两行的数字上下对齐。 */
.device-meta.device-time { color: var(--text-muted-label); font-variant-numeric: tabular-nums; }
.device-tag {
  font-size: var(--fs-2xs); font-weight: 600; line-height: 1.5;
  padding: 0 5px; border-radius: 3px; flex: none;
}
.device-tag.is-now { color: #fff; background: #4353D6; }
.device-tag.is-trusted { color: #0b7285; background: #e6f7fa; }
html:not([data-theme="light"]) .device-tag.is-trusted { color: #66d9e8; background: rgba(102,217,232,.12); }
.device-ops { display: flex; gap: 4px; flex: none; }
.device-ops .mem-op { padding: 3px 8px; }
/* 安全动态 */
.sec-events-head { display: flex; align-items: center; gap: 8px; }
.sec-events-title { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); }
.sec-events-head .btn-ghost-sm { margin-left: auto; }
.sec-events { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sec-event {
  display: flex; align-items: baseline; gap: 8px;
  font-size: var(--fs-xs); padding: 6px 8px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border-left: 2px solid transparent;
}
.sec-event.is-unread { border-left-color: #f03e3e; background: color-mix(in srgb, #f03e3e 8%, var(--bg-hover)); }
.sec-event-text { flex: 1; min-width: 0; color: var(--text-primary); word-break: break-word; }
.sec-event-time { flex: none; font-size: var(--fs-2xs); color: var(--text-tertiary); }
@media (max-width: 768px) {
  .device-row { flex-wrap: wrap; }
  .device-ops { flex-basis: 100%; justify-content: flex-end; }
  .sec-event { flex-direction: column; gap: 2px; }
}

/* ===== 安全中心弹窗 (v=202) ===== */
/* 独立弹层而不是塞进设置抽屉: 设备清单 + 动态 + 开关一整套内容挤在设置里
   会把"账号/归档/界面/数据"四个分区压得找不着, 也读不出层级。 */
.sec-modal-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px;
}
.sec-modal {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 760px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  overflow: hidden;
}
.sec-modal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 0.5px solid var(--border-default); flex: none;
}
.sec-modal-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); }
.sec-modal-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #f03e3e; color: #fff; font-size: var(--fs-2xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sec-modal-close {
  margin-left: auto; border: none; background: transparent; cursor: pointer;
  color: var(--text-tertiary); width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.sec-modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.sec-modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
/* 区块: 用留白 + 细分隔线分组, 不套卡片避免"盒中盒" */
.sec-block + .sec-block { margin-top: 18px; padding-top: 16px; border-top: 0.5px solid var(--border-default); }
.sec-block-head { display: flex; align-items: center; gap: 8px; }
.sec-block-head .btn-ghost-sm { margin-left: auto; }
.sec-block-title {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary);
  letter-spacing: .03em; margin-bottom: 8px;
}
.sec-block-head .sec-block-title { margin-bottom: 8px; }
/* v=290: 「安全动态」列表只给最近 10 条, 满 10 条时在标题后标一句, 免得用户以为记录丢了 */
.sec-block-note {
  font-size: var(--fs-2xs);
  color: var(--text-muted-label);
  padding: 1px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  margin-bottom: 8px;
  white-space: nowrap;
}
/* 设置里的入口按钮 + 未读角标 */
.sec-entry-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: #f03e3e; color: #fff;
  font-size: var(--fs-2xs); font-weight: 700; vertical-align: middle;
}
/* 移动端: 贴底全宽面板 (拇指可达, 也避免小屏上"卡片悬在中间"的局促) */
@media (max-width: 768px) {
  .sec-modal-backdrop { padding: 0; align-items: flex-end; }
  .sec-modal { max-width: none; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .sec-modal-body { padding: 14px 14px 20px; }
}

/* ===== v215 移动端修复 (2026-09-30): 日历工具条遮挡 / 书签栏横滑 / 弹窗分类横滑 ===== */
@media (max-width: 768px) {
  /* v215: 日历工具条窄屏重排 —— 原来 cal-src-switch/cal-today 绝对定位,
     320~390px 下「全部/待办/计时器」直接压在「‹ 月份 ›」上。
     改成两行静态布局: 第一行 翻月+标题+今天, 第二行数据源切换居中。 */
  .calendar-toolbar { flex-wrap: wrap; row-gap: 8px; margin-bottom: 10px; }
  .calendar-toolbar h2 { order: 2; min-width: 0; flex: 1; text-align: center; }
  .calendar-toolbar .cal-nav:first-child { order: 1; }
  .calendar-toolbar .cal-nav:nth-of-type(2) { order: 3; }
  .calendar-toolbar .cal-today { order: 4; position: static; }
  .calendar-toolbar .cal-src-switch {
    order: 5; position: static; transform: none;
    width: 100%; justify-content: center;
  }
  /* v215: 书签栏窄屏改横滑单行 —— 原来 flex-wrap 挤成一坨 */
  .bookmarks-bar-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .bookmarks-bar-chips::-webkit-scrollbar { display: none; }
  .bookmark-group { flex: none; }
  .bookmark-chip { flex: none; max-width: 200px; }
  /* v215: 新增/编辑弹窗的分类 seg 组窄屏横滑 (HTML 里 seg-wrap 早已就位, CSS 一直没写) */
  .seg-group.seg-wrap {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .seg-group.seg-wrap::-webkit-scrollbar { display: none; }
  .seg-group.seg-wrap .seg { flex: none; white-space: nowrap; }
}

/* ===== v=219: 时间显示 (滚动) =====
   时间动画只剩「数字滚动」一种 (环形/流沙/翻牌与选择条已按用户要求移除)。
   结构: 前缀 + N月 + N天 + HH:MM:SS —— 单位与前缀是静止文本, 只有数字位在滚。
   v=222: 同一套结构也吃「大数+单位」(总秒数/总分钟/总小时), 千分位逗号是静态分隔符。 */

/* ===== v=217: 时间显示 = 分段 (数字主体 / 单位弱化 / 时钟分组) =====
   旧版把「已 33月11天 16:04:32」当一串字符, 中文单位跟着数字一起滚、空格会塌。
   现在拆成: 前缀 + N月 + N天 + HH:MM:SS, 单位与前缀是静止的真实文本,
   只有数字位参与动画 —— roll 用滚轮, flip 用逐位翻牌, 其他模式直接换字。 */
.mem-st-val { font-variant-numeric: tabular-nums; }   /* 等宽数字: 走秒不左右抖 */
.mem-time { display: inline-flex; align-items: center; gap: .34em; }
.mem-tpre { font-size: .74em; color: var(--text-secondary); }
.mem-tnum { display: inline-flex; align-items: center; gap: .08em; }
.mem-tnum .mem-reel { font-weight: 600; font-size: 1.06em; }
/* 单位: 小一号 + 弱化 —— ⚠️ 用 --text-secondary 而不是 --text-tertiary (后者对卡片底只有 ~3.1) */
.mem-tnum u {
  font-size: .7em; font-weight: 400; font-style: normal; text-decoration: none;
  color: var(--text-secondary);
}
.mem-tclock { display: inline-flex; align-items: center; }
.mem-tclock .mem-reel { font-weight: 600; }
/* 分隔冒号: 每秒轻轻呼吸一下 (最便宜的"它在走"信号)。
   ⚠️ 别做成 steps 硬闪 —— 灭相位会被截到"16 19 58"这种读不出时间的画面;
   这里用 ease-in-out 且最低只压到 .45, 任何一帧都读得出来。 */
.mem-tsep {
  font-style: normal; font-size: .9em; color: var(--text-secondary);
  margin: 0 .1em;
  animation: memColonBlink 1s ease-in-out infinite;
}
@keyframes memColonBlink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* 大数里的静态分隔符 —— 千分位逗号与小数点 (如 105,432 秒 / 12.5 小时):
   不进滚轮、不算一个"位", 也不像冒号那样呼吸。 */
.mem-tcomma {
  font-style: normal; font-size: .82em; color: var(--text-secondary);
  margin: 0 .04em;
}

/* 滚轮: 条带 0-9 重复 3 遍 (30 格), 中间那圈是可视区 —— 多出的两圈让
   9→0 / 0→9 能"顺着同一方向再走一步"而不是倒着滚回去 (里程表手感)。
   --p 是位置: 显示格 c = 10 - p, 所以 translateY = (p - 10) 格 = (p-10) * (100/30)%。 */
.mem-reel {
  display: inline-block; width: 1ch; height: 1.42em; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.mem-reel-track {
  display: block;
  transform: translateY(calc((var(--p, 0) - 10) * 3.33333%));
  transition: transform .6s cubic-bezier(.33, 1, .4, 1);
  will-change: transform;
}
.mem-reel-track b {
  display: block; height: 1.42em; line-height: 1.42em;
  font-weight: inherit; text-align: center;
}


/* 移动端: 环形缩小, 动画条紧凑, 滚轮窗略矮 */
@media (max-width: 768px) {
  .mem-reel { height: 1.34em; }
  .mem-reel-track b { height: 1.34em; line-height: 1.34em; }
}

/* 系统级减弱动画偏好: 滚轮直接跳到目标位, 冒号不闪 */
@media (prefers-reduced-motion: reduce) {
  .mem-tsep { animation: none !important; }
  .mem-reel-track { transition: none !important; }
}



/* ===== v=219: 通知中心 (顶栏铃铛 + 面板) =====
   站内通知是主通道: 永久留存、未读角标、可回溯。
   微信/QQ 只是额外的一条汇总推送 (设置里可关), 不承担"看过就没"的职责。 */
.notif-btn { position: relative; }
.notif-btn.has-unread { color: var(--accent); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: #e03131; color: #fff;
  font-size: 10px; line-height: 15px; font-weight: 700; text-align: center;
  box-shadow: 0 0 0 2px var(--bg-root);
}
html:not([data-theme="light"]) .notif-badge { box-shadow: 0 0 0 2px var(--bg-root); }
.notif-head-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.notif-group { margin-bottom: 14px; }
.notif-group-title {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .02em;
  color: var(--text-secondary); margin: 0 0 6px;
}
.notif-group-count {
  border: 0.5px solid var(--border-default); border-radius: 999px;
  padding: 0 6px; font-weight: 400; color: var(--text-muted-label);
}
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px; margin-bottom: 6px;
  border: 0.5px solid var(--border-default); border-radius: 8px;
  background: var(--surface-card);
}
/* 未读: 左侧一条主色边 + 极淡底色 (不靠纯颜色传达状态, 还有字重与边的差异) */
.notif-item.is-unread {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-card));
}
.notif-icon {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; background: var(--bg-surface);
}
.notif-main { flex: 1; min-width: 0; cursor: pointer; }
.notif-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); word-break: break-word; }
.notif-sub { font-size: var(--fs-2xs); color: var(--text-muted-label); margin-top: 2px; }
.notif-ops { display: flex; gap: 4px; flex: none; }
.notif-op {
  border: 0.5px solid var(--border-default); background: transparent;
  color: var(--text-secondary); border-radius: 6px; cursor: pointer;
  font-size: var(--fs-2xs); padding: 2px 7px;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.notif-op:hover { color: var(--text-primary); border-color: var(--border-hover); }
.notif-op.is-danger:hover { color: #e03131; border-color: #e03131; }
.notif-empty-hint { font-size: var(--fs-2xs); }
.notif-cfg { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.notif-cfg-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-secondary); }
.notif-cfg-row select {
  font-size: var(--fs-sm); padding: 3px 6px; border-radius: 6px;
  border: 0.5px solid var(--border-control); background: var(--bg-surface);
  color: var(--text-primary); cursor: pointer;
}
@media (max-width: 480px) {
  /* 触屏: 通知条目里的操作按钮要够大 (低于 44px 手指点不准) */
  .notif-op { padding: 6px 10px; }
  .notif-ops { gap: 6px; }
  .notif-cfg { gap: 10px; }
}

/* ===== v=224: 搜索命中高亮 + 结果摘要 =====
   ⚠️ 对比度: 浅色主题用「浅琥珀底 + 继承深色文字」; 深色主题下**不能**沿用这套
   (深底上的浅琥珀 + 浅色文字 = 糊成一片), 改成实底琥珀 + 深棕文字, 两边都 ≥ 4.5:1。 */
.note-hit {
  background: color-mix(in srgb, #f59f00 34%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
  box-shadow: 0 0 0 1px color-mix(in srgb, #f59f00 28%, transparent);
}
html:not([data-theme="light"]) .note-hit {
  background: #f0c05a;
  color: #3a2600;
}
.notes-search-summary {
  grid-column: 1 / -1;
  font-size: var(--fs-2xs);
  color: var(--text-muted-label);
  padding: 0 2px 8px;
}
.notes-search-summary b { color: var(--text-secondary); font-weight: 600; }

/* ===== v=225: 小记标题 (选填) =====
   ⚠️ 只有用户真填了标题才渲染 .note-title —— 没填的卡片外观与升级前一致。 */
.note-card .note-title {
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 6px;
  padding-right: 2px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* ⚠️ 不写 margin-bottom: .drawer-form 是 flex column + gap:18px, 间距已由 gap 给出 ——
   额外 8px 会叠成 26px, 跟其他字段的 18px 对不上 (2026-10-15 清理)。 */
.note-title-field { margin: 0; }
.note-title-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0.5px solid var(--border-control);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 600;
  /* ⚠️ 必须 16px: iOS 上 <16px 的输入框聚焦时会把整页放大 */
  font-size: 16px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.note-title-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ===== v=226: 小记目录树 (层级) + 编辑器目录下拉 =====
   与标签区块并列, 但视觉上要能区分 —— 目录是"归属"(树形缩进 + 计数),
   标签是"标记"(色块 chip)。 */
.notes-side-title .notes-side-add {
  margin-left: auto;
  border: 0.5px solid var(--border-default);
  background: transparent; color: var(--text-secondary);
  width: 20px; height: 20px; border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.notes-side-title .notes-side-add:hover { color: var(--text-primary); border-color: var(--border-hover); }

.note-folder-tree { display: flex; flex-direction: column; gap: 1px; }
.note-folder-row {
  --nf-depth: 0;
  display: flex; align-items: center; gap: 2px;
  /* 缩进用 padding 而不是 margin: 让整行(含悬停底色)一起右移, 一眼看出从属关系 */
  padding: 4px 6px 4px calc(6px + var(--nf-depth) * 13px);
  border-radius: 7px; cursor: pointer;
  font-size: var(--fs-sm); color: var(--text-secondary);
  transition: background .16s var(--ease), color .16s var(--ease);
  /* ⚠️ 以下几条是给「未分类」那一行准备的 —— 它渲染成裸 <button>
     (见 renderNoteFolderTree), 而其他目录行是 <div>。缺了这些就露出浏览器原生按钮样式:
     实测 border 2px outset + 背景 rgb(240,240,240) + font-family 退回 Arial (button 不继承)。
     全局 reset 只清了 margin/padding, **没有清 border**。 */
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
}
.note-folder-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.note-folder-row.active { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.note-folder-row.is-uncat { --nf-depth: 0; }

.nf-caret {
  flex: none; width: 15px; height: 15px; padding: 0;
  border: 0; background: transparent; color: var(--text-tertiary);
  font-size: 10px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s var(--ease);
}
.nf-caret.is-collapsed { transform: rotate(-90deg); }
.nf-caret.is-leaf { cursor: default; }

.nf-name {
  flex: 1; min-width: 0; text-align: left;
  border: 0; background: transparent; color: inherit; font: inherit;
  cursor: pointer; padding: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 目录计数: 永远贴在同一条右边界上。
   ⚠️ 靠的是 DOM 顺序 [名字][操作按钮][计数] —— 按钮在它左边, 所以按钮出现/消失都不会挪动数字。
      原先顺序是 [名字][计数][按钮], "未分类"没按钮 → 计数贴最右, "测试"有按钮 → 计数被挤到左边,
      两行数字不在一个 x 上 (用户反馈"看起来膈应")。
   min-width + text-align:right: 19 和 0 这些不同位数的数字右边缘也对齐。 */
.nf-count {
  flex: none;
  font-size: var(--fs-2xs);
  color: var(--text-muted-label);
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
  min-width: 18px;
  text-align: right;
}

/* 行内操作: 桌面悬停才出, 免得侧栏看起来密密麻麻全是按钮 */
.nf-acts { flex: none; display: flex; gap: 1px; margin-left: 2px; opacity: 0; transition: opacity .16s var(--ease); }
.note-folder-row:hover .nf-acts,
.note-folder-row:focus-within .nf-acts { opacity: 1; }
.nf-act {
  border: 0; background: transparent; color: var(--text-muted-label);
  width: 18px; height: 18px; border-radius: 5px; cursor: pointer;
  font-size: 11px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.nf-act:hover { background: var(--bg-root); color: var(--text-primary); }
.nf-act.is-del:hover { color: #e03131; }

/* 标签 + 目录 并排两列 (2026-10-15)
   每列结构: 控件在上、label 在下 (用户要求), 两列天然对齐。
   ⚠️ 用 grid 而不是两列 flex: 标签输入框 28px 与目录下拉 36px 本来就**不等高**,
      两列 flex 的 label 会差 8px 对不齐; grid 让两列 stretch 等高、label 沉底就齐了。
   窄了自动变一列 —— 靠 auto-fit + minmax, 不用写媒体查询。 */
.note-classify-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 18px;
}
.ncr-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;                    /* 长标签 chip / 长目录名不撑破列 */
}
.ncr-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
}
/* 两列的控件统一到同一尺度 (用户要求"输入框大小和字体一致"):
   标签输入框与 .note-folder-field select 完全对齐。
   2026-10-15 二次调整: 原先统一到 36px/16px 后, 用户反馈"太大、字体也太大" ——
   确实: 编辑器里**正文才 13.6px**, 而这两个辅助字段反而 16px, 主次颠倒了。
   现在降到 **30px / var(--fs-md)=13.5px / radius-sm 6px**, 与正文 textarea 同一套语言。
   ⚠️ 必须限定在 .ncr-col 作用域内: .note-tag-new 还被侧栏「快速标签」复用
      (.note-tag-new-inline, 见 726 行), 全局改会把那个窄栏里的输入框一起撑大。 */
.ncr-col .note-tag-new { align-items: stretch; }   /* 「新建」按钮跟着长到同高, 不矮一截 */
.ncr-col .note-tag-new input {
  height: 30px;
  padding: 0 11px;                       /* 与 select 的 padding-left 一致 */
  border-radius: var(--radius-sm);       /* 6px, 与正文 textarea 一致 */
  font-size: var(--fs-md);
}
.ncr-col .note-tag-new input::placeholder { color: var(--text-muted-label); }

/* v=278: 标签列的标题行 —— 左边「标签」，右边「管理」。
   「管理」刻意做成很小的一行文字按钮：它是低频入口，不该和目录下拉抢视觉重量；
   v=277 那颗占满整行的虚线大框反而像输入框（用户原话"输入框不要"）。 */
.ncr-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;   /* 别用 space-between: 会把「管理」推到列尾,
                                    正好贴着右边那列的「目录」二字, 看着像"管理目录" */
  gap: 7px;
}
.ncr-manage {
  border: 0; background: none; padding: 0 2px;
  font-size: var(--fs-xs); font-family: var(--font-sans);
  color: var(--text-secondary); cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;   /* 平时不划线，悬停才出来 —— 不抢注意力 */
  text-underline-offset: 2px;
  transition: color var(--fast) var(--ease);
}
.ncr-manage:hover { color: var(--text-primary); text-decoration-color: currentColor; }
.ncr-manage:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 3px; }
/* 标签 chips 现在就在标题下面（v=278 从跨行末尾挪回来），
   给它一点上边距，别和「标签 / 管理」那行贴死。 */
.ncr-col-tags .note-tag-picker { margin-top: 2px; min-height: 24px; }

/* 已选标签: 跨两列放最后一行 —— 它高度会变 (0 个到多行 chip),
   放前面会把「控件行 / label 行」顶得参差不齐。 */
.note-classify-row > .note-tag-picker { grid-column: 1 / -1; }

/* 目录下拉的容器: label 已移到 .note-classify-row 里与「标签」并排并置底,
   这里只负责给 select 一个收缩边界。
   ⚠️ 「只写尺寸」: 底色/描边/圆角/自绘箭头全部交给文件开头的通用 select 规则。
      2026-10-15 初版写了 `background: var(--bg-surface)` 简写 —— 简写会把通用规则里的
      `background-image: var(--chevron)` 一起重置, 实测 backgroundImage 变成 none:
      控件退化成"看着像输入框、其实是下拉"的样子 (第 313 行早就警告过这个坑, 又踩了一次)。
      要改底色请用 background-color。 */
.note-folder-field { min-width: 0; }
.note-folder-field select {
  /* ⚠️ width:100% 必须写: 容器 .note-folder-field 已经不再是有 flex 布局的盒子,
     select 失去了 stretch, 只剩内容宽 (实测"未分类"只有 91px, 右边空 124px)。
     padding-right 必须给足 30px 让出箭头位 —— 写了 padding 简写就会盖掉通用规则
     给箭头留的那 30px, 箭头会被文字压住甚至看不见。 */
  width: 100%;
  height: 30px;                  /* 与标签输入框同高 */
  padding: 0 30px 0 11px;
  /* ⚠️ 圆角要显式写: 通用 select 规则给的是 var(--radius)=8px, 不写就跟着它走,
     而标签输入框是 6px —— 两个并排的控件圆角不一致, 一眼能看出来。 */
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);       /* 13.5px, 与正文同一档 */
}

/* ⚠️ 触屏上两个控件都退回 16px / 36px, 两个理由:
   ① iOS 上 <16px 的表单控件一聚焦就把**整页**放大 (这个项目踩过, 见 .note-title-field 的注释);
   ② 手指需要更大的触控目标, 桌面鼠标不需要。
   ⚠️ 这段**必须放在上面两条基础规则之后** —— 同权重靠源码顺序定胜负。
      第一版我把它写在"标签输入框"那块(更靠前), 结果被后面的 .note-folder-field select
      基础规则盖掉, 实测触屏仍是 30px/13.5px。 */
@media (hover: none), (pointer: coarse) {
  .ncr-col .note-tag-new input,
  .note-folder-field select {
    height: 36px;
    font-size: 16px;
  }
}
.note-folder-field select:focus { border-color: var(--border-focus); box-shadow: var(--ring); }

/* 触屏没有 hover: 行内操作常显 (否则重命名/删除永远点不到) */
@media (hover: none) {
  .nf-acts { opacity: 1; }
  .nf-act { width: 26px; height: 26px; font-size: 13px; }
  .note-folder-row { padding-top: 6px; padding-bottom: 6px; }
}


/* ============ v=235 通用取色器 (预设 + SV/色相自定义 + 我的颜色) ============ */
.cp-wrap { display: flex; flex-direction: column; gap: 14px; }
.cp-section { display: flex; flex-direction: column; gap: 6px; }
.cp-label { font-size: .72rem; font-weight: 600; color: var(--text-secondary); letter-spacing: .02em; }
.cp-muted { font-size: .72rem; color: var(--text-tertiary); }
.cp-custom { display: flex; gap: 12px; align-items: stretch; }
.cp-sv {
  /* v=246: 140×110 是扁的 —— 饱和度(横)/亮度(纵)两轴比例 1.27, 拖动手感两轴不一致,
     看着也像被压变形。取色器惯例是正方形。 */
  position: relative; width: 140px; height: 140px; flex-shrink: 0;
  border-radius: 8px; cursor: crosshair; touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(128,128,128,.25);
}
.cp-sv-handle {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.3);
  transform: translate(-50%, 50%); pointer-events: none;
}
/* 右列(色相/hex/按钮)只有 94px 高, 和 140 的色块并排时垂直居中更平衡 */
.cp-sliders { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; justify-content: center; }
.cp-hue {
  /* v=246: 14px 太细 —— 鼠标要瞄准, 手机上基本点不中(手指触点约 40px)。
     18px + 16px 手柄是"能看清也能拖住"的最小值, 再粗会显得笨重。 */
  position: relative; height: 18px; border-radius: 9px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  box-shadow: inset 0 0 0 1px rgba(128,128,128,.25);
}
.cp-hue-handle {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.35);
  transform: translate(-50%, -50%); pointer-events: none;
}
.cp-hexrow { display: flex; align-items: center; gap: 8px; }
.cp-preview {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(128,128,128,.35);
}
.cp-hex-input {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px;
  border: 1px solid var(--border-default); border-radius: 6px;
  background: var(--bg-elevated); color: var(--text-primary);
  font-family: var(--font-mono); font-size: .78rem;
}
.cp-hex-input:focus { outline: none; border-color: var(--accent); }
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-mine { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 30px; }
.cp-mine-item { position: relative; display: inline-flex; }
.cp-mine-item.is-active .cp-mine-swatch { box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--accent); }
.cp-mine-swatch {
  /* v=248: 26px 比色板圆点(34px)小一圈, 并排看着不齐; 放到 30px 折中 */
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(128,128,128,.3); transition: transform .12s;
}
.cp-mine-swatch:hover { transform: scale(1.1); }
.cp-mine-del {
  position: absolute; top: -6px; right: -6px; width: 16px; height: 16px;
  border-radius: 50%; border: none; cursor: pointer; line-height: 1;
  background: var(--bg-elevated); color: var(--text-secondary);
  box-shadow: 0 0 0 1px var(--border-default); font-size: 11px; padding: 0;
  /* v=248: 原来是 display:none + 只在 :hover 出现 —— 触屏上没有 hover,
     等于**永远删不掉**(用户明确要求"点自定义颜色的时候可以删除颜色")。
     改成常显半透明, hover/聚焦时变清晰; 再用 ::after 把热区撑到 32px。 */
  display: block;
  /* 常显就别再半透明了 —— .55 的白底小圆压在深色块上, 用户根本看不出那是个按钮 */
  opacity: 1;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--border-control), 0 1px 2px rgba(0, 0, 0, .18);
  transition: color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.cp-mine-del::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
.cp-mine-item:hover .cp-mine-del,
.cp-mine-del:focus-visible { color: var(--c-danger-text, #e03131); box-shadow: 0 0 0 1px var(--c-danger-text, #e03131); }
.cp-mine-del:hover { color: var(--c-danger-text, #e03131); }
/* promptModal 内嵌的我的颜色/自定义区 */
.cp-modal-mine { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
/* 自定义调色区默认收起 —— SV 方块 + 色相条 + hex 一展开就是 130px 高,
   放在「加个分类」这种 3 秒操作里太占地方。点预设色板末尾的「+」再展开。 */
.cp-custom-section.is-collapsed .cp-custom { display: none; }
/* 做成一颗小胶囊而不是"整行 label + 右端小箭头" —— 后者在浅色弹窗里
   看起来像一行漏排的普通文字, 没人会想到能点。 */
.cp-toggle {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 11px;
  border: 1px dashed var(--border-control); border-radius: 999px;
  background: var(--bg-elevated); color: var(--text-secondary);
  font-family: inherit; font-size: var(--fs-2xs); font-weight: 500;
  letter-spacing: 0; cursor: pointer;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.cp-toggle .cp-toggle-caret { color: currentColor; transition: transform var(--fast) var(--ease); }
.cp-custom-section:not(.is-collapsed) .cp-toggle-caret { transform: rotate(180deg); }
.cp-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }
.cp-toggle:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 4px; }
.cp-mine-row { min-height: 24px; }
.color-swatch.cp-swatch-more {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 14px; font-weight: 600;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong, var(--border-default));
}
.color-swatch.cp-swatch-more:hover { border-color: var(--accent); color: var(--accent); }
/* 书签编辑器内联色条 */
.cp-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cp-inline-dot {
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); transition: transform .12s;
}
.cp-inline-dot:first-child { box-shadow: inset 0 0 0 1px rgba(128,128,128,.5); }
.cp-inline-dot:hover { transform: scale(1.15); }
.cp-inline-dot.is-active { box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--accent); }
.cp-inline-more {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 1px dashed var(--border-strong, var(--border-default));
  background: transparent; color: var(--text-secondary); font-size: 13px; line-height: 1; padding: 0;
}
.cp-inline-more:hover { border-color: var(--accent); color: var(--accent); }
/* 自定义 hex 档位的分类色 (priAttr inline 变量的兜底规则, 保证有底色) */
[data-pri-color="custom"] { /* inline style 已给全五个变量, 这里仅占位防裸奔 */ }
/* ============ v=235 取色器 END ============ */

/* ============ v=235 未读通知右下角弹窗 ============ */
.notif-pop {
  position: fixed; right: 18px; bottom: 18px; z-index: 1200;
  width: min(340px, calc(100vw - 36px));
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.28);
  padding: 12px 14px; cursor: pointer;
  animation: notifPopIn .28s cubic-bezier(.2,.9,.3,1.2);
  transition: opacity .2s, transform .2s;
}
.notif-pop.is-leaving { opacity: 0; transform: translateY(8px); pointer-events: none; }
@keyframes notifPopIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.notif-pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notif-pop-title { font-size: .84rem; font-weight: 600; color: var(--text-primary); flex: 1; }
.notif-pop-badge {
  background: var(--c-danger-text, #e03131); color: #fff;
  font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.notif-pop-close {
  border: none; background: transparent; color: var(--text-tertiary);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 2px;
}
.notif-pop-close:hover { color: var(--text-primary); }
.notif-pop-body { font-size: .78rem; color: var(--text-secondary); line-height: 1.5; }
.notif-pop-body .np-item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-pop-foot { margin-top: 8px; font-size: .7rem; color: var(--text-tertiary); }
@media (max-width: 768px) {
  .notif-pop { right: 10px; left: 10px; bottom: 10px; width: auto; }
}
/* ============ v=235 通知弹窗 END ============ */

/* ============ 小记编辑 · 全屏展开 (v=236 重做) ============
   v=235 的三处硬伤 (用户反馈"改的不对"就是这三条):
     ① .note-editor-body 是 .drawer 的后代, 而 .drawer 带 transform —— transform 会为
        fixed 后代**建立包含块**, 于是 inset:0 只等于抽屉盒子 (实测 479×900, 不是视口)。
     ② 背景写了 var(--bg-base), 这个变量不存在 → 透明, 全屏层后面透出看板。
     ③ 顶部条没 nowrap / flex-shrink, 标题被挤三行, "保存""收起"竖排断字。
   修法: 进全屏时把抽屉 transform 归零 (让 fixed 重新对位视口) + 用真实存在的
   --bg-root + 顶部条定宽不换行 + 内容列限宽 1080px (整屏宽度写字每行 200 字, 反而难读)。 */
body.note-fs-open #task-drawer { transform: none !important; transition: none; overflow: visible; }
body.note-fs-open .drawer-footer { visibility: hidden; }   /* 全屏层自己带保存按钮 */

.note-editor-body.is-fullscreen {
  position: fixed; inset: 0; z-index: 1100;
  height: 100vh;
  background: var(--bg-root);
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px clamp(14px, 4vw, 40px) 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  animation: noteFsIn .16s ease-out;
}
@supports (height: 100dvh) {
  .note-editor-body.is-fullscreen { height: 100dvh; }   /* 手机地址栏收放时不抖 */
}
@keyframes noteFsIn { from { opacity: 0; } to { opacity: 1; } }

/* 内容列: 整屏铺开, 但正文列限宽 (阅读/书写的舒适行长) */
.note-editor-body.is-fullscreen > .note-fs-bar,
.note-editor-body.is-fullscreen > .note-md-bar,
.note-editor-body.is-fullscreen > .note-edit-pane {
  width: 100%; max-width: 1080px; margin-inline: auto;
}

.note-fs-bar {
  display: none; align-items: center; justify-content: space-between;
  gap: 12px; flex: 0 0 auto;
}
.note-editor-body.is-fullscreen .note-fs-bar { display: flex; }
.note-fs-bar .note-fs-title {
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; gap: 6px;
}
.note-fs-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.note-fs-save { font-size: var(--fs-sm); padding: 6px 18px; white-space: nowrap; }
.note-fs-bar .note-expand-btn { white-space: nowrap; }

.note-editor-body.is-fullscreen .note-md-bar { flex: 0 0 auto; }
.note-editor-body.is-fullscreen .note-edit-pane {
  flex: 1 1 auto; display: flex; min-height: 0;
}
.note-editor-body.is-fullscreen .note-edit-pane textarea,
.note-editor-body.is-fullscreen .note-edit-pane .note-edit-rich {
  flex: 1 1 auto; height: auto; min-height: 0; max-height: none; resize: none;
  font-size: .95rem; line-height: 1.75;
}
/* 全屏时底部的「创建/修改」与标签目录行属次要信息, 让位给正文 */
.note-editor-body.is-fullscreen ~ .note-editor-meta,
.note-editor-body.is-fullscreen ~ .note-classify-row { display: none; }

/* v=268: 格式工具栏默认收起（像飞书输入框）。
   只隐藏工具栏本身，正文和标题浮标都不动；类挂在 #note-edit-text 上，
   由 setNoteToolbar() 切换。 */
.note-edit-vditor.is-toolbar-collapsed .vditor-toolbar { display: none; }

/* 「Aa」开关：在「展开」左边，尺寸与「展开」同档，避免两个按钮高低不齐 */
.note-fmt-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border-default); background: var(--bg-elevated);
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; display: inline-flex; align-items: center;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.note-fmt-btn:hover { color: var(--accent); border-color: var(--accent); }
.note-fmt-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.note-fmt-btn.is-on {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-subtle);
}

.note-expand-btn {
  border: 1px solid var(--border-default); background: var(--bg-elevated);
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-size: var(--fs-2xs); padding: 3px 9px; display: inline-flex; align-items: center; gap: 4px;
  transition: color var(--fast), border-color var(--fast);
}
.note-expand-btn:hover { color: var(--accent); border-color: var(--accent); }
.note-expand-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

/* 窄屏: 顶部条只留按钮 (标题省掉), 正文回到 16px 防 iOS 聚焦放大 */
@media (max-width: 640px) {
  .note-editor-body.is-fullscreen { padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .note-editor-body.is-fullscreen .note-fs-bar { justify-content: flex-end; }
  .note-editor-body.is-fullscreen .note-fs-title { display: none; }
  .note-editor-body.is-fullscreen .note-edit-pane textarea,
  .note-editor-body.is-fullscreen .note-edit-pane .note-edit-rich { font-size: 16px; line-height: 1.7; }
  .note-fs-save { padding: 8px 16px; min-height: 40px; }
  .note-editor-body.is-fullscreen .note-expand-btn { min-height: 40px; padding: 0 12px; }
}
/* ============ 全屏展开 END ============ */

/* ============ v=235 小记查看弹窗 ============ */
/* 2026-10-21 放大: 680×70vh 时一条长小记读起来要一直滚, 左右也挤。
   现在 900 宽 + 78vh 高 (卡片自身 max-height:90vh 兜底), 正文行长仍在舒适区。 */
.note-view-modal-body { max-height: min(78vh, 780px); overflow-y: auto; padding-right: 6px; }
.note-view-modal-card { max-width: 900px; width: calc(100vw - 40px); }
/* v=264: 正文排版直接复用卡片那套 .note-text.markdown-body（原来只给 .note-card 用，
   弹窗里一条样式都不匹配 —— 列表没圆点、引用没竖线、加粗也不粗，看着就是"纯文本"）。
   但卡片那套字号是按卡片密度调的，放进 900px 的弹窗里偏小，这里整体放大一档。
   ⚠️ 特异性要和 .note-text.markdown-body X 打平(都是 0,2,1)才能覆盖 ——
   靠写在后面取胜，别把这段挪到文件前面。 */
.note-view-modal-body.note-text { font-size: .92rem; line-height: 1.68; }
.note-view-modal-body.note-text h1 { font-size: 1.34rem; margin: 18px 0 8px; }
.note-view-modal-body.note-text h2 { font-size: 1.18rem; margin: 16px 0 7px; }
.note-view-modal-body.note-text h3 { font-size: 1.03rem; margin: 14px 0 6px; }
.note-view-modal-body.note-text p { margin: 0 0 10px; }
.note-view-modal-body.note-text ul,
.note-view-modal-body.note-text ol { margin: 0 0 10px; padding-left: 24px; }
.note-view-modal-body.note-text li { margin: 3px 0; }
.note-view-modal-body.note-text blockquote { padding: 8px 14px; margin: 0 0 10px; }
.note-view-modal-body.note-text pre { padding: 10px 14px; margin: 0 0 10px; }
.note-view-modal-body.note-text code { font-size: .84rem; }
@media (max-width: 640px) {
  .note-view-modal-body { max-height: 72vh; }
  .note-view-modal-card { width: calc(100vw - 20px); }
}
.note-view-meta { font-size: .7rem; color: var(--text-tertiary); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-default); }
/* 桌面专属: 移动端不显示「查看」按钮 (按需求此模块不适用移动端) */
@media (max-width: 768px) {
  .note-view-btn { display: none !important; }
}
/* ============ v=235 查看弹窗 END ============ */

/* ============ v=235 书签输入框/分类重设计 ============ */
.bm-form-v2 { display: flex; flex-direction: column; gap: 14px; }
.bm-field { display: flex; flex-direction: column; gap: 5px; }
.bm-field-label { font-size: .72rem; font-weight: 600; color: var(--text-secondary); }
.bm-input-wrap { position: relative; display: flex; align-items: center; }
.bm-input-icon {
  position: absolute; left: 10px; display: inline-flex; color: var(--text-tertiary);
  pointer-events: none; transition: color .15s;
}
.bm-input-wrap:focus-within .bm-input-icon { color: var(--accent); }
.bm-input {
  width: 100%; height: 38px; padding: 0 12px 0 32px;
  border: 1px solid var(--border-default); border-radius: 9px;
  background: var(--bg-elevated); color: var(--text-primary); font-size: .84rem;
  transition: border-color .15s, box-shadow .15s;
}
.bm-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.bm-input.bm-input-plain { padding-left: 12px; }
.bm-textarea {
  width: 100%; padding: 8px 12px; min-height: 64px; resize: vertical;
  border: 1px solid var(--border-default); border-radius: 9px;
  background: var(--bg-elevated); color: var(--text-primary); font-size: .84rem; line-height: 1.6;
  transition: border-color .15s, box-shadow .15s;
}
.bm-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.bm-url-hint { font-size: .68rem; color: var(--text-tertiary); min-height: 14px; }
.bm-url-hint.is-ok { color: var(--c-success-text, #2f9e44); }
.bm-url-hint.is-fix { color: var(--c-warn-text, #d97706); }
/* 分类: 已有分类 chip 快选 + 可输入新建 */
.bm-cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bm-cat-chip {
  border: 1px solid var(--border-default); background: var(--bg-elevated);
  color: var(--text-secondary); border-radius: 999px; cursor: pointer;
  font-size: .72rem; padding: 3px 11px; transition: all .13s;
}
.bm-cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.bm-cat-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 管理抽屉: 按分类分组 */
.bm-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 2px 4px; cursor: pointer; user-select: none;
}
.bm-group-head .bm-group-name { font-size: .76rem; font-weight: 700; color: var(--text-primary); }
.bm-group-head .bm-group-count { font-size: .68rem; color: var(--text-tertiary); background: var(--bg-surface); border-radius: 999px; padding: 0 7px; }
.bm-group-head .bm-group-caret { color: var(--text-tertiary); font-size: .68rem; transition: transform .15s; }
.bm-group.is-collapsed .bm-group-caret { transform: rotate(-90deg); }
.bm-group.is-collapsed .bm-group-items { display: none; }
.bm-group-items { display: flex; flex-direction: column; gap: 4px; padding-left: 4px; border-left: 2px solid var(--border-default); margin-left: 6px; }
.bm-manager-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-right: 6px; display: inline-block; }
/* ============ v=235 书签重设计 END ============ */


/* 按钮组贴在工具栏最右（v=268b）。
   原来 auto 边距写在「展开」上 —— 它自己贴右，「Aa」被留在最左，两个按钮隔了整行宽。
   现在 auto 边距挂到第一个按钮上，两个都靠右且相邻。 */
.note-md-bar .note-fmt-btn { margin-left: auto; }
/* 书签管理器分组内的条目沿用原有 item 样式, 只微调间距 */
.bm-group { margin-bottom: 6px; }
.bm-group .bookmark-manager-item { background: transparent; }

/* ============ 重复方式 · 抽屉内联字段 (v=238) ============
   从"保存时弹窗"改成写在「重复」下面的一个字段:
     · 有重复 → 出现 (默认「沿用这条任务」)
     · 切回不重复 → 整块收起, 选择复位
   用 radio 而不是按钮: 这是**提交前的一个字段值**, 不是一个动作 ——
   点一下立刻写库反而没有反悔机会。 */
.recur-mode-block {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 4px; padding: 8px 8px 7px;
  border: 1px solid var(--border-default); border-radius: var(--radius);
  background: var(--bg-elevated);
}
.recur-mode-head {
  font-size: var(--fs-2xs); font-weight: 600; color: var(--text-secondary);
  padding: 0 4px 2px;
}
.recur-mode-opt {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 400;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.recur-mode-opt:hover { background: var(--bg-hover); }
.recur-mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-subtle); }
.recur-mode-opt:has(input:focus-visible) { box-shadow: var(--ring); }
.recur-mode-opt input {
  flex: 0 0 auto; width: 14px; height: 14px; margin: 2px 0 0;
  accent-color: var(--accent); cursor: pointer;
}
.rm-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rm-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.rm-desc { font-size: var(--fs-2xs); color: var(--text-secondary); line-height: 1.45; }
.recur-mode-note {
  margin: 2px 0 0; padding: 0 4px;
  font-size: var(--fs-2xs); color: var(--text-muted-label); line-height: 1.45;
}

/* ===== v=245: 设置 · 最近导入记录 (溯源) =====
   放在「数据」区块的说明文字下面, 最多 4 条 (再多就把设置面板撑长了)。
   ⚠️ 来源用户名是上传包里的内容 → 前端已 escapeHtml, 这里只负责排版。 */
.import-log {
  margin-top: 10px; padding: 9px 11px;
  border: 1px solid var(--border-default); border-radius: var(--radius);
  background: var(--bg-elevated);
}
.import-log-head {
  font-size: var(--fs-2xs); font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px;
}
.import-log-row {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  font-size: var(--fs-2xs); color: var(--text-muted-label); line-height: 1.75;
}
.import-log-time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.il-badge {
  flex: 0 0 auto; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--border-control); background: var(--bg-surface);
  color: var(--text-secondary); line-height: 1.6;
}
.il-badge.is-self { color: var(--accent); border-color: var(--accent); }
.il-badge.is-unknown { border-style: dashed; color: var(--text-muted-label); }
.import-log-body { min-width: 0; }

/* ===== v=246: 窄屏把自定义颜色改成单列 =====
   手机 390px 宽时: 色块 140 + 右列 182, 两个按钮放不下只能竖排,
   色相条只剩 182px 且紧贴色块 —— 又挤又难拖。单列后色相条与色块都吃满宽度。 */
@media (max-width: 560px) {
  .cp-custom { flex-direction: column; gap: 10px; }
  .cp-sv { width: 100%; height: 156px; }
  .cp-sliders { justify-content: flex-start; }
  .cp-actions { flex-wrap: nowrap; }
  .cp-actions > button { flex: 1 1 0; min-width: 0; justify-content: center; }
}

/* v=248: 色板下面那一行「已存的自定义色」—— 原来它是独立的「我的颜色」分区,
   现在并到色板下方。空的时候整行 hidden, 不占位。 */
#cp-mine-row { margin-top: 10px; }

/* ===== v=249: 取色器底部「存为常用 / 删除」 =====
   删除从"色块右上角 16px 小圆"改成正经按钮, 与其它 btn-ghost-sm 同款;
   不可删时(选的是预设色/临时调的颜色)保持禁用态, 一眼能看出为什么点不动。 */
#cp-del-mine:disabled { opacity: .4; cursor: not-allowed; }
#cp-del-mine:not(:disabled):hover {
  color: var(--c-danger-text, #e03131);
  border-color: color-mix(in srgb, var(--c-danger-text, #e03131) 50%, transparent);
  background: color-mix(in srgb, var(--c-danger-text, #e03131) 10%, transparent);
}

/* v=250: 已存色那一行下面紧接「自定义颜色」胶囊, 原来几乎贴在一起
   (色块的高亮圈外扩 4px, 会压到胶囊上沿)。留一格呼吸。
   ⚠️ 用相邻兄弟选择器而不是给 .cp-custom-section 无条件加 margin:
      没有已存色时, 它上面就是色板, 同样需要这段间距, 但两处不能叠加。 */
/* v=251: 「自定义颜色」胶囊与上方色块拉开距离。
   12px 时看着还是黏在一起 —— 色块的高亮圈向外扩 4px, 视觉边界其实到 16px 了。
   现在 20px, 并且**不依赖上面一定是已存色行**: 没有已存色时上面就是色板, 同样需要这段间距
   (用相邻兄弟选择器的话, 隐藏的 #cp-mine-row 仍占着兄弟位, 那条规则永远匹配不到色板)。
   ⚠️ #cp-custom-section 外面还套了一层 .cp-custom-wrap, 间距要写在 wrap 上。 */
.cp-custom-wrap { margin-top: 20px; }

/* ===== v=272 运行报错查看器 =====
   按"发生次数"排序展示前端 JS 报错。这里刻意用等宽字体显示 message：
   报错文本里有大量的 : 和括号，等宽更好扫读。 */
.cerr-summary {
  margin: 0 0 12px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.cerr-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.cerr-item {
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.cerr-head { display: flex; align-items: flex-start; gap: 8px; }
.cerr-msg {
  flex: 1; min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
}
.cerr-hits {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: var(--fs-2xs);
  font-variant-numeric: tabular-nums;
  background: var(--c-danger-bg);
  border: 1px solid var(--c-danger-border);
  color: var(--c-danger-text);
}
.cerr-meta {
  margin-top: 6px;
  font-size: var(--fs-2xs);
  color: var(--text-muted-label);   /* 不用 tertiary：小字对比度不够 */
}
.cerr-stack { margin-top: 8px; }
.cerr-stack summary {
  cursor: pointer;
  font-size: var(--fs-2xs);
  color: var(--text-secondary);
}
.cerr-stack pre {
  margin: 6px 0 0;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}
.cerr-empty { padding: 28px 8px; text-align: center; color: var(--text-secondary); }
.cerr-empty-sub { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-muted-label); }
.cerr-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-default); }

/* ===== v=277 新建标签弹窗 =====
   骨架直接复用 .generic-modal-*（showModal/promptModal 那套），这里只补三样：
   卡片窄一点、七个色点、选中环。
   ⚠️ 色点不写死颜色 —— 靠 .tagc-dot.tag-blue 这类类名从「标签配色」那段取 --tag-c，
      改档位/调色值只改那一处。 */
.tagc-card { max-width: 380px; }
.tagc-colors {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 2px 0 2px;
}
.tagc-dot {
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: var(--tag-c, var(--text-tertiary));
  box-shadow: inset 0 0 0 1px var(--swatch-ring, rgba(0, 0, 0, .08));
  cursor: pointer;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
/* 悬停只抬起、不换色 —— 换色会让"我到底选了哪个"变含混（同 .color-swatch） */
.tagc-dot:hover { transform: translateY(-1px) scale(1.08); }
/* 选中：先一圈卡片底色隔开，再一圈自身颜色 —— 灰点和「取消」按钮挨着时也能看清 */
.tagc-dot.is-on {
  box-shadow: 0 0 0 2px var(--surface-popover, var(--bg-surface)), 0 0 0 4px var(--tag-c, var(--accent));
}
.tagc-dot:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }

/* ===== v=278 标签管理弹窗 =====
   标签列右上角「管理」的落地处：挂/取消 + 删除（仅零引用）+ 新建。
   卡片比新建弹窗宽一点（要放下「标签名 + 使用次数 + 删除」三样）。 */
.tagm-card { max-width: 420px; }
.tagm-hint { margin: 0 0 10px; font-size: var(--fs-xs); color: var(--text-muted-label); }
.tagm-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 46vh; overflow: auto;   /* 标签多的用户要能滚，不能把按钮顶出弹层 */
}
.tagm-row { display: flex; align-items: center; border-radius: var(--radius-sm); }
.tagm-row:hover { background: var(--bg-hover); }
/* 整行可点：chip 本身只有几十像素宽，只让 chip 响应的话手指会点空 */
.tagm-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border: 0; background: none;
  font-family: var(--font-sans); text-align: left; cursor: pointer;
}
.tagm-used { font-size: var(--fs-xs); color: var(--text-muted-label); white-space: nowrap; }
.tagm-row.is-on .tagm-used { color: var(--text-secondary); }
.tagm-del {
  flex: none; width: 28px; height: 28px; margin-right: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-tertiary); cursor: pointer;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.tagm-del:hover { color: #e0614f; background: var(--bg-surface); }
.tagm-del svg { width: 14px; height: 14px; }
.tagm-empty { padding: 16px 4px; font-size: var(--fs-md); color: var(--text-secondary); }

/* ===== v=282 归档 / 回收站：整行可点开详情 =====
   列表本身只有标题级数据（v=281 的 slim），点整行才去拉全量。
   `cursor: default` 是 .archive-item 原本的写法，这里只给「可点」的那种改指针，
   免得把回收站里不可点的空态也一起改掉。 */
.archive-item.is-clickable { cursor: pointer; }
/* 行内按钮仍然独立响应：它们都带了 event.stopPropagation()，
   这里补 hover 高亮，让人一眼看出「这一块能点、那两颗按钮是另一回事」 */
.archive-item.is-clickable:hover .archive-title { color: var(--accent-strong, var(--accent)); }

/* 回收站任务的只读详情（弹窗） */
.trash-detail { display: flex; flex-direction: column; gap: 6px; }
.trash-detail-row { display: flex; gap: 10px; font-size: var(--fs-sm); line-height: 1.6; }
.trash-detail-k { flex: none; width: 3.5em; color: var(--text-muted-label); }
.trash-detail-v { color: var(--text-primary); min-width: 0; word-break: break-word; }
.trash-detail-desc {
  margin-top: 8px; padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  font-size: var(--fs-sm); line-height: 1.7; color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-word;
  max-height: 46vh; overflow: auto;   /* 长描述要能滚，不能把按钮顶出弹层 */
}
.trash-detail-desc.is-empty { color: var(--text-muted-label); font-style: normal; }

/* ================================================================
   v=303 全站按钮防连点 —— 在飞态视觉反馈
   ----------------------------------------------------------------
   由 app.js 尾部的 clickGuard 总闸挂 .is-click-busy。
   范式照抄上面 [data-note-attach].is-busy（同一套转圈，视觉语言统一）。

   ⚠️ 三条注意：
   ① 只用 ::before，不用 ::after —— .color-swatch.is-active::after（打勾）
      与 .cp-mine-del::after（撑 32px 热区）已占用 ::after；
      不过这两类按钮本来就在总闸的放行名单里，不会挂上这个 class。
   ② 用内联 ::before 而不是绝对定位 —— 祖先里 .column / .task-list /
      .generic-modal-body / .sec-modal / .drawer-body 全是 overflow 容器，
      绝对定位的圈会被裁掉一半。
   ③ 不改 innerHTML：showModal 的确认钮自己会写 '<div class="spinner"></div>'，
      再插一个就是两个圈。所以那些按钮在总闸里被完全跳过。
   ================================================================ */
.is-click-busy {
  opacity: .75;
  cursor: progress;
}
.is-click-busy::before {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: click-busy-spin .7s linear infinite;
}
@keyframes click-busy-spin { to { transform: rotate(360deg); } }

/* 纯图标按钮（···、关闭、编辑铅笔等）没有文字，圈后面不该留 5px 空隙，
   否则图标会被挤偏。这几类都是固定宽高的方按钮，圈居中即可。 */
.icon-btn.is-click-busy::before,
.icon-btn-sm.is-click-busy::before,
.task-card-menu-btn.is-click-busy::before,
.note-icon-btn.is-click-busy::before,
.mem-cat-act.is-click-busy::before,
.nf-act.is-click-busy::before {
  margin-right: 0;
}

/* 尊重系统的"减少动态效果"：不转圈，但保留半透明 + progress 光标，
   用户仍然知道"这一下点到了、正在处理"。
   （与 5013 行那条注释同一原则：加载反馈本身不能关，只关动画。） */
@media (prefers-reduced-motion: reduce) {
  .is-click-busy::before { animation: none; }
}
/* ============ v=303 防连点在飞态 END ============ */

/* ============================================================================
   v=317 AI 助手 —— 顶栏开关 + 右侧固定侧栏 (手机全屏抽屉)
   原右下角浮球已撤 (2026-11-24 用户定案): 开关收进顶栏 icon-btn 组。
   桌面: 贴在 topbar(sticky, 48px) 下方的右侧竖栏, 主内容自然让位 (fixed 不占流,
   用 body.has-ai-open 给 .main 加 padding-right 补偿)。
   层级: v=321 改 z-index 50 —— 侧栏是**常驻工作区**, 不是弹层: 必须让位给
   任务抽屉(.drawer 70)/底部多选条(80)/命令面板(90+) 等业务弹窗
   (浮窗时代 1160 的口径盖住了一切, 新建待办抽屉被侧栏压住, 用户实测踩到)。
   手机全屏抽屉单独抬到 85: 压过底部多选条(80), 仍低于命令面板(90)与通知弹层。
   ========================================================================== */
.ai-chat {
  position: fixed; top: 48px; right: 0; bottom: 0; z-index: 50;
  width: min(380px, 42vw);
  display: flex; flex-direction: column;
  background: var(--surface-popover);
  border-left: 1px solid var(--border-default);
  border-top: 1px solid var(--border-default);
  border-radius: 14px 0 0 0;
  box-shadow: -12px 8px 32px rgba(0,0,0,.16);
  overflow: hidden;
  animation: aiSideIn .2s cubic-bezier(.2,.9,.3,1);
}
.ai-chat.hidden { display: none; }
@keyframes aiSideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}
/* 侧栏开着 → 主区右侧让位 (fixed 侧栏不占流, 靠 padding 补偿)。
   ⚠️ 仅桌面 (>640px): 手机全屏抽屉不需要让位, 640 以下直接关掉补偿 */
body.has-ai-open .main { padding-right: calc(min(380px, 42vw) + 12px); }
@media (max-width: 640px) { body.has-ai-open .main { padding-right: 12px; } }
@media (prefers-reduced-motion: reduce) {
  .ai-chat { animation: none; }
}

.ai-chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
  flex: none;
}
.ai-chat-mark { color: var(--accent); display: inline-flex; }
.ai-chat-title { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.ai-head-btn {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
/* v=318: 模型名展示撤掉 → 用 margin 把操作按钮推到右侧 */
.ai-head-first { margin-left: auto; }
.ai-head-btn:hover { background: var(--bg-hover, rgba(127,127,127,.12)); color: var(--text-primary); }
.ai-head-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.ai-chat-body {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain;
}

/* 空态 = 邀请动作 */
.ai-empty { margin: auto; text-align: center; padding: 12px 6px; max-width: 300px; }
.ai-empty-mark { color: var(--accent); opacity: .85; margin-bottom: 8px; }
.ai-empty-title { font-size: .92rem; font-weight: 600; color: var(--text-primary); margin: 0 0 2px; }
.ai-empty-sub { font-size: .74rem; color: var(--text-muted-label, var(--text-secondary)); margin: 0 0 14px; }
.ai-sugs { display: flex; flex-direction: column; gap: 6px; }
.ai-sug {
  border: 1px solid var(--border-default); border-radius: 9px;
  background: var(--surface-card, var(--bg-surface));
  color: var(--text-secondary); font-size: .78rem; line-height: 1.4;
  padding: 8px 12px; cursor: pointer; text-align: left;
}
.ai-sug:hover { border-color: var(--accent); color: var(--text-primary); }
.ai-sug:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 消息气泡: 用户 = 主色实底靠右; AI = 卡片底靠左。错误/配置指引各有语义边 */
.ai-msg { display: flex; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-ai { justify-content: flex-start; }
.ai-bubble {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: .84rem; line-height: 1.6;
  overflow-wrap: break-word; word-break: break-word;
}
.ai-msg-user .ai-bubble {
  background: var(--accent); color: var(--on-accent, #fff);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.ai-msg-ai .ai-bubble {
  background: var(--surface-card, var(--bg-surface));
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.ai-msg-ai.is-error .ai-bubble { border-color: var(--c-danger-text, #e03131); }
.ai-msg-ai.is-setup .ai-bubble { border-color: var(--c-warn-text, #d97706); }
/* AI 回复里的 markdown 元素收着点: 对话不是文档 */
.ai-msg-ai .ai-bubble p { margin: 0 0 6px; }
.ai-msg-ai .ai-bubble p:last-child { margin-bottom: 0; }
.ai-msg-ai .ai-bubble ul, .ai-msg-ai .ai-bubble ol { margin: 4px 0 6px; padding-left: 18px; }
.ai-msg-ai .ai-bubble li { margin: 2px 0; }
.ai-msg-ai .ai-bubble code {
  background: var(--bg-hover, rgba(127,127,127,.14));
  border-radius: 4px; padding: 1px 5px; font-size: .78em;
}
.ai-msg-ai .ai-bubble pre {
  background: var(--bg-hover, rgba(127,127,127,.14));
  border-radius: 8px; padding: 8px 10px; overflow-x: auto; margin: 6px 0;
}
.ai-msg-ai .ai-bubble pre code { background: none; padding: 0; }
.ai-msg-ai .ai-bubble h1, .ai-msg-ai .ai-bubble h2, .ai-msg-ai .ai-bubble h3 {
  font-size: .88rem; margin: 8px 0 4px;
}
.ai-msg-ai .ai-bubble a { color: var(--accent); }
.ai-msg-ai .ai-bubble table { border-collapse: collapse; font-size: .76rem; margin: 6px 0; }
.ai-msg-ai .ai-bubble th, .ai-msg-ai .ai-bubble td { border: 1px solid var(--border-default); padding: 3px 8px; }
.ai-retry {
  display: inline-block; margin-top: 6px;
  border: 1px solid var(--c-danger-text, #e03131); border-radius: 7px;
  background: transparent; color: var(--c-danger-text, #e03131);
  font-size: .74rem; padding: 3px 12px; cursor: pointer;
}
.ai-retry:hover { background: var(--c-danger-text, #e03131); color: #fff; }

/* 生成中: 三个点呼吸 (回应动作的动效, 不是装饰) */
.ai-typing { display: inline-flex; gap: 5px; align-items: center; min-height: 20px; }
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted-label, var(--text-secondary));
  animation: aiDot 1.2s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: .18s; }
.ai-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes aiDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ai-typing span { animation: none; opacity: .6; } }

/* 语音提示条 */
.ai-voice-hint {
  flex: none; padding: 5px 14px;
  font-size: .72rem; color: var(--c-danger-text, #e03131);
  border-top: 1px solid var(--border-default);
}
.ai-voice-hint.hidden { display: none; }

/* 输入区: 16px 输入防 iOS 聚焦放大 (行内控件铁律①) */
.ai-chat-input {
  flex: none; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-default);
}
.ai-input {
  flex: 1; min-width: 0; resize: none;
  font-size: 16px; line-height: 1.45;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface-card, var(--bg-surface));
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 8px 10px;
  max-height: 120px;
}
.ai-input:focus { outline: none; border-color: var(--accent); }
.ai-in-btn {
  flex: none; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--border-default);
  background: var(--surface-card, var(--bg-surface));
  color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ai-in-btn:hover { border-color: var(--accent); color: var(--accent); }
.ai-in-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ai-in-btn.hidden { display: none; }
.ai-send { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.ai-send:hover { background: var(--accent-hover, var(--accent)); color: var(--on-accent, #fff); }
.ai-stop { background: var(--c-danger-text, #e03131); border-color: var(--c-danger-text, #e03131); color: #fff; }
.ai-stop:hover { color: #fff; opacity: .88; }
.ai-voice.is-rec {
  background: var(--c-danger-text, #e03131); border-color: var(--c-danger-text, #e03131); color: #fff;
  animation: aiRecPulse 1.4s infinite;
}
@keyframes aiRecPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,49,49,.4); }
  50% { box-shadow: 0 0 0 7px rgba(224,49,49,0); }
}
@media (prefers-reduced-motion: reduce) { .ai-voice.is-rec { animation: none; } }

/* 手机: 全屏抽屉 (从底滑出); 顶栏开关保持可见, 点它收起 */
@media (max-width: 640px) {
  .ai-chat {
    top: 0; right: 0; left: 0; bottom: 0;
    width: auto;
    z-index: 85;   /* 全屏=弹层语义: 压过多选条(80), 低于 cmdk(90)/通知弹层 */
    border-radius: 0;
    border: none;
    animation: aiDrawerIn .22s cubic-bezier(.2,.9,.3,1);
  }
  @keyframes aiDrawerIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
  }
  .ai-bubble { max-width: 92%; }
}
/* ============ v=314 AI 助手 END ============ */

/* ============ v=315 AI 直接建待办: 「已创建」确认卡片 ============ */
.ai-created { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 88%; }
.ai-created-card {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-left: 3px solid var(--c-success-text, #2f9e44);
  border-radius: 9px; padding: 7px 10px;
  animation: aiCardIn .22s ease;
}
.ai-created-check {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-success-text, #2f9e44); color: #fff;
  font-size: .68rem; display: flex; align-items: center; justify-content: center;
}
.ai-created-title {
  flex: 1; min-width: 0; font-size: .8rem; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* v=319: 类型 chip (小记/倒计时/纪念日/生日) */
.ai-created-type {
  flex: none; font-size: .64rem; line-height: 1;
  padding: 3px 7px; border-radius: 999px;
  background: var(--bg-hover, rgba(127,127,127,.14));
  color: var(--text-secondary);
}
.ai-created-due { flex: none; font-size: .7rem; color: var(--text-muted-label, var(--text-secondary)); }
@keyframes aiCardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ai-created-card { animation: none; } }
@media (max-width: 640px) { .ai-created { max-width: 92%; } }
/* ============ v=315 AI 建待办 END ============ */

/* ============================================================================
   v=326 合规界面 —— 协议页 / 注册勾选 / 补签条 / AI 单独授权卡
   原则: 只用语义色变量 (三层表面 + --c-*), 正文不用 tertiary 弱化色;
        两个决定按钮并排等宽, 拒绝路径一步可达, 不靠颜色单独表意。
   ========================================================================== */
.legal-body {
  min-height: 100vh;
  background: var(--bg-root);
  color: var(--text-primary);
}
.legal-page { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }
.legal-head { padding-bottom: 20px; border-bottom: 1px solid var(--border-default); }
.legal-back {
  display: inline-block; margin-bottom: 20px; font-size: 14px;
  color: var(--text-secondary); text-decoration: none;
}
.legal-back:hover, .legal-page a:hover { color: var(--accent); }
.legal-head h1 { font-size: 28px; font-weight: 600; margin: 0 0 8px; }
.legal-meta { font-size: 14px; color: var(--text-secondary); margin: 0; }
.legal-toc {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  padding: 16px 0; border-bottom: 1px solid var(--border-default);
}
.legal-toc a { font-size: 14px; color: var(--text-secondary); text-decoration: none; }
.legal-toc a:hover { color: var(--accent); text-decoration: underline; }
.legal-page section { padding-top: 28px; scroll-margin-top: 16px; }
.legal-page h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.legal-page p, .legal-page li {
  font-size: 15px; line-height: 1.8; color: var(--text-primary); margin: 0 0 10px;
}
.legal-page ul { padding-left: 22px; margin: 0 0 10px; }
.legal-page strong { font-weight: 600; }
.legal-page a, .legal-links a { color: var(--accent); text-decoration: underline; }
.legal-links { padding-top: 12px; }
.legal-page a:focus-visible, .consent-banner a:focus-visible,
.consent-check a:focus-visible, .ai-consent-note a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* 老用户补签条: 不阻断基础使用, 刷新后仍会出现 (不许默认勾选/不许静默同意) */
.consent-banner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 16px;
  padding: 12px 18px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  font-size: 14px; line-height: 1.6;
}
.consent-banner.hidden { display: none; }
/* 侧栏展开时横幅右半区会被 fixed 侧栏盖住 —— 按钮必须跟着 .main 一起让位,
   否则用户看得到说明却点不到「我已阅读并同意」(v326 截图复核抓到)。 */
body.has-ai-open .consent-banner { padding-right: calc(min(380px, 42vw) + 12px); }
.consent-banner-text { flex: 1 1 320px; min-width: 0; color: var(--text-primary); }
.consent-banner a { color: var(--accent); text-decoration: underline; }
.consent-banner-actions { display: flex; gap: 8px; flex: none; }
.consent-banner-btn {
  min-height: 36px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border-default); background: transparent;
  color: var(--text-primary); font-size: 14px; cursor: pointer;
  transition: transform .2s ease;
}
.consent-banner-btn:hover { transform: scale(1.03); }
.consent-banner-btn:active { transform: scale(.97); }
.consent-banner-btn.is-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff);
}
.consent-banner-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 注册页: 非默认勾选, 整行 label 可点, 16px 控件防 iOS 缩放 */
.consent-check {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 4px 0 14px; font-size: 14px; line-height: 1.6;
  color: var(--text-primary);
}
.consent-check input[type="checkbox"] {
  width: 16px; height: 16px; flex: none; margin: 3px 0 0;
  accent-color: var(--accent); cursor: pointer;
}
.consent-check label { cursor: pointer; }
.consent-check a { color: var(--accent); text-decoration: underline; }
.consent-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 协议链接并入已有那一行, 不新增 flex item —— 多一行会把居中的登录卡片
   顶上去 ~5px, 与右上角 fixed 工具条重叠 (auth/home 几何断言抓到过)。 */
.login-legal-inline {
  display: inline-block; margin-left: 6px; white-space: nowrap;
  font-size: 12px; color: var(--text-secondary);
}
.login-legal-inline a { color: var(--text-secondary); text-decoration: none; }
.login-legal-inline a:hover { color: var(--accent); text-decoration: underline; }

/* AI 侧栏: 生成内容标识 + 单独授权卡 */
.ai-disclaimer {
  flex: none; margin: 0; padding: 5px 12px;
  font-size: 12px; line-height: 1.5; color: var(--text-secondary);
  border-top: 1px solid var(--border-default);
}
.ai-disclaimer.hidden, .ai-chat-input.hidden { display: none; }
.ai-disclaimer a { color: var(--text-secondary); text-decoration: underline; }
.ai-disclaimer a:hover { color: var(--accent); }
.ai-consent-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; margin: 4px 0;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}
.ai-consent-mark { color: var(--accent); display: inline-flex; }
.ai-consent-title { font-size: 16px; font-weight: 600; margin: 0; color: var(--text-primary); }
.ai-consent-lead, .ai-consent-note, .ai-consent-foot {
  font-size: 13px; line-height: 1.7; margin: 0; color: var(--text-primary);
}
.ai-consent-foot { font-size: 12px; color: var(--text-secondary); }
.ai-consent-note a { color: var(--accent); text-decoration: underline; }
.ai-consent-list { margin: 0; padding-left: 20px; }
.ai-consent-list li {
  font-size: 13px; line-height: 1.7; margin: 0 0 6px; color: var(--text-primary);
}
.ai-consent-actions { display: flex; gap: 10px; margin-top: 4px; }
.ai-consent-btn {
  flex: 1; min-height: 40px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border-default); background: transparent;
  color: var(--text-primary); font-size: 14px; cursor: pointer;
  transition: transform .2s ease;
}
.ai-consent-btn:hover { transform: scale(1.02); }
.ai-consent-btn:active { transform: scale(.97); }
.ai-consent-btn.is-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff);
}
.ai-consent-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* v=327 AI 默认关闭: 未拿到名额时侧栏只显示一张说明卡, 设置里的授权开关置灰 */
.ai-locked-card .ai-consent-actions { justify-content: flex-start; }
.ai-locked-card .ai-consent-btn { flex: 0 0 auto; min-width: 96px; }
.settings-ai-locked {
  margin: 10px 0 4px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 12px; line-height: 1.6;
}
.settings-switch.is-locked { opacity: .55; cursor: not-allowed; }
.settings-switch.is-locked input,
.settings-switch.is-locked .settings-switch-track { cursor: not-allowed; }

/* v=328 上线公示: ICP / 公安备案号 + 运营主体 + 投诉入口。
   只用 --text-secondary (正文级对比度), 不靠颜色单独表意(链接有下划线),
   :focus-visible 给键盘用户 2px 轮廓; 窄屏自动换行不横溢。 */
.site-filing {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px 16px; padding: 14px 16px; font-size: 12px; line-height: 1.6;
  color: var(--text-secondary);
}
.site-filing-op { color: var(--text-secondary); }
.site-filing a {
  margin-left: 0; color: var(--text-secondary);
  text-decoration: underline; text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.site-filing a:hover { color: var(--accent); }
.site-filing a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px;
}
/* 登录页: fixed 不占布局流, 避免「多一行把居中卡片顶起 5px」的老坑 */
.login-filing-slot .site-filing {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-root);
}
@media (max-width: 576px) {
  .site-filing { gap: 6px 12px; font-size: 11px; }
}

/* v=329 站内投诉页: 语义化表单 / 16px 输入(防 iOS 缩放) / 焦点可见 /
   错误提示用中性表面+主文字(两主题都可读, 不依赖可能缺失的语义色变量)。 */
.cp-sec { margin-top: 28px; }
.cp-sec h2 { font-size: 1.05rem; margin: 0 0 10px; color: var(--text-primary); }
.cp-lead { margin-bottom: 18px; }
.cp-kind { border: 1px solid var(--border-default); border-radius: 10px; padding: 12px 14px; margin: 0 0 18px; }
.cp-kind legend { padding: 0 6px; font-size: 13px; color: var(--text-secondary); }
.cp-radio { display: inline-flex; align-items: center; gap: 6px; margin: 4px 16px 4px 0; cursor: pointer; font-size: 14px; }
.cp-radio input { width: 16px; height: 16px; margin: 0; }
.cp-label { display: block; margin: 14px 0 6px; font-size: 14px; color: var(--text-primary); }
.cp-input {
  display: block; width: 100%; font-size: 16px; line-height: 1.6;
  padding: 10px 12px; border: 1px solid var(--border-default);
  border-radius: 8px; background: var(--bg-surface); color: var(--text-primary);
}
textarea.cp-input { resize: vertical; min-height: 120px; }
.cp-input:focus-visible, .cp-radio input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.cp-hint { font-size: 12px; color: var(--text-secondary); margin: 6px 0 0; }
.cp-msg {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--bg-surface); color: var(--text-primary); font-size: 13px;
}
.cp-msg.hidden, .cp-receipt.hidden { display: none; }
.cp-submit {
  margin-top: 18px; min-height: 40px; padding: 10px 22px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--on-accent, #fff); font-size: 14px; cursor: pointer;
}
.cp-submit:hover { filter: brightness(1.05); }
.cp-submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-submit:disabled { opacity: .55; cursor: not-allowed; }
.cp-receipt { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: var(--bg-surface); }
.cp-receipt code { font-size: 13px; }
.cp-item { padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.cp-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cp-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg-surface); color: var(--text-secondary); }
.cp-item-kind { font-size: 12px; color: var(--text-secondary); margin: 4px 0; }
.cp-item-body { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 576px) {
  .cp-radio { display: flex; margin-right: 0; }
  .cp-kind { padding: 10px; }
}

@media (max-width: 640px) {
  /* 手机是**全屏**抽屉, 横幅整个在抽屉后面, 不需要让位补偿 */
  body.has-ai-open .consent-banner { padding-right: 18px; }
  .consent-banner { flex-direction: column; align-items: stretch; }
  .consent-banner-actions { justify-content: stretch; }
  .consent-banner-btn { flex: 1; }
  .ai-consent-card { padding: 16px; }
  .ai-consent-actions { flex-direction: column; }
  .legal-page { padding: 28px 16px 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .consent-banner-btn, .ai-consent-btn { transition: none; }
}
