  :root {
    /* ============ 基础色板：中性灰 + 单一强调色 ============ */
    --bg:           #f6f8fb;
    --bg-grad:      radial-gradient(ellipse at top left, #eef2ff 0%, #f6f8fb 50%, #f6f8fb 100%);
    --panel:        #ffffff;
    --panel-soft:   #fafbfc;
    --text:         #0f172a;
    --text-2:       #334155;
    --muted:        #64748b;
    --muted-2:      #94a3b8;
    --border:       #e2e8f0;
    --border-soft:  #eef2f7;
    --accent:       #4f46e5;
    --accent-2:     #6366f1;
    --accent-soft:  #eef2ff;
    --accent-ring:  rgba(79, 70, 229, .18);
    --danger:       #dc2626;
    --warn:         #f59e0b;
    --success:      #10b981;

    /* ============ 项目色循环（6 色） ============ */
    --p-1: #6366f1;   /* indigo */
    --p-2: #06b6d4;   /* cyan   */
    --p-3: #f59e0b;   /* amber  */
    --p-4: #10b981;   /* emerald*/
    --p-5: #ec4899;   /* pink   */
    --p-6: #8b5cf6;   /* violet */

    /* ============ 间距梯度（4 倍数） ============ */
    --s-1:  4px;
    --s-2:  8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;

    /* ============ 圆角 ============ */
    --r-sm:  6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-pill: 999px;

    /* ============ 阴影层级 ============ */
    --sh-1: 0 1px 2px rgba(15, 23, 42, .04);
    --sh-2: 0 2px 8px rgba(15, 23, 42, .06);
    --sh-3: 0 8px 24px rgba(15, 23, 42, .08);
    --sh-4: 0 16px 48px rgba(15, 23, 42, .12);

    /* ============ 字体梯度 ============ */
    --ff: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --ff-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --fs-xs: 11.5px;
    --fs-sm: 12.5px;
    --fs-md: 14px;
    --fs-lg: 15px;
    --fs-xl: 17px;
    --fs-2xl: 20px;
    --fs-3xl: 24px;
    --lh-tight: 1.3;
    --lh-base:  1.5;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: var(--ff);
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text);
    font-size: var(--fs-md);
    line-height: var(--lh-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  .wrap { width: auto; max-width: calc(100vw - 32px); margin: 0 auto; padding: var(--s-6);
    overflow-x: auto; }   /* 取消固定 width：表格按内容自然撑开后，wrap 跟着表格走，
                              但不超过视窗（-32px 留滚动条空位）；视窗 < 表格总宽时 wrap 自身横滚 */

  /* ---------- 登录页 ---------- */
  .login-card {
    max-width: 420px; margin: 12vh auto; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-8);
    box-shadow: var(--sh-3);
  }
  .login-card h1 { font-size: var(--fs-2xl); margin: 0 0 var(--s-2); letter-spacing: -.01em; }
  .login-card p.sub { color: var(--muted); margin: 0 0 var(--s-6); font-size: var(--fs-sm); }
  label.field { display: block; margin-bottom: var(--s-4); }
  label.field > span { display: block; margin-bottom: var(--s-2); font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
  label.field .required { color: #dc2626; margin-left: 4px; font-weight: 700; }
  label.field input:required:invalid:not(:placeholder-shown) { border-color: #fca5a5; }
  input[type=text], input[type=password], select {
    width: 100%; padding: 10px var(--s-3); border: 1px solid var(--border);
    border-radius: var(--r-md); font-size: var(--fs-md); background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
  }
  input:focus, select:focus { outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring); }
  button {
    cursor: pointer; border: none; border-radius: var(--r-md); font-size: var(--fs-md);
    padding: 10px var(--s-4); background: var(--accent); color: #fff; font-weight: 600;
    transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 1px 2px rgba(79,70,229,.18);
  }
  button:hover { background: var(--accent-2); }
  button:active { transform: translateY(1px); }
  button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
  .btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); box-shadow: none; font-weight: 500; }
  .btn-ghost:hover { background: var(--panel-soft); color: var(--text); border-color: var(--muted-2); }
  .alert { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca;
    border-radius: var(--r-md); padding: var(--s-3); margin-bottom: var(--s-4); font-size: var(--fs-sm); }

  /* ---------- 看板：顶栏 ---------- */
  .topbar {
    display: flex; align-items: center; gap: var(--s-3);
    margin-bottom: var(--s-5);
    padding: var(--s-3) var(--s-4);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
  }
  .topbar .brand {
    display: flex; align-items: center; gap: var(--s-3);
    flex: 1; min-width: 0;
  }
  .topbar .brand-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 16px;
    box-shadow: 0 4px 10px rgba(79,70,229,.25);
    flex-shrink: 0;
  }
  .topbar .brand-name {
    display: flex; flex-direction: column; min-width: 0;
  }
  .topbar .brand-name .title {
    font-size: var(--fs-lg); font-weight: 700; color: var(--text); letter-spacing: -.01em;
    line-height: 1.2;
  }
  .topbar .brand-name .sub {
    font-size: var(--fs-xs); color: var(--muted); line-height: 1.3; margin-top: 2px;
  }
  .topbar .account {
    display: flex; align-items: center; gap: var(--s-2);
    padding: 6px var(--s-2) 6px 4px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-size: var(--fs-sm); color: var(--text-2);
  }
  .topbar .account .av {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 12px;
    flex-shrink: 0;
  }
  .topbar .account .av.guest {
    background: linear-gradient(135deg, var(--muted-2) 0%, var(--muted) 100%);
  }
  .topbar .account .who {
    display: flex; flex-direction: column; line-height: 1.15;
    max-width: 220px; overflow: hidden;
  }
  .topbar .account .who .label {
    font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  }
  .topbar .account .who .val {
    font-size: var(--fs-sm); color: var(--text); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
  }
  .topbar .icon-btn {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent;
    color: var(--muted);
    border-radius: var(--r-md);
    padding: 0;
    box-shadow: none;
    font-weight: 400;
  }
  .topbar .icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
  .topbar .icon-btn svg { width: 18px; height: 18px; }

  /* ---------- 工具栏（三段卡片式：左筛选 / 中搜索 / 右操作） ---------- */
  .toolbar {
    display: flex; align-items: center; gap: var(--s-2);
    margin-bottom: var(--s-4);
    flex-wrap: wrap; row-gap: var(--s-2);
  }
  .tb-card {
    display: flex; align-items: center; gap: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 5px 8px;
    box-shadow: var(--sh-1);
  }
  .tb-filters { flex: 0 0 auto; flex-wrap: wrap; row-gap: 6px; }
  .tb-search  { flex: 1 1 320px; min-width: 220px; }
  .tb-actions { flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 4px; row-gap: 6px; }
  /* 中窄屏（≤1600）：操作组落入第二行时占满整行并左对齐，
     避免「右侧空、左侧重」的失衡；宽屏（>1600）则三段同行。
     实测三段（筛选/搜索/操作）总宽约 1900px，1366-1600 的视口放不下，
     断点取 1600 才与「宽屏同行」的实际行为一致。 */
  @media (max-width: 1600px) {
    .tb-actions { flex: 1 1 100%; justify-content: flex-start; }
  }

  /* 组内字段标签：始终横排，不被拆成竖向单字 */
  .tb-group-label {
    font-size: var(--fs-xs); color: var(--muted); font-weight: 600;
    white-space: nowrap; flex-shrink: 0; margin-right: 2px;
  }
  .tb-sep {
    width: 1px; height: 20px; background: var(--border);
    margin: 0 2px; flex-shrink: 0;
  }
  /* 搜索下拉：不再被 content 强行撑宽，给一个可控最小宽度 */
  .toolbar .search-select { flex-shrink: 1; min-width: 150px; }
  .toolbar select { flex-shrink: 0; }
  .toolbar select, .toolbar .search-select input {
    width: auto; padding: 6px var(--s-3);
    border: 1px solid transparent; background: transparent;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm); color: var(--text); cursor: pointer;
    transition: background .15s, border-color .15s;
  }
  .toolbar select:hover, .toolbar .search-select input:hover { background: var(--panel-soft); }
  .group-tree-picker { position: relative; flex-shrink: 0; }
  .group-tree-trigger {
    display: inline-flex; align-items: center; gap: 8px; min-width: 150px; max-width: 220px;
    padding: 6px var(--s-3); background: transparent; color: var(--text); box-shadow: none;
    border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500;
  }
  .group-tree-trigger:hover, .group-tree-trigger[aria-expanded="true"] { background: var(--panel-soft); color: var(--text); }
  .group-tree-trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .group-tree-trigger-caret { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: auto; }
  .group-tree-menu {
    position: fixed; min-width: 300px; max-width: min(420px, calc(100vw - 24px)); max-height: min(520px, calc(100vh - 100px));
    overflow: auto; padding: 6px; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--sh-3); z-index: 2000;
  }
  .group-tree-node { display: flex; align-items: center; min-height: 34px; }
  .tree-toggle, .tree-toggle-placeholder { flex: 0 0 28px; width: 28px; height: 28px; padding: 0; background: transparent; color: var(--muted); box-shadow: none; border-radius: var(--r-sm); }
  .tree-toggle:hover { background: var(--accent-soft); color: var(--accent); }
  .tree-toggle span { display: block; width: 7px; height: 7px; margin: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
  .tree-toggle.expanded span { transform: rotate(45deg) translate(-1px, -1px); }
  .tree-group-select, .group-tree-project, .group-tree-all { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 6px 8px; background: transparent; color: var(--text-2); box-shadow: none; border-radius: var(--r-sm); font-weight: 500; text-align: left; }
  .tree-group-select:hover, .group-tree-project:hover, .group-tree-all:hover { background: var(--accent-soft); color: var(--accent); }
  .group-tree-node.selected .tree-group-select, .group-tree-all.selected { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
  .tree-folder { position: relative; width: 16px; height: 12px; flex: 0 0 16px; border-radius: 2px; background: #d7dee9; }
  .tree-folder::before { content: ""; position: absolute; left: 1px; top: -3px; width: 7px; height: 4px; border-radius: 2px 2px 0 0; background: #d7dee9; }
  .tree-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tree-group-count, .group-tree-all > span:last-child { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
  .group-tree-project { margin-left: 28px; width: calc(100% - 28px); font-weight: 400; }
  .tree-project-icon { width: 16px; height: 12px; flex: 0 0 16px; border-radius: 2px; background: #2f8bd8; position: relative; }
  .tree-project-icon::before { content: ""; position: absolute; left: 4px; top: -3px; width: 8px; height: 4px; border: 2px solid #2f8bd8; border-bottom: 0; border-radius: 2px 2px 0 0; }
  /* 中段搜索卡片：独占一整段，吸纳所有剩余横向空间。
     关键：必须覆盖 base `.chip-search { max-width:420px; display:inline-flex; min-width:240px }` 的尺寸锁，
     否则搜索盒在 1280-1366 视口下会被卡死成 420，右侧残留 280+px 空白。 */
  .tb-card.tb-search .chip-search {
    display: flex;
    flex: 1 1 0%;
    min-width: 0;
    max-width: none;
    width: 100%;
    background: var(--panel-soft);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    margin-left: 0;
  }
  .tb-search .chip-search:focus-within {
    background: #fff; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
  }
  .toolbar .pill-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px var(--s-3);
    background: transparent;
    color: var(--text-2); font-weight: 500;
    border-radius: var(--r-sm);
    border: none;
    box-shadow: none;
    font-size: var(--fs-sm);
    transition: background .15s, color .15s;
  }
  .toolbar .pill-btn:hover { background: var(--accent-soft); color: var(--accent); }
  .toolbar .pill-btn svg { width: 15px; height: 15px; }
  .toolbar .pill-btn.primary {
    background: var(--accent); color: #fff;
    box-shadow: 0 1px 2px rgba(79,70,229,.18);
  }
  .toolbar .pill-btn.primary:hover { background: var(--accent-2); color: #fff; }
  .toolbar .pill-btn.active {
    background: var(--accent-soft); color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
  }
  /* 导出进度浮层 */
  .export-progress {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15, 18, 28, .45);
  }
  .export-progress.hidden { display: none; }
  .ep-card {
    width: 340px; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 22px 22px 19px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  }
  .ep-title { font-weight: 600; font-size: 15px; color: var(--text-2); margin-bottom: 14px; }
  .ep-bar {
    height: 8px; border-radius: 99px; background: var(--accent-soft);
    overflow: hidden;
  }
  .ep-fill {
    height: 100%; width: 0%; background: var(--accent);
    border-radius: 99px; transition: width .35s ease;
  }
  .ep-status { margin-top: 11px; font-size: 13px; color: var(--text-2); min-height: 18px; }
  .ep-meta { margin-top: 4px; font-size: 12px; color: #94a3b8; }
  .ep-cancel { display: block; margin: 16px 0 0 auto; padding: 6px 12px; border: 1px solid var(--border);
    border-radius: var(--r-sm); background: #fff; color: var(--text-2); cursor: pointer; font-size: 13px; }
  .ep-cancel:hover { background: #f8fafc; color: var(--danger); border-color: #fecaca; }
  /* 导出开关：仅任务 / 含评论 分段控件 */
  .toolbar .export-switch {
    display: inline-flex; border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden;
  }
  .toolbar .export-mode-label {
    margin-left: 4px; color: var(--muted); font-size: var(--fs-xs);
    font-weight: 600; white-space: nowrap;
  }
  .toolbar .export-switch .seg {
    border: none; background: var(--panel); color: #64748b;
    padding: 6px 11px; cursor: pointer; font-size: 13px; line-height: 1.2;
  }
  .toolbar .export-switch .seg:hover { background: var(--accent-soft); }
  .toolbar .export-switch .seg.active {
    background: var(--accent-soft); color: var(--accent); font-weight: 600;
  }
  .toolbar .pill-btn.primary:disabled { opacity: .6; cursor: default; }
  /* 「延期任务」按钮 badge 探测中态：文字色变弱 + 一个跳动的省略号点 */
  #overdueBtnLabel.scanning {
    color: var(--muted);
    position: relative;
    padding-left: 14px;
  }
  #overdueBtnLabel.scanning::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    width: 6px; height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: var(--accent);
    animation: badge-dot 0.9s ease-in-out infinite;
  }
  @keyframes badge-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%      { opacity: 1;   transform: scale(1.2); }
  }

  /* 搜索式项目选择器 */
  .search-select { position: relative; display: inline-block; min-width: 180px; }
  .search-select input {
    width: 100%; padding: 6px 28px 6px var(--s-3); border: 1px solid transparent;
    border-radius: var(--r-sm); font-size: var(--fs-sm); background: transparent;
    color: var(--text); cursor: pointer; font-weight: 500;
    transition: background .15s;
  }
  .search-select input:hover { background: var(--panel-soft); }
  .search-select input:focus { outline: none; background: #fff;
    box-shadow: 0 0 0 3px var(--accent-ring); }
  .search-select .caret {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    pointer-events: none; color: var(--muted); font-size: 11px;
  }
  /* 通用搜索式下拉（项目选择器 / 任务名候选） */
  .search-select-menu {
    position: fixed; min-width: 260px; max-height: 320px;
    overflow-y: auto; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--sh-3);
    z-index: 2000;
  }
  .search-select-menu .menu-title {
    padding: 8px 12px; font-size: var(--fs-xs); color: var(--muted);
    background: var(--panel-soft); border-bottom: 1px solid var(--border-soft);
    border-radius: var(--r-md) var(--r-md) 0 0;
    display: flex; align-items: center; gap: 6px;
    text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
  }
  .search-select-menu .menu-title .dot {
    width: 7px; height: 7px; background: var(--accent); border-radius: 50%;
    display: inline-block;
  }
  .search-select-menu .opt {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; font-size: var(--fs-sm); color: var(--text);
    border-bottom: 1px solid var(--border-soft);
    transition: background .1s;
  }
  .search-select-menu .opt:last-child { border-bottom: none; }
  .search-select-menu .opt:hover,
  .search-select-menu .opt.highlighted { background: var(--accent-soft); }
  .search-select-menu .opt.selected { font-weight: 600; color: var(--accent); }
  .search-select-menu .opt input[type="checkbox"] { margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
  .search-select-menu .opt .hl {
    background: #fff3a0; color: #333; border-radius: 2px; padding: 0 1px;
  }
  .search-select-menu .opt-meta { font-size: var(--fs-xs); color: var(--muted); margin-left: 6px; }
  .search-select-menu .opt-empty {
    padding: var(--s-4); color: var(--muted); text-align: center; font-size: var(--fs-sm);
  }
  .search-select-menu .menu-hint {
    padding: 6px 12px; font-size: var(--fs-xs); color: var(--muted);
    background: var(--panel-soft); border-top: 1px solid var(--border-soft);
    border-radius: 0 0 var(--r-md) var(--r-md); text-align: center;
  }

  /* 任务名称模糊搜索框 */
  .chip-search {
    position: relative; display: inline-flex; flex-wrap: wrap; align-items: center;
    gap: 6px; min-width: 240px; max-width: 420px;
    padding: 4px var(--s-2); border: 1px solid transparent; border-radius: var(--r-md);
    background: var(--panel-soft); color: var(--text);
    transition: background .15s, border-color .15s, box-shadow .15s;
  }
  .chip-search:focus-within {
    background: #fff; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
  }
  .chip-area { display: contents; }   /* 让 chip 直接参与父容器 flex 排列 */
  .chip {
    display: inline-flex; align-items: center; gap: 4px; max-width: 220px;
    padding: 3px 4px 3px 8px; background: var(--accent-soft);
    border: 1px solid #bfdbfe; border-radius: 14px;
    font-size: 12.5px; color: #1e40af; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .chip .chip-meta {
    color: #64748b; margin-right: 2px; max-width: 80px;
    overflow: hidden; text-overflow: ellipsis;
  }
  .chip .chip-close {
    border: none; background: transparent; color: #475569;
    width: 18px; height: 18px; line-height: 16px; text-align: center;
    border-radius: 50%; padding: 0; font-size: 14px; cursor: pointer;
  }
  .chip .chip-close:hover { background: rgba(0,0,0,.08); }
  .chip-search .search-input { position: relative; display: inline-flex; align-items: center; flex: 1; min-width: 160px; }
  .chip-search .search-input input {
    flex: 1; min-width: 140px; padding: 4px 26px 4px 6px;
    border: none; outline: none; background: transparent;
    font-size: 14px; color: var(--text);
  }
  .chip-search .search-clear {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; line-height: 16px; text-align: center;
    border: none; background: #e5e7eb; color: #475569; border-radius: 50%;
    font-size: 14px; padding: 0; cursor: pointer; display: none;
  }
  .chip-search .search-clear:hover { background: #d1d5db; }
  .chip-search.has-value .search-clear { display: block; }
  .chip-search .search-go {
    padding: 5px 12px; font-size: 13px; line-height: 1;
  }
  .chip-hint {
    flex-basis: 100%; padding: 0 2px; font-size: 11.5px; color: var(--muted);
    line-height: 1.5;
  }
  .chip-hint kbd {
    display: inline-block; padding: 1px 5px; border-radius: 3px;
    border: 1px solid #e2e8f0; background: #f1f5f9; font-size: 10.5px;
    color: #475569;
  }

  /* 任务名称命中关键词高亮 */
  td.cell-title .hl {
    background: #fff3a0; color: #333; border-radius: 2px; padding: 0 1px;
  }
  .search-banner {
    margin-bottom: 12px; padding: 9px 14px;
    background: var(--accent-soft); border: 1px solid #bfdbfe;
    border-radius: 8px; font-size: 13px; color: #1e40af;
  }
  .search-banner b { color: #1d4ed8; }

  table { width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--panel); border-radius: var(--r-lg); }
  /* 项目卡片内的表格：table-layout:auto + 每列 min-width，由浏览器完成列宽分配。
     - 容器够宽时表格 width:100% 撑满，剩余空间由浏览器按内容权重分配；
     - 容器不够宽时表格按各列内容/最小宽之和溢出，由 #tableArea 的 overflow:auto 横滚，
       且每一列都保持可读宽度（不会被压扁成省略号）。
     - 旧方案（JS 测量内容写死 col 宽 + 表格定宽到列宽和）已移除：在 nowrap+ellipsis 的
       单元格上 Range 只能测到「被截断后的宽度」，首次测量偏小后自我锁定，
       实测所有自适应列塌缩到 60px 最小值（任务名称/时间列严重截断）。 */
  table.proj-table { width: 100%; table-layout: auto; }
  table.proj-table th, table.proj-table td {
    overflow-wrap: anywhere; word-break: break-word;
  }
  /* 表头与短内容列不换行；列宽由内容 + min-width 决定 */
  table.proj-table th { white-space: nowrap; }
  table.proj-table td.cell-id,
  table.proj-table td.cell-status,
  table.proj-table td.cell-start,
  table.proj-table td.cell-due,
  table.proj-table td.cell-overdue,
  table.proj-table td.cell-owner,
  table.proj-table td.cell-updated { white-space: nowrap; }
  /* 各列最小宽（托底值；行内内容自然撑宽） */
  table.proj-table td.cell-id      { min-width: 72px; }
  table.proj-table td.cell-status,
  table.proj-table td.cell-overdue { min-width: 72px; }
  table.proj-table td.cell-start,
  table.proj-table td.cell-due,
  table.proj-table td.cell-updated { min-width: 118px; }  /* 短格式 "08-20 19:45" 可完整显示 */
  table.proj-table td.cell-owner   { min-width: 96px; }
  /* 任务名称列：允许自然换行（长标题折行而不是截断），hover 由 a 的 title 显示全名。
     min/max 控制列的伸缩区间；overflow-wrap:anywhere 让无空格长串也能断行。 */
  table.proj-table td.cell-title {
    min-width: 200px;
    max-width: 380px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
    vertical-align: middle;
  }
  /* 描述列：长文本自然换行（与 title 同策略）。
     次级文字色弱化视觉权重；hover 时 td 的 title 属性显示完整文本。 */
  table.proj-table td.cell-desc {
    min-width: 160px;
    max-width: 360px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.5;
    vertical-align: middle;
    color: var(--text-2, #64748b);
  }
  table.proj-table td.cell-desc .desc-text { display: inline; }
  /* 描述里的图片：小缩略图行（点击放大走 lightbox） */
  table.proj-table td.cell-desc .desc-imgs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
  }
  table.proj-table td.cell-desc .desc-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line-2, #e2e8f0);
    cursor: zoom-in;
    transition: transform .12s ease, box-shadow .12s ease;
    background: var(--bg-1, #f8fafc);
  }
  table.proj-table td.cell-desc .desc-img:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
  }
  /* 状态徽章：未开始（灰）/ 进行中（蓝）/ 已完成（绿）/ 已取消（淡灰红）
     Worktile 自定义状态名优先；下面用 key 做硬编码兜底（中文名匹配）。 */
  table.proj-table td.cell-status {
    white-space: nowrap;
    vertical-align: middle;
  }
  table.proj-table td.cell-status .status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.4;
    font-weight: 500;
    background: var(--bg-1, #f1f5f9);
    color: var(--text-2, #64748b);
    border: 1px solid var(--line-2, #e2e8f0);
  }
  table.proj-table td.cell-status .status-badge.is-pending {   /* 未开始 */
    color: #64748b; background: #f1f5f9; border-color: #e2e8f0;
  }
  table.proj-table td.cell-status .status-badge.is-progress { /* 进行中 */
    color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe;
  }
  table.proj-table td.cell-status .status-badge.is-done {     /* 已完成 */
    color: #047857; background: #d1fae5; border-color: #a7f3d0;
  }
  table.proj-table td.cell-status .status-badge.is-cancel {   /* 已取消 / 关 */
    color: #9f1239; background: #ffe4e6; border-color: #fecdd3;
  }
  /* 开始时间：与截止时间同样的紧凑日期格式 */
  table.proj-table td.cell-start {
    white-space: nowrap;
    vertical-align: middle;
    color: var(--text-2, #64748b);
    font-variant-numeric: tabular-nums;
  }
  /* 任务负责人（窄列下不拆字符 + 截断省略号）。
     updated 列单独走两行渲染（日期 + 时间各一段），不在这里命中。
     命中规则必须用 .cell-* class，不能用 nth-last-child(-n+2)，否则列序变动时会误伤其他列。 */
  table.proj-table td.cell-owner,
  table.proj-table th.cell-owner {
    overflow-wrap: normal; word-break: normal;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* updated 列允许换行（窄列下日期/时间拆两行显示），不再 nowrap+ellipsis */
  table.proj-table td.cell-updated,
  table.proj-table th.cell-updated {
    white-space: normal;
  }
  /* 截止时间列：复用 updated-time 等宽数字样式，允许换行 */
  table.proj-table td.cell-due {
    color: var(--muted); font-size: var(--fs-xs); white-space: normal;
  }
  table.proj-table td.cell-due .updated-time { font-variant-numeric: tabular-nums; }
  /* 逾期天数：按严重程度分级配色（<=3 天浅 / 3~7 天中 / >=7 天深红） */
  table.proj-table td.cell-overdue {
    text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  table.proj-table td.cell-overdue .overdue-num { font-weight: 700; font-size: 14px; }
  table.proj-table td.cell-overdue .overdue-unit { font-size: 11px; color: var(--muted); margin-left: 1px; }
  table.proj-table td.cell-overdue.sev-low  .overdue-num { color: #b45309; }
  table.proj-table td.cell-overdue.sev-mid  .overdue-num { color: #ea580c; }
  table.proj-table td.cell-overdue.sev-high .overdue-num { color: #dc2626; }
  /* 右端点（最后一列）只在视觉上贴右，不再贴粗边、硬色块 —— 用柔和的内边距 + 极淡
     左边线 + 文字右对齐，告诉用户这是右端点，但更克制 */
  table.proj-table thead th:last-child {
    position: relative;
  }
  table.proj-table thead th:last-child::after {
    content: "";
    position: absolute; left: 0; top: 18%; bottom: 18%;
    width: 1px; background: var(--border);
  }
  table.proj-table th[data-endanchor] {
    text-align: right;
    padding-right: var(--s-4);
  }
  table.proj-table td:last-child {
    text-align: right;
    padding-right: var(--s-4);
  }
  /* 评论列：内容可能很长（多评论+图片），让列内独立横向滚动，不再撑宽整表 */
  table.proj-table td.cell-comments {
    max-width: 600px;
    overflow: hidden;             /* cell 不撑列，列宽只由 colgroup 决定 */
  }
  table.proj-table td.cell-comments .comments-inner {
    max-width: 100%;              /* 不超过 cell 宽 */
    overflow-x: auto;             /* 长评论/长附件在 cell 内独立横向滚动 */
    overflow-y: visible;
  }
  /* 评论列的表头：防止"评论"两字被换行 */
  table.proj-table thead th.cell-comments {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 表头：作为 resizer 绝对定位的参考系 */
  table.proj-table thead th { position: relative; }
  /* 列宽调节手柄：悬停在 th 右侧边缘 */
  table.proj-table .col-resizer {
    position: absolute; top: 0; right: -3px;
    width: 8px; height: 100%; cursor: col-resize;
    z-index: 3; user-select: none;
  }
  table.proj-table .col-resizer::after {
    content: ""; position: absolute; top: 25%; bottom: 25%; left: 3px;
    width: 2px; background: transparent; border-radius: 2px;
    transition: background 0.15s;
  }
  table.proj-table .col-resizer:hover::after,
  table.proj-table .col-resizer.dragging::after { background: var(--accent); }
  /* 拖拽列宽时全局禁用文字选择、强制手型光标 */
  body.col-resizing, body.col-resizing * {
    cursor: col-resize !important; user-select: none !important;
  }
  /* ============ th/td 基础节奏 ============ */
  th, td {
    text-align: left; padding: 14px var(--s-4);
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
  }
  th {
    background: linear-gradient(180deg, #fafbfd 0%, #f6f8fb 100%);
    font-weight: 600; color: var(--text-2);
    font-size: var(--fs-xs);
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
  }
  tbody tr.task-row { transition: background .12s; }
  tbody tr.task-row:hover { background: var(--accent-soft); }
  tbody tr.task-row td { color: var(--text); font-size: var(--fs-sm); }
  /* ============ 项目分组卡片 ============ */
  .proj-block {
    margin-bottom: var(--s-4);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    /* 滚动统一交给 #tableArea（overflow:auto）：
       1) .proj-block 自身不能是滚动容器，否则 position:sticky 的表头会相对
          它（不垂直滚动的盒子）吸附而失效 —— 这是此前吸顶表头做不了的根因；
       2) fit-content + min-width 让卡片边框贴合超宽表格（横滚时边框跟随内容，
          不会停在半途），同时窄内容时仍占满容器。 */
    overflow: visible;
    width: fit-content;
    min-width: 100%;
    box-sizing: border-box;
    box-shadow: var(--sh-1);
  }
  .proj-block:last-child { margin-bottom: 0; }
  /* 表格滚动容器：桌面端固定最大高度、内部滚动（横+纵），
     表头吸顶常驻，工具栏与分页条也不会被顶出屏幕外 */
  #tableArea { overflow: auto; max-height: calc(100vh - 300px); }
  #tableArea .proj-table thead th {
    position: sticky; top: 0; z-index: 5;
    background: var(--panel-soft);
    box-shadow: inset 0 -1px 0 var(--border);
  }
  /* 横滚时保留任务身份列；left 由 JS 按实际表头宽度计算。 */
  #tableArea .proj-table .sticky-identity {
    position: sticky;
    left: var(--sticky-left, 0);
    z-index: 4;
    background: var(--panel);
  }
  #tableArea .proj-table thead .sticky-identity { z-index: 8; background: var(--panel-soft); }
  #tableArea .proj-table td.proj-cell-inline.sticky-identity {
    background: linear-gradient(180deg, #fafbfd 0%, #f6f8fb 100%);
  }
  #tableArea .proj-table tbody tr:hover td.sticky-identity { background: var(--accent-soft); }
  #tableArea .proj-table .sticky-identity-end {
    box-shadow: 8px 0 12px -11px rgba(15, 23, 42, .72);
  }
  .proj-block table { border: none; border-radius: var(--r-lg); }
  /* 项目单元格：横排展示 + 色点标识 + 任务数，不再用竖排文字 */
  td.proj-cell {
    background: linear-gradient(180deg, #fafbfd 0%, #f6f8fb 100%);
    vertical-align: middle;
    border-right: 1px solid var(--border-soft);
    padding: var(--s-3) var(--s-4);
    min-width: 140px;
  }
  td.proj-cell .proj-head {
    display: flex; align-items: center; gap: var(--s-2);
    margin-bottom: 4px;
  }
  td.proj-cell .proj-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  }
  td.proj-cell .proj-name {
    font-weight: 700; font-size: var(--fs-md);
    color: var(--text); line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: keep-all;
    display: inline-block;
  }
  td.proj-cell .proj-meta {
    display: flex; align-items: center; gap: var(--s-2);
    font-size: var(--fs-xs); color: var(--muted);
    line-height: 1.3;
  }
  td.proj-cell .proj-count {
    display: inline-flex; align-items: center; gap: 4px;
  }
  td.proj-cell .proj-count strong {
    color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums;
  }
  td.proj-cell .proj-dot-c1 { background: var(--p-1); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
  td.proj-cell .proj-dot-c2 { background: var(--p-2); box-shadow: 0 0 0 3px rgba(6,182,212,.12); }
  td.proj-cell .proj-dot-c3 { background: var(--p-3); box-shadow: 0 0 0 3px rgba(245,158,11,.14); }
  td.proj-cell .proj-dot-c4 { background: var(--p-4); box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
  td.proj-cell .proj-dot-c5 { background: var(--p-5); box-shadow: 0 0 0 3px rgba(236,72,153,.12); }
  td.proj-cell .proj-dot-c6 { background: var(--p-6); box-shadow: 0 0 0 3px rgba(139,92,246,.12); }

  /* ============ 单表模式（overdue 视图）：项目列紧凑版 ============
     不再 rowspan 合并，每行单独显示；色点 + 项目名，列宽固定 180px，
     长项目名截断省略号。色点色板与 proj-cell 复用 1~6。 */
  td.proj-cell-inline {
    vertical-align: middle;
    padding: 10px var(--s-3);
    border-right: 1px solid var(--border-soft);
    background: linear-gradient(180deg, #fafbfd 0%, #f6f8fb 100%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  td.proj-cell-inline .proj-dot {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
  }
  td.proj-cell-inline .proj-name {
    font-size: var(--fs-xs);
    color: var(--text-2);
    font-weight: 500;
    vertical-align: middle;
  }
  td.proj-cell-inline .proj-dot-c1 { background: var(--p-1); box-shadow: 0 0 0 2px rgba(99,102,241,.12); }
  td.proj-cell-inline .proj-dot-c2 { background: var(--p-2); box-shadow: 0 0 0 2px rgba(6,182,212,.12); }
  td.proj-cell-inline .proj-dot-c3 { background: var(--p-3); box-shadow: 0 0 0 2px rgba(245,158,11,.14); }
  td.proj-cell-inline .proj-dot-c4 { background: var(--p-4); box-shadow: 0 0 0 2px rgba(16,185,129,.12); }
  td.proj-cell-inline .proj-dot-c5 { background: var(--p-5); box-shadow: 0 0 0 2px rgba(236,72,153,.12); }
  td.proj-cell-inline .proj-dot-c6 { background: var(--p-6); box-shadow: 0 0 0 2px rgba(139,92,246,.12); }
  /* 项目切换处的可视分隔线（同一张表内，相邻行项目名变化时加一道浅分割） */
  tbody tr.task-row.project-change td {
    border-top: 1px solid var(--border);
  }

  /* ============ 任务编号：等宽 # ID 风格 ============ */
  td.cell-id .id-tag {
    display: inline-flex; align-items: center;
    padding: 3px 8px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  td.cell-id .id-tag::before {
    content: "#";
    color: var(--muted-2); margin-right: 1px; font-weight: 600;
  }
  /* 任务名称：可点击跳转 Worktile 任务详情页（新标签页） */
  td.cell-title a {
    color: var(--accent); text-decoration: none; font-weight: 600;
  }
  td.cell-title a:hover { text-decoration: underline; }
  /* 最近更新时间：弱化显示 + 等宽数字。
     列宽够时单行显示 'YYYY-MM-DD HH:MM:SS'；列宽窄时在中间空格处自然换行成两行。
     原理：white-space: normal（默认）是空格处可断行的普通排版，浏览器根据可用宽度
     自动决定是否换行。这里不用 pre-line —— 那会把 \n 当强制换行，列宽够也会换行；
     这里也用 nowrap + ellipsis —— 那个会把内容截成省略号而非换行。 */
  td.cell-updated { color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; white-space: normal; }
  td.cell-updated .updated-time {
    font-variant-numeric: tabular-nums;
  }
  .muted { color: var(--muted); }

  /* ============ 任务负责人：头像 / ghost 未分配 ============ */
  td.cell-owner { vertical-align: middle; }
  td.cell-owner .owner {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: var(--fs-sm); color: var(--text); font-weight: 500;
    line-height: 1.2;
  }
  td.cell-owner .owner .av {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(15,23,42,.06);
  }
  td.cell-owner .owner .av.c1 { background: linear-gradient(135deg, #6366f1, #818cf8); }
  td.cell-owner .owner .av.c2 { background: linear-gradient(135deg, #06b6d4, #67e8f9); }
  td.cell-owner .owner .av.c3 { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
  td.cell-owner .owner .av.c4 { background: linear-gradient(135deg, #10b981, #6ee7b7); }
  td.cell-owner .owner .av.c5 { background: linear-gradient(135deg, #ec4899, #f9a8d4); }
  td.cell-owner .owner .av.c6 { background: linear-gradient(135deg, #8b5cf6, #c4b5fd); }
  td.cell-owner .owner .name {
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  td.cell-owner .owner.unassigned {
    color: var(--muted-2);
    font-weight: 400;
  }
  td.cell-owner .owner.unassigned .av {
    background: transparent;
    border: 1.5px dashed var(--muted-2);
    color: var(--muted-2);
  }
  /* 未分配头像留空圆环（虚线圈已示意「空」），不再显示英文 "?" */
  td.cell-owner .owner.unassigned .av::after {
    content: "";
  }
  td.cell-owner .owner.unassigned .av-letter { display: none; }
  td.cell-owner .owner.unassigned .name {
    font-style: italic;
  }

  /* 任务行内的评论列：紧凑堆叠多条评论 */
  td.cell-comments { vertical-align: top; overflow-wrap: anywhere; }
  td.cell-comments .comments-inner { padding: 0; }
  /* 评论卡：圆角 + 柔和底色 + 头像（不是左竖线） */
  .comment-block {
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--panel-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    transition: border-color .12s, background .12s;
  }
  .comment-block:hover { border-color: var(--border); background: #fff; }
  .comment-block:last-child { margin-bottom: 0; }
  .comment-block .meta {
    display: flex; align-items: center; gap: 8px;
    font-size: var(--fs-xs); color: var(--muted); margin-bottom: 6px;
  }
  .comment-block .meta .meta-av {
    width: 20px; height: 20px; border-radius: 50%;
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    color: #fff; font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .comment-block .meta b {
    color: var(--text); font-weight: 600; font-size: var(--fs-sm);
  }
  .comment-block .body.emoji-only {
    font-size: 28px; line-height: 1.2;
    padding: 4px 0 2px;
  }
  /* 评论正文：超长无空格字符串（包括中文 CJK 长串、连续英文字母、单一 URL 等）
     都应该能按容器宽度断行 —— 用 overflow-wrap: anywhere + word-break: break-word 双保险 */
  .comment-block .body {
    font-size: 13px; line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;            /* flex/grid 内也能正常断行 */
    max-width: 100%;
  }
  .comment-block .body.is-clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-height: calc(1.55em * 2);
  }
  .comment-block .body p {
    margin: 0 0 6px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
  }
  .comment-block .body p:last-child { margin-bottom: 0; }
  /* 评论文本里的 URL 自动链接化（renderContent 中识别 https?://...） */
  .comment-block .body a.cmt-link {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
    border-bottom: 1px solid rgba(79, 70, 229, .35);
    transition: color .12s, border-color .12s, background .12s;
  }
  .comment-block .body a.cmt-link:hover {
    color: var(--accent-2);
    background: rgba(79, 70, 229, .08);
    border-bottom-color: var(--accent);
  }
  .comment-block .body a.cmt-link::after {
    content: "↗";
    display: inline-block;
    margin-left: 2px;
    font-size: 0.85em;
    opacity: .55;
    text-decoration: none;
    vertical-align: baseline;
  }
  /* 行内 code（含 markdown `code`） */
  .comment-block .body code:not(pre code) {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #f1f5f9; color: #0f172a;
    padding: 1px 5px; border-radius: 3px;
    border: 1px solid #e2e8f0;
    font-size: 12.5px; word-break: break-all;
  }
  /* 代码块（``` ``` 包裹 / 启发式 shell 段） */
  .comment-block .body pre.code-block {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #0f172a; color: #e2e8f0;
    padding: 10px 12px; border-radius: 6px;
    margin: 6px 0; overflow-x: auto;
    font-size: 12.5px; line-height: 1.55;
    white-space: pre; word-break: normal;
    border: 1px solid #1e293b;
  }
  .comment-block .body pre.code-block .lang {
    display: block;
    color: #64748b; font-size: 11px;
    margin-bottom: 6px; letter-spacing: .05em;
    text-transform: uppercase; user-select: none;
  }
  .comment-block .atts {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  /* 图片附件：垂直卡片（缩略图上 + 文件名下），长文件名自动换行 */
  .comment-block .att.img-type {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 4px;
    max-width: 200px;
    background: #ecfeff;
    color: #155e75;
    border: 1px solid #a5f3fc;
    border-radius: 4px;
    font-size: 12px;
  }
  /* 文件附件：链接，长文件名自动换行 */
  .comment-block .att.file-type {
    display: inline-flex;
    align-items: flex-start;
    padding: 4px 8px;
    max-width: 240px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    word-break: break-all;
  }
  .comment-block .att.file-type:hover { background: #e2e8f0; }
  /* 文件名：自动换行 */
  .comment-block .att .fname {
    font-weight: 500;
    display: block;
    width: 100%;
    word-break: break-all;
    line-height: 1.4;
  }
  /* 图片缩略图：可点击放大，宽度在父容器内自适应 */
  .att-thumb {
    display: block;
    max-width: 100%;
    max-height: 92px;
    width: auto; height: auto;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    object-fit: cover;
    cursor: zoom-in;
  }
  /* 图片放大遮罩层 */
  #lightbox {
    position: fixed; inset: 0; z-index: 9999;
    display: none;
    align-items: center; justify-content: center;
    background: rgba(15, 23, 42, 0.82);
    cursor: zoom-out;
  }
  #lightbox.active { display: flex; }
  #lightbox img {
    max-width: 92vw; max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  }
  .cell-loading, .cell-empty, .cell-error {
    font-size: var(--fs-sm); color: var(--muted);
    display: flex; align-items: center; gap: 8px;
    padding: var(--s-2) 0;
  }
  .cell-loading::before, .cell-empty::before, .cell-error::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); flex-shrink: 0;
  }
  .cell-loading::before {
    background: var(--accent);
    animation: cellPulse 1.4s ease-in-out infinite;
  }
  .cell-empty { color: var(--muted-2); font-style: italic; }
  .cell-error { color: var(--danger); }
  .cell-error::before { background: var(--danger); }
  @keyframes cellPulse {
    0%, 100% { opacity: .35; }
    50%      { opacity: 1;   }
  }
  .comment .empty { color: var(--muted); font-style: italic; }
  /* 全局 loading：友好骨架/文案 */
  .loading {
    padding: 60px 24px; text-align: center;
    color: var(--muted); font-size: var(--fs-sm);
    display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  }
  .loading::before {
    content: ""; width: 32px; height: 32px;
    border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading.error {
    color: var(--danger);
    background: #fef2f2; border-radius: var(--r-md);
    border: 1px solid #fecaca;
    padding: var(--s-4) var(--s-6);
  }
  .loading.error::before { display: none; }
  .loading strong { color: var(--text-2); font-size: var(--fs-md); }
  .loading-detail, .loading-elapsed { color: var(--muted); font-size: var(--fs-xs); }
  .loading-cancel {
    margin-top: 4px; padding: 7px 14px;
    background: #fff; color: var(--text-2); border: 1px solid var(--border);
    box-shadow: none; font-size: var(--fs-sm);
  }
  .loading-cancel:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  .error-hint { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--muted); }
  /* 空态：与 .loading 同尺寸同位置，但无 spinner 旋转动画 */
  .empty {
    padding: 60px 24px; text-align: center;
    color: var(--muted); font-size: var(--fs-sm);
  }

  /* 分页 */
  .pager {
    display: flex; align-items: center; justify-content: center;
    gap: var(--s-3); flex-wrap: wrap;
    margin-top: var(--s-5); margin-bottom: var(--s-2);
  }
  .pager.is-loading { display: none; }
  .pager .info { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
  .pager .pager-btn {
    padding: 7px var(--s-4); border: 1px solid var(--border);
    background: #fff; color: var(--text); border-radius: var(--r-md);
    font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    box-shadow: var(--sh-1);
  }
  .pager .pager-btn:hover:not(:disabled) {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-soft);
  }
  .pager .pager-btn:disabled {
    opacity: .4; cursor: not-allowed; background: var(--panel-soft); box-shadow: none;
  }
  .pager .page-jump {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: var(--fs-sm); color: var(--muted);
  }
  .pager .page-input {
    width: 56px; padding: 6px var(--s-2); text-align: center;
    border: 1px solid var(--border); border-radius: var(--r-sm); font-size: var(--fs-sm);
    background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    font-variant-numeric: tabular-nums;
  }
  .pager .page-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
  }
  .pager .page-input:disabled {
    background: var(--panel-soft); color: var(--muted-2); cursor: not-allowed;
  }
  .pager .page-go {
    padding: 6px var(--s-3); border: 1px solid var(--border);
    background: #fff; color: var(--accent); border-radius: var(--r-sm);
    font-size: var(--fs-sm); font-weight: 500; cursor: pointer; transition: all .15s;
  }
  .pager .page-go:hover {
    background: var(--accent-soft); border-color: var(--accent);
  }
  .hidden { display: none; }

  /* ============== 列设置弹窗 ============== */
  /* 用 :not(.hidden) 而非默认 flex：保证 .hidden { display:none } 真的能隐藏弹窗。
     否则 .col-modal-mask 与 .hidden 同优先级，后定义的 flex 会覆盖 none。 */
  .col-modal-mask:not(.hidden) {
    position: fixed; inset: 0; z-index: 5000;
    background: rgba(15, 23, 42, 0.42);
    display: flex; align-items: center; justify-content: center;
  }
  .col-modal-mask.hidden { display: none; }
  .col-modal {
    width: 560px; max-width: calc(100vw - 32px);
    /* 弹窗高度上限：随视口缩放，桌面端最高 760px，避免列很多时撑满整屏；
       flex 列布局让 header/footer 固定，body 单独滚动。 */
    max-height: min(90vh, 760px);
    display: flex; flex-direction: column;
    background: var(--panel); border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden; animation: colModalIn 0.18s ease-out;
  }
  @keyframes colModalIn { from { transform: translateY(-8px); opacity: 0 } to { transform: none; opacity: 1 } }
  .col-modal header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    background: #f8fafc;
  }
  .col-modal header h3 { margin: 0; font-size: 16px; }
  .col-modal header .x {
    border: none; background: transparent; color: var(--muted);
    font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 6px;
    cursor: pointer;
  }
  .col-modal header .x:hover { background: #eef2f7; color: var(--text); }
  .col-modal .modal-body {
    padding: 12px 20px 14px;
    /* 占据弹窗剩余高度，列很多时内部纵向滚动，header/footer 保持固定 */
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .col-modal .col-search-wrap {
    position: sticky; top: 0; z-index: 4;
    padding: 0 0 10px; background: var(--panel);
  }
  .col-modal .col-search-wrap input {
    width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
    border: 1px solid var(--border); font-size: var(--fs-sm);
  }
  .col-modal .cols-list { list-style: none; padding: 0; margin: 0; }
  .col-modal .col-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; margin-bottom: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #fff; transition: border-color .12s, background .12s, box-shadow .12s;
    user-select: none;
  }
  /* 滚动到底时最后一行也能与底部留点空隙，不被截 */
  .col-modal .cols-list { padding-bottom: 4px; }
  .col-modal .col-row:hover { border-color: #c7d2fe; }
  .col-modal .col-row.dragging {
    opacity: 0.5; border-style: dashed;
  }
  .col-modal .col-row.drag-over-top { box-shadow: 0 -2px 0 0 var(--accent) inset; }
  .col-modal .col-row.drag-over-bot { box-shadow: 0 2px 0 0 var(--accent) inset; }
  .col-modal .col-row.is-hidden { background: #f8fafc; color: var(--muted); }
  .col-modal .col-row .drag-handle {
    color: #94a3b8; font-size: 14px; line-height: 1;
    cursor: grab; padding: 0 2px; letter-spacing: -2px;
  }
  .col-modal .col-row.anchor .drag-handle {
    cursor: not-allowed; color: #cbd5e1;
  }
  .col-modal .col-row .drag-handle:active { cursor: grabbing; }
  .col-modal .col-row input[type=checkbox] {
    width: 16px; height: 16px; cursor: pointer;
    accent-color: var(--accent);
  }
  .col-modal .col-row input[type=checkbox]:disabled { cursor: not-allowed; opacity: .6; }
  .col-modal .col-row .col-label {
    flex: 1; font-size: 14px; font-weight: 500;
  }
  .col-modal .col-row .col-tag {
    font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
    background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
  }
  /* 模式切换器：右端，segmented control 风格 */
  .col-modal .col-row .mode-switch {
    display: flex; border: 1px solid var(--border); border-radius: 6px;
    overflow: hidden; background: #fff; flex-shrink: 0;
  }
  .col-modal .col-row .mode-switch .mode-opt {
    display: flex; align-items: center; gap: 4px;
    padding: 3px 8px; font-size: 12px; color: var(--muted);
    cursor: pointer; user-select: none;
    border-right: 1px solid var(--border);
    transition: background .12s, color .12s;
  }
  .col-modal .col-row .mode-switch .mode-opt:last-child { border-right: none; }
  .col-modal .col-row .mode-switch .mode-opt:hover { background: #f8fafc; }
  .col-modal .col-row .mode-switch .mode-opt.active {
    background: var(--accent-soft); color: var(--accent); font-weight: 500;
  }
  .col-modal .col-row .mode-switch .mode-opt.disabled {
    cursor: not-allowed; opacity: .5; background: #f3f4f6;
  }
  .col-modal .col-row .mode-switch .mode-opt input[type=radio] {
    display: none; /* 自定义 segmented 外观，隐藏原生 radio */
  }
  .col-modal .col-row.anchor { background: #fffbeb; border-color: #fde68a; }
  .col-modal footer {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 14px 20px; border-top: 1px solid var(--border);
    background: #f8fafc;
  }
  .col-modal footer .left { display: flex; gap: 8px; }
  .col-modal footer .right { display: flex; gap: 8px; }
  .col-modal .btn-text {
    background: transparent; color: var(--muted);
    border: 1px solid var(--border); padding: 7px 14px;
    font-size: 13px;
  }
  .col-modal .btn-text:hover { background: #f1f5f9; color: var(--text); }

  /* ============ 评论折叠（默认只展示最近几条，点击展开全部） ============ */
  .cmt-toggle {
    margin-top: 8px; padding: 3px 12px; font-size: 12px; font-weight: 500;
    border-radius: var(--r-pill); background: var(--panel-soft);
    color: var(--accent); border: 1px solid var(--border);
    box-shadow: none; line-height: 1.5;
  }
  .cmt-toggle:hover { background: var(--accent-soft); border-color: var(--accent-2); }

  /* ============ 移动端（≤768px）：压缩顶栏与工具栏，表格保持横滚 ============ */
  @media (max-width: 768px) {
    .wrap { max-width: 100vw; padding: var(--s-3); overflow-x: clip; }
    /* 横滚只发生在表格区域，顶栏、筛选器和分页不会跟着移出屏幕。 */
    #tableArea {
      max-height: none;
      overflow-x: auto;
      overflow-y: hidden;
      overscroll-behavior-x: contain;
      -webkit-overflow-scrolling: touch;
    }
    #tableArea .proj-table thead th { position: static; box-shadow: none; }
    #tableArea .proj-table .sticky-identity {
      position: static; left: auto; box-shadow: none;
    }
    .topbar { flex-wrap: nowrap; gap: var(--s-2); padding: var(--s-2) var(--s-3); }
    .topbar .brand-mark { width: 28px; height: 28px; font-size: 13px; border-radius: var(--r-sm); }
    .topbar .brand-name .sub { display: none; }
    .topbar .brand-name .title { font-size: var(--fs-md); }
    .topbar .account { max-width: 132px; padding: 4px 8px 4px 2px; gap: 4px; }
    .topbar .account .av { width: 22px; height: 22px; font-size: 10px; }
    .topbar .account .who .label { display: none; }
    .topbar .account .who .val { font-size: var(--fs-xs); max-width: 96px; }
    .topbar .icon-btn { width: 30px; height: 30px; }
    .toolbar { gap: var(--s-2); }
    .toolbar .tb-card { flex: 1 1 100%; }
    .toolbar .tb-card.tb-filters { flex-wrap: wrap; }
    .toolbar .export-mode-label { margin-left: 0; }
    .col-modal { max-width: calc(100vw - 20px); max-height: 92vh; }
    .col-modal .modal-body { padding-left: 12px; padding-right: 12px; }
    .col-modal .col-row { gap: 7px; }
    .col-modal .col-row .col-label { min-width: 76px; }
    .col-modal .col-row .mode-switch .mode-opt { padding: 3px 6px; }
    .pager { flex-wrap: wrap; row-gap: var(--s-2); }
    .login-card { margin: 6vh auto; padding: var(--s-5); }
  }

  /* ============ 自定义列（Worktile 任务自定义字段） ============ */
  td.cell-custom { white-space: normal; overflow-wrap: anywhere; min-width: 90px;
    line-height: 1.45; vertical-align: middle; font-size: var(--fs-sm); color: var(--text-2); }
  td.cell-custom .custom-val { display: inline-block; max-width: 300px; }

  /* 列设置弹窗：自定义列行 */
  .col-row .col-tag.is-custom {
    background: #ecfdf5; color: #059669; border-color: #a7f3d0;
  }
  .col-row .col-del {
    margin-left: auto; padding: 3px 10px; font-size: 12px; border-radius: var(--r-sm);
    background: transparent; color: var(--danger); border: 1px solid #fecaca;
    box-shadow: none; font-weight: 500;
  }
  .col-row .col-del:hover { background: #fef2f2; }

  /* 添加自定义列区块 */
  .add-cc {
    margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
  }
  .add-cc-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
  .add-cc-row { display: flex; align-items: center; gap: 8px; }
  .add-cc-row select {
    flex: 1; min-width: 0; padding: 6px 8px; font-size: var(--fs-sm);
    border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff;
  }
  .cc-status { font-size: var(--fs-xs); color: var(--muted); }
  .cc-fields {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 8px;
  }
  .cc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--r-pill); font-size: var(--fs-sm);
    background: var(--accent-soft); color: var(--accent); border: 1px solid #bfdbfe;
    box-shadow: none; font-weight: 500; cursor: pointer;
  }
  .cc-chip:hover { background: #e0e7ff; border-color: var(--accent-2); }
  .cc-chip .cc-type { font-size: 11px; color: var(--muted); font-weight: 400; }
  .add-cc-hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; margin: 8px 0 0; }

  /* 添加自定义列：项目搜索式选择器（复用 .search-select 体系） */
  .add-cc-row .search-select { flex: 1; min-width: 0; }
  .add-cc-row .search-select input { background: #fff; border-color: var(--border); }
  .add-cc-row .search-select input:focus { background: #fff; }
  /* 浮层要盖过列设置弹窗（mask z-index 5000） */
  .add-cc .search-select-menu { z-index: 6000; }
