/* 房修整理台样式（单文件，无构建）。
 * 域标记：令牌 / 基础 / 布局与外壳 / 表格与数据 / 卡片与照片 / 弹层与说明 / 移动端（媒体查询）/ 打印，
 * 标记插在各域真实起点处，不是连续分段——本文件按迭代顺序书写，整份按主题重排会改变同特异性规则的先后，
 * 因此只标起点、不动次序。新增规则追加到所属域末尾，不要插队；打印段必须留在文件末尾。
 */

/* ======== 令牌 ======== */
/* 房修整理台样式：设计令牌 + 组件样式；纯换肤，不改 DOM 结构与类名。 */
*, *::before, *::after { box-sizing: border-box; }
:root {
  /* 中性灰阶（浅色默认） */
  --bg0: #f5f6f8;
  /* 页面底（面板外） */
  --bg1: #ffffff;
  /* 面板/表面 */
  --bg2: #f7f8fa;
  /* 抬升面/表头/工具条 */
  --panel: #ffffff; --panel-2: #f7f8fa; --border: #e4e7ec; --border-row: #f0f1f4;
  /* 表格发丝线（比边框浅一档） */
  --border-strong: #d3d8de; --text: #1d2129; --muted: #5a6270;
  /* 小字用加深版，白底 5.9:1 */
  /* 品牌与语义 */
  --accent: #2563eb; --accent-2: #1d4ed8; --brand: #2563eb; --brand-soft: rgba(37, 99, 235, 0.08);
  /* 语义色：文字用加深版（白底 ≥4.5:1），软底色给 chip / pill */
  --ok: #067647; --warn: #b54708; --danger: #b42318; --ok-soft: #e9f7f0; --warn-soft: #fdf3e4;
  --danger-soft: #feecea; --ai: #6438d8; --ai-soft: #f2edff;
  /* 品牌插图四色：只给空态线稿，不涂按钮、不进表格（界面仍用 --brand）。暗底亮度足够，深色不另调。 */
  --brand-warm-1: #f97316; --brand-warm-2: #fbbf24; --brand-cool-1: #3b82f6; --brand-cool-2: #22d3ee;
  /* 设计刻度：圆角三层（卡片/模态 10，卡内小卡 8，控件/菜单 6）；字号四阶：
     徽标 0.62/0.68、小字 0.75、正文 0.85、标题 0.95；焦点环统一 --ring，阴影只给浮层。 */
  --radius: 10px; --radius-sm: 8px; --radius-xs: 6px; --radius-2xs: 4px;
  /* 徽标、进度条这类 8~20px 高的小件 */
  --radius-pill: 999px;
  /* 胶囊：标签、chip、开关 */
  /* 控件只有两档高度：工具条 28、主操作/顶栏 36；中间的 29/31/32/34 一律归到这两档。 */
  --ctl-h: 28px; --ctl-h-lg: 36px;
  /* 动效三档：微反馈 / 常规过渡 / 尺寸与展开，同一界面里不要混别的时长。 */
  --dur-1: 0.12s; --dur-2: 0.18s; --dur-3: 0.3s; --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.12); --shadow-overlay: 0 16px 48px rgba(15, 23, 42, 0.14);
  --shadow-raised: 0 1px 2px rgba(15, 23, 42, 0.07);
  /* 字号只留 6 档 + 图标档：徽标 12 / 辅助 12 / 表格与控件 13 / 正文 15 / 面板标题 17 / 数字 23；
     中文在 10px 上下靠猜，徽标档不能低于 12。 */
  /* --fs-14/16 必须定义：漏了 var() 是无效声明，卡片房号会静默继承 13px。 */
  --fs-10: 10px;
  /* 只给 ◆ 这类纯符号 */
  --fs-11: 12px;
  /* 徽标、来源、极短标签（与 12 同宽，中文可读下限） */
  --fs-12: 12px;
  /* 表头、辅助说明、时间戳 */
  --fs-13: 13px;
  /* 表格正文、按钮、输入框 */
  --fs-14: 14px;
  /* 卡片内的中等强调、空态小标题 */
  --fs-15: 15px;
  /* 正文段落、区块小标题 */
  --fs-16: 16px;
  /* 卡片房号、统计分项标题 */
  --fs-17: 17px;
  /* 面板标题、品牌 */
  --fs-23: 23px;
  /* KPI 数字 */
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
html, body { height: 100%; }
body {
  margin: 0; min-height: 100vh;
  /* 字体栈系统优先：system-ui 让中英同源；Segoe UI 排第一会让中英字重、x 高度不一路。 */
  font-family: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: var(--fs-15); color: var(--text); background: var(--bg0); -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%; font-kerning: normal;
  /* 不写 -webkit-font-smoothing: antialiased：它让 macOS 上的字变细，12px 中文更难认。 */
}
/* ---- 深色主题（顶栏「黑/白」切换，localStorage 记忆；浅色默认） ---- */
html[data-theme="dark"] {
  --bg0: #0f1115; --bg1: #16181d; --bg2: #1d2026; --panel: #16181d; --panel-2: #1f2229;
  --border: #262a31; --border-row: #21252b; --border-strong: #3d434c; --text: #e6e8eb;
  --muted: #9aa1ab; --accent: #3b82f6; --accent-2: #60a5fa; --brand: #3b82f6;
  --brand-soft: rgba(59, 130, 246, 0.14); --ok: #34d399; --warn: #fbbf24; --danger: #f87171;
  --ok-soft: rgba(52, 211, 153, 0.14); --warn-soft: rgba(251, 191, 36, 0.14);
  --danger-soft: rgba(248, 113, 113, 0.14); --ai: #b39dff; --ai-soft: rgba(139, 92, 246, 0.16);
  --shadow-overlay: 0 16px 48px rgba(0, 0, 0, 0.5);
  /* 深色主题放重焦点环与拼块抬升 */
  --ring: 0 0 0 3px rgba(59, 130, 246, 0.22); --shadow-raised: 0 1px 2px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .log-act.is-danger {
  background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: rgba(248, 113, 113, 0.4);
}
html[data-theme="light"] .log-act.is-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: var(--fs-13); }

/* ======== 表格与数据 ======== */
/* 房号/日期/序号/统计数字统一等宽数字：一列数字纵向对齐，扫读不跳。 */
.grid td, .grid th, .kpi b, .tablebar__count, .stats b { font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: var(--fs-12); margin: 0.4rem 0 0; }
::selection { background: var(--brand-soft); }
.grid-wrap::-webkit-scrollbar, .stats__wrap::-webkit-scrollbar,
.drawer__body::-webkit-scrollbar, .diff__list::-webkit-scrollbar {
  width: 10px; height: 10px;
}
.grid-wrap::-webkit-scrollbar-thumb, .stats__wrap::-webkit-scrollbar-thumb,
.drawer__body::-webkit-scrollbar-thumb, .diff__list::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: var(--radius-pill); border: 2px solid transparent;
  background-clip: content-box;
}
.grid-wrap::-webkit-scrollbar-track, .stats__wrap::-webkit-scrollbar-track { background: transparent; }

/* ======== 布局与外壳 ======== */
/* ---- 顶栏 ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--bg1);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
/* 品牌图标四角透明，背景必须清掉，否则会露出底色方块。 */
img.brand__logo { display: block; background: transparent; object-fit: contain; }
.brand__logo {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm);
  font-size: var(--fs-17); font-weight: 800; color: #fff; background: var(--brand);
}
.brand__text h1 { margin: 0; font-size: var(--fs-15); font-weight: 700; letter-spacing: 0.01em; }
.brand__text p { margin: 0.1rem 0 0; font-size: var(--fs-12); color: var(--muted); }
.topbar__actions { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: nowrap; }
/* 动作组被压缩时整组整行移动，不在内部换行（720 以下改回 wrap），否则「工具」会单独掉一行。 */
.field { display: flex; flex-direction: column; gap: 0.28rem; }
.field span { font-size: var(--fs-12); color: var(--muted); }
.field input, .field select {
  font: inherit; font-size: var(--fs-13); color: var(--text); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.45rem 0.6rem;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.field select option, .batchbar__select option, .tablebar__select option, .col-source option {
  background: var(--bg1); color: var(--text);
}
/* ---- 按钮：实底主色 / 描边 / ghost 三级 ---- */
.btn {
  font: inherit; font-size: var(--fs-13); font-weight: 600; color: var(--text);
  border: 1px solid transparent; border-radius: var(--radius-sm); height: 32px;
  /* 三档：28 表格内 / 32 工具栏 / 36 顶栏 */
  padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; cursor: pointer;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: translateY(0.5px); }
.btn--sm { height: var(--ctl-h); padding: 0 10px; font-size: var(--fs-12); }
.btn--primary { color: #fff; background: var(--brand); }
.btn--primary:hover { background: var(--accent-2); box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28); }
.btn--primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { border-color: var(--border-strong); background: var(--panel-2); }
.btn--danger { background: transparent; border-color: var(--border); color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); background: rgba(248, 113, 113, 0.08); }
html[data-theme="light"] .btn--danger:hover { background: rgba(220, 38, 38, 0.06); }
/* 「更多」菜单：四个任务阶段每段只留 1~2 个高频动作，其余收进这里。菜单项保留原按钮 id，
   JS 按引用绑定，移动 DOM 不影响行为；宽度 max-content 加上限，避免长中文折行。 */
.more { position: relative; display: inline-flex; }
.more__btn::after { content: ""; }
.more__menu {
  /* fixed 而不是 absolute：菜单常挂在会滚动的工具条里，absolute 会被祖先裁掉一半；坐标由 JS 按按钮位置算。
     max-height + 内部滚动，overscroll-behavior 防止滚到头把页面带着滚。 */
  position: fixed; top: 0; left: 0; z-index: 60; min-width: 176px; width: max-content;
  max-width: min(84vw, 300px); max-height: 86vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 0.3rem; background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg, 0 12px 32px rgba(2, 6, 23, 0.28));
}
.more__menu--right { left: auto; right: 0; }
.more__menu[hidden] { display: none; }
/* 菜单打开时临时挪到 body 直属层，避开工具条的 mask/overflow 裁切 */
.more-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.more-layer > .more__menu { pointer-events: auto; }
.more__head {
  margin: 0.1rem 0.35rem 0.28rem; font-size: var(--fs-11); font-weight: 700; letter-spacing: 0.04em;
  color: var(--muted); text-transform: none;
}
.more__item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; width: 100%;
  padding: 0.46rem 0.6rem; font: inherit; font-size: var(--fs-13); text-align: left;
  color: var(--text); background: transparent; border: 0; border-radius: var(--radius-sm);
  cursor: pointer;
}
.more__item[hidden] { display: none; }
.more__item.is-off { opacity: 0.42; pointer-events: none; }
/* 只在手机上出现的条目必须写双类：.more__item 还有一条 display:flex，同权重靠书写顺序会盖掉单类。 */
.m-only.more__item, .m-only.more__sep, .m-only.more__head { display: none; }
.more__item:hover { background: var(--panel-2); }
.more__item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.more__item:disabled { opacity: 0.45; cursor: not-allowed; }
.more__item--danger { color: var(--danger); }
.more__item--danger:hover { background: rgba(248, 113, 113, 0.1); }
html[data-theme="light"] .more__item--danger:hover { background: rgba(220, 38, 38, 0.07); }
/* 开关型条目（精简列 / 跨工作表搜索）：淡底 + 右侧勾，不整块反色 */
.more__item.is-active { background: var(--brand-soft); color: var(--text); }
.more__item.is-active::after { content: "✓"; color: var(--brand); font-weight: 700; }
.more__sep { display: block; height: 1px; margin: 0.22rem 0.35rem; background: var(--border-strong); }
.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center; border: none;
  border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
  font-size: var(--fs-13);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn--sm { width: 26px; height: 26px; font-size: var(--fs-12); }
/* ---- 布局 ---- */
.workspace {
  display: grid;
  /* 左栏跟视口走：大屏 380 封顶，窄屏收到 300，把宽度还给表格。 */
  grid-template-columns: clamp(300px, 27vw, 380px) 1fr; gap: 1rem; padding: 1rem 1.25rem 2rem;
  align-items: start;
}

/* ======== 移动端（媒体查询） ======== */
/* 两栏撑满首屏：--topbar-h 由 JS 实测写进 :root，顶栏一行/两行都不留缝。 */
@media (min-width: 721px) {
  .workspace { align-items: stretch; }
  .workspace > .panel:nth-child(2) { display: flex; flex-direction: column; }
  /* 左栏同理：粘贴框跟着面板长，粘 30 行不用先跟滚动条较劲 */
  .workspace:not(.is-paste-collapsed) > .panel:first-child { display: flex; flex-direction: column; }
  .workspace:not(.is-paste-collapsed) > .panel:first-child #raw-input { flex: 1 1 auto; min-height: 120px; }
}
/* 两栏并排时工作区钉成一屏高（≥721）：定高 + 行 minmax(0,1fr)，表格在卡片里滚，整页不出滚动条。
   721 以下两栏变单列、结果表变卡片流（高度不一），仍走整页滚动。 */
@media (min-width: 881px), (min-width: 721px) and (max-width: 880px) and (min-height: 700px) {
  .workspace {
    height: calc(100dvh - var(--topbar-h, 63px) - 3rem);
    /* 高度取 420 与视口算出值的较小者：横屏 844×390 只有 258，写死 420 会顶破视口。 */
    min-height: min(420px, calc(100dvh - var(--topbar-h, 63px) - 3rem));
    grid-template-rows: minmax(0, 1fr);
  }
  .workspace > .panel { min-height: 0; }
  /* basis 0：否则基准高是整张表，负空间回缩时底部标签条只露半截。 */
  .workspace > .panel:nth-child(2) > .grid-wrap { flex: 1 1 0; min-height: 0; max-height: none; }
  .workspace > .panel:nth-child(2) > .sheetbar,
  .workspace > .panel:nth-child(2) > .panel__foot { flex: 0 0 auto; }
  /* 粘贴区收起后是单列：必须两行（导入条 auto、结果表 1fr），否则第二张卡按内容撑，表格区被挤到 2px。 */
  .workspace.is-paste-collapsed { grid-template-rows: auto minmax(0, 1fr); }
  /* 只剩一张卡（统计页藏起粘贴卡）时让它吃掉整行，否则按内容高、底下露一条灰底。 */
  .workspace.is-single { grid-template-rows: minmax(0, 1fr); }
  /* 卡片拉高后多出的高度要有人吃：统计区和明细框 grow，脚注与标签条贴底；只 grow 不 shrink。 */
  .workspace > .panel > .stats:not([hidden]) { flex: 1 1 auto; }
  .workspace > .panel > .stats:not([hidden]) .stats__wrap { flex: 1 1 auto; }
}
.workspace.is-paste-collapsed { grid-template-columns: 1fr; }
.workspace.is-paste-collapsed > .panel:first-child { padding: 0.45rem 0.75rem 0.55rem; box-shadow: none; }
.workspace.is-paste-collapsed > .panel:first-child .panel__head { padding: 0.1rem 0.15rem; }
.workspace.is-paste-collapsed > .panel:first-child .panel__head h2 { font-size: var(--fs-13); }
.workspace.is-paste-collapsed #raw-input { height: 56px; min-height: 56px; }
.workspace.is-paste-collapsed #paste-hint { display: none; }
.workspace.is-paste-collapsed > .panel:first-child .panel__foot { padding: 0.35rem 0.15rem 0.1rem; }
/* 收起态摘要在桌面不显示（桌面留一条 56px 输入条继续能改） */
.paste-mini {
  display: none; font-size: var(--fs-13); color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 720px) {
  /* 手机上收起后左栏整块消失，只能手动展开找回入口 */
  .workspace.is-paste-collapsed { grid-template-columns: 1fr; }
  /* 手机上收起只留一条 44px 摘要（原始记录 + 已整理条数），展开入口在结果表工具条的「展开粘贴」。 */
  .workspace.is-paste-collapsed > .panel:first-child { padding: 0.3rem 0.6rem; }
  .workspace.is-paste-collapsed > .panel:first-child .panel__head { padding: 0; min-height: 0; }
  .workspace.is-paste-collapsed > .panel:first-child #raw-input,
  .workspace.is-paste-collapsed > .panel:first-child .panel__foot,
  .workspace.is-paste-collapsed > .panel:first-child .panel__tools,
  .workspace.is-paste-collapsed > .panel:first-child #paste-hint {
    display: none;
  }
  .workspace.is-paste-collapsed > .panel:first-child .paste-mini { display: inline-flex; align-items: center; }
}
.panel {
  background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; min-width: 0;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.panel__head h2 {
  margin: 0; font-size: var(--fs-15); font-weight: 700; display: flex; align-items: center;
  gap: 0.45rem;
}
.panel__head em {
  font-style: normal; font-size: var(--fs-12); width: 18px; height: 18px; display: grid;
  place-items: center; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700;
}
.panel__tools { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* 工具分组：细竖线隔开行操作 / 撤销 / 导入导出 / 危险动作 */
.panel__tools .tools-group { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.panel__tools .tools-group + .tools-group { padding-left: 0.6rem; border-left: 1px solid var(--border-strong); }
/* 结果表工具条只留「加行 / 撤销 重做 / 导出 Excel / 更多」；去重、补责任单位、销项看板收进菜单，
   菜单项 data-proxy 直连这三个按钮，按钮留在 DOM 里只作被点对象。 */
.panel__tools #dedupe,
.panel__tools #fill-units,
.panel__tools #open-board { display: none; }
.panel__tools .icon-btn { flex: none; }
@media (max-width: 720px) {
  /* 手机端贴回扁平结构，保留横向滑动，不做竖线 */
  .panel__tools .tools-group { display: contents; }
}
.panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.8rem; }
/* 窄桌面换行时每个块整体换行，别把「6 条」拆成「6」+「条」。 */
@media (min-width: 881px) {
  .panel__foot > * { white-space: nowrap; }
 }
.panel__foot--save { justify-content: flex-start; flex-wrap: wrap; row-gap: 0.3rem; }
#save-status { margin-left: auto; }
/* ---- 输入区 ---- */
#raw-input {
  width: 100%; min-height: 320px; resize: vertical; font: inherit; font-size: var(--fs-15);
  line-height: 1.6; color: var(--text); background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
#raw-input::placeholder { color: var(--muted); opacity: 0.7; }
#raw-input:focus, .text-input:focus, .rules-input:focus, .col-name:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.progress { margin-top: 0.7rem; }
.progress__bar { height: 6px; border-radius: var(--radius-pill); background: var(--panel-2); overflow: hidden; }
.progress__bar i {
  display: block; height: 100%; width: 0; border-radius: var(--radius-pill); background: var(--brand);
  transition: width var(--dur-3) var(--ease);
}
.progress span { display: inline-block; margin-top: 0.35rem; }
/* ---- 表格 ---- */
.grid-wrap {
  overflow: auto; max-height: 62vh; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg1);
}
/* 桌面端表格按「视口 - 固定 chrome」定高、自己内部滚，整页始终一屏；62vh 那种估法会多出滚动条。 */
@media (min-width: 1021px) {
  .grid-wrap { max-height: max(240px, calc(100vh - 355px)); }
}

/* ======== 基础 ======== */
/* 密度：紧凑（现场/手机，一屏多行）/ 舒适（办公大屏），html[data-density] 切换 */
html[data-density="compact"] .grid { font-size: var(--fs-13); }
html[data-density="compact"] .grid__cell { padding: 0.28rem 0.6rem; }
html[data-density="compact"] .grid__th { padding: 0.4rem 0.6rem; }
html[data-density="compact"] .grid__cell--del { padding: 0.15rem; }
html[data-density="cozy"] .grid { font-size: var(--fs-13); }
html[data-density="cozy"] .grid__cell { padding: 0.6rem 0.7rem; }
html[data-density="cozy"] .grid__th { padding: 0.55rem 0.7rem; }
.grid {
  border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
}
.grid__th {
  position: sticky; top: 0; z-index: 2; text-align: left; white-space: nowrap; padding: 0.5rem 0.7rem;
  font-size: var(--fs-12); font-weight: 500; letter-spacing: 0.01em; color: var(--muted);
  background: var(--bg2); border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border-row);
}
.grid__th:last-child { border-right: none; }
/* 行悬停：纯白行 + 浅灰悬停，无斑马纹 */
.grid tbody tr:hover > .grid__cell { background: var(--panel-2); }
/* 高亮反白在亮色主题下反转为深底白字 */
html[data-theme="light"] .grid tbody tr.is-flash > .grid__cell { background: #191c20; color: #fff; }
/* 短内容列（时间）不折行：别把日期拆成两行 */
.grid td[data-label="时间"], .grid td[data-label="日期"] { white-space: nowrap; }
.grid__th--del { width: 36px; }
/* 宽屏把富余横向空间给「问题描述」，不给最后一列 */
.grid__th--grow, .grid__cell--grow { width: 100%; }
/* 行勾选列 + 选中行底色（品牌 8%）+ 批量操作条 */
.grid__th--sel, .grid__cell--sel { width: 30px; text-align: center; padding-left: 0.3rem; padding-right: 0.3rem; }
.row-select { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand); }
.grid tbody tr.is-selected > .grid__cell { background: var(--brand-soft); }
.selbar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.42rem 0.7rem;
  margin: 0 0 0.4rem; border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.selbar__info { font-weight: 700; font-size: var(--fs-13); }
/* 表头只留类型图标（文字给 title 和读屏）：一行 40px，不重复四列「AI 提取」。 */
.grid__col-name {
  font-weight: 600; margin-bottom: 0; display: inline-flex; align-items: center; gap: 5px;
  vertical-align: middle;
}
.grid__col-src {
  display: inline-block; flex: 0 0 auto; width: 5px; height: 5px; padding: 0; margin-left: 5px;
  font-size: 0;
  /* 文字只给读屏和 title，表头不再重复 4 次 */
  border: 0; border-radius: 50%; background: var(--border-strong); vertical-align: 2px; cursor: help;
}
.grid__col-src::before { content: none; }
/* AI 的两类来源用紫色小点，和表内 AI 徽标同一套语义色 */
.src--extract, .src--judge { background: var(--ai); opacity: 0.75; }
.src--index::before { content: "#"; }
.src--date::before { content: "▦"; }
.src--extract::before { content: "Aa"; }
.src--judge::before { content: "◆"; font-size: var(--fs-10); }
.src--manual::before { content: "✎"; }
.grid__cell {
  padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border-row);
  border-right: 1px solid var(--border-row); vertical-align: top; min-width: 72px; max-width: 320px;
  word-break: break-word; white-space: pre-wrap; outline: none;
}
/* 超长描述限 3 行（见 table.js makeCell），聚焦编辑或打印时展开全文 */
.grid__cell.is-long { padding-top: 0.42rem; padding-bottom: 0.42rem; }
.cell-clamp {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap;
}
/* 聚焦编辑时只放到 40vh，多出来的在格子里滚 —— 500 字全展开会把行撑到 1400px。 */
.grid__cell:focus .cell-clamp { -webkit-line-clamp: unset; display: block; overflow: auto; max-height: 40vh; }
.grid__cell:last-child { border-right: none; }
.grid__cell[contenteditable="true"]:focus { background: var(--bg2); box-shadow: inset 0 0 0 2px var(--accent); }
/* 按钮统一 inline-grid 横排：display:grid 会在 td 里块级换行，36px 塞不下 📷 + ✕ 就竖排撑到 58px。 */
.grid__cell--del { width: auto; min-width: 36px; text-align: center; padding: 0.3rem; white-space: nowrap; }
.grid__cell--del .icon-btn { display: inline-grid; vertical-align: middle; }
/* 可疑 ⚠ / 已核对 ✓ 的固定槽空着也占位，让拍照和 ✕ 在各行同一条竖线上。 */
.rowflag-slot { display: inline-grid; place-items: center; width: 22px; height: 22px; vertical-align: middle; }
.grid__cell--del .chk-badge { vertical-align: middle; }
.grid__cell--del .icon-btn + .icon-btn { margin-left: 2px; }
/* 行内「派单」只给手机/平板：桌面有批次条，行高 32px 塞三个图标会截字。 */
.grid__cell--del .row-dispatch { display: none; }
@media (max-width: 720px) {
  .grid__cell--del .row-dispatch { display: inline-grid; }
  .grid__cell--del .row-dispatch svg { opacity: 0.9; }
}
/* 精简列给表格挂 .grid--slim：可收起列（table.js 打 is-slimmable）整列收起 */
table.grid--slim th.is-slimmable, table.grid--slim td.is-slimmable { display: none; }
/* 需核对：无彩色下用反白高亮，最醒目 */
.grid__cell.is-error { background: #d7dade; color: #16181d; font-weight: 600; }
/* 浅色主题不能用近黑底：一整列空责任单位会变成黑块，像渲染坏了。改用浅红底 + 左侧红条，
   红 = 该填没填，琥珀 = 结构可疑。 */
html[data-theme="light"] .grid__cell.is-error {
  background: #fdeaea; color: #8a1f1f; box-shadow: inset 2px 0 0 #d64545;
}
.empty { text-align: center; color: var(--muted); padding: 2.4rem 1rem; margin: 0; font-size: var(--fs-15); }

/* ======== 弹层与说明 ======== */
/* ---- 抽屉 ---- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
html[data-theme="light"] .drawer__mask { background: rgba(15, 23, 42, 0.35); }
.drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(94vw, 440px); display: flex;
  flex-direction: column; background: var(--bg1); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-overlay); animation: slideIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer__head, .drawer__foot {
  display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1.05rem;
  border-bottom: 1px solid var(--border);
}
.drawer__foot { border-bottom: none; border-top: 1px solid var(--border); }
.drawer__head h2 { margin: 0; font-size: var(--fs-15); }
.drawer__body { flex: 1; overflow-y: auto; padding: 1.05rem; }
.drawer__body h3 {
  font-size: var(--fs-12); font-weight: 700; color: var(--muted); margin: 1.2rem 0 0.5rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.drawer__body h3:first-child { margin-top: 0; }
.col-editor { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.6rem; }
.col-row {
  display: grid; grid-template-columns: 1fr 110px 52px 30px 30px 30px; gap: 0.4rem;
  align-items: center;
}
/* ≤720 拆两行：名字独占一行，类型 + 必填 + 三个图标一行 —— 367 宽塞 6 格时列名框只剩 38px。 */
@media (max-width: 720px) {
  .col-row { grid-template-columns: minmax(110px, 1fr) 52px 38px 38px 38px; row-gap: 0.3rem; }
  .col-row > :nth-child(1) { grid-column: 1 / -1; }
  .col-row > :nth-child(4), .col-row > :nth-child(5), .col-row > :nth-child(6) { height: 38px; width: 100%; }
}
.col-req {
  display: flex; align-items: center; gap: 0.25rem; font-size: var(--fs-12); color: var(--text);
  white-space: nowrap; cursor: pointer;
}
.col-req input { margin: 0; }
.text-input, .col-name, .rules-input {
  width: 100%; font: inherit; font-size: var(--fs-13); color: var(--text); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.48rem 0.6rem;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.col-source {
  font: inherit; font-size: var(--fs-12); color: var(--text); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.42rem 0.4rem;
}
.rules-input { min-height: 190px; resize: vertical; line-height: 1.55; font-size: var(--fs-13); }
.switch {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; font-size: var(--fs-13);
  cursor: pointer;
}
.switch input { width: 15px; height: 15px; accent-color: var(--brand); }
/* ---- Toast：双主题统一深底白字 ---- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90;
  padding: 0.55rem 1rem; border-radius: var(--radius-sm); background: #1d2026;
  border: 1px solid #3d434c; color: #f2f4f6; font-size: var(--fs-13);
  box-shadow: var(--shadow-overlay); animation: toastIn 0.2s ease both;
  /* 带动作的提示（「已删除 1 行 [撤销]」）横排 */
  display: flex; align-items: center; gap: 0.9rem;
}
.toast__act {
  flex: none; font: inherit; font-size: inherit; font-weight: 700; color: #8ab4ff; background: none;
  border: 0; padding: 0.1rem 0.2rem; cursor: pointer; border-radius: var(--radius-2xs);
}
html[data-theme="light"] .toast__act { color: #7ca8ff; }
.toast__act:hover { background: rgba(138, 180, 255, 0.12); }
.toast__act:focus-visible { outline: 2px solid #8ab4ff; outline-offset: 1px; }
html[data-theme="light"] .toast { background: #191c20; border-color: #3d434c; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* ---- 批次栏 ---- */
.batchbar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.55rem 1.25rem;
  border-bottom: 1px solid var(--border); background: var(--bg1);
}
.batchbar__label { font-size: var(--fs-13); color: var(--muted); }
.batchbar__select {
  font: inherit; font-size: var(--fs-13); color: var(--text); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); height: var(--ctl-h);
  padding: 0 0.55rem; min-width: 170px; flex: 0 0 auto;
}
/* 工作表名常带「（8 行）」，170px 会把右括号吃掉，看着像乱码 */
#batch-select { min-width: 216px; }
.batchbar__spacer { flex: 1 1 auto; }
/* ---- 表格工具条（筛选/排序） ---- */
.tablebar { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
/* 桌面展开「列筛选」时控件总宽会超过工具条：放一个只读分隔符占满一行，
   把「存好的视图 / 不分组 / 条件」整组换到第二行，怎么缩窄都不出现孤零零一颗按钮。 */
.tablebar__brk { display: none; }
/* 「清除 筛选」在 flex 按钮里被 gap 拆成两个字中间空一格 */
#filter-clear { gap: 0; }
/* 「清除筛选」只在有筛选时出现（.has-filter 由 syncRowCount 按「筛出的行 ≠ 全部行」切） */
.tablebar:not(.has-filter) #filter-clear { display: none; }
@media (min-width: 881px) {
  .tablebar--adv .tablebar__brk { display: block; flex: 0 0 100%; height: 0; margin: -0.45rem 0 0; }
}
.tablebar__input, .tablebar__select {
  font: inherit; font-size: var(--fs-13); color: var(--text); background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); height: var(--ctl-h);
  padding: 0 0.55rem;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.tablebar__input:focus, .tablebar__select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.tablebar__input { min-width: 168px; }
.tablebar__select { min-width: 118px; }
.grid__th--sort { cursor: pointer; user-select: none; }
.grid__th--sort:hover { color: var(--text); }
/* 表头 ⇅ 常驻 0.42，悬停/已排序时全亮 —— 全藏会让人不知道这张表能排；键盘 Tab 到列头要有可见焦点。 */
.grid__th--sort:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 漏斗只在悬停或该列已筛选时出现：六个列头各挂两个图标常显会让表头变成工具栏。 */
.grid__sort {
  margin-left: 0.3rem; font-size: var(--fs-12); color: var(--muted); opacity: 0.42;
  transition: opacity var(--dur-1) var(--ease);
}
.grid__th:hover .grid__sort, .grid__sort.is-active, .grid__funnel.is-active { opacity: 1; }
@media (hover: none) {
  .grid__sort { opacity: 0.55; }
 }
.grid__sort.is-active { color: var(--accent-2); }
/* ---- 使用说明 ---- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; }
.modal__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
html[data-theme="light"] .modal__mask { background: rgba(15, 23, 42, 0.4); }
.modal__panel {
  position: relative; width: min(94vw, 540px); max-height: 86vh; overflow: auto;
  background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-overlay); animation: zoomIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes zoomIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.modal__head h2 { margin: 0; font-size: var(--fs-15); }
/* 对话框页脚顺序：危险动作最左，取消 ghost 次之，主操作永远最右；危险动作离主操作远一点防误点。 */
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem;
  padding: 0.85rem 1.15rem; border-top: 1px solid var(--border);
}
.modal__foot .btn--danger:not(:last-child) { margin-right: auto; }
.steps { margin: 0; padding: 1.05rem 1.25rem 0.5rem 2.6rem; }
.steps li { margin-bottom: 0.9rem; }
.steps li b { display: block; font-size: var(--fs-15); }
.steps li span {
  display: block; color: var(--muted); font-size: var(--fs-13); line-height: 1.65;
  margin-top: 0.15rem;
}
/* 先给流程图 + 三句短话，细节收进 details */
.flow {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 1.1rem 1.25rem 0.2rem;
}
.flow__step {
  background: var(--brand-soft); color: var(--text); border-radius: var(--radius-pill);
  padding: 0.3rem 0.72rem; font-size: var(--fs-13); font-weight: 600;
}
.flow__arrow { color: var(--muted); font-size: var(--fs-13); }
.steps-more { padding: 0 1.25rem 0.4rem; }
.steps-more > summary { cursor: pointer; color: var(--accent); font-size: var(--fs-13); padding: 0.5rem 0; }
.steps-more .steps { padding-left: 2.2rem; }
/* 虚线是「拖放区 / 还没做完」的语汇，成品页面用实线；桌面定高布局里铺满表格区并垂直居中，
   否则下面留 230px 空白，空态像没加载完。 */
.start {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem 1.2rem;
  text-align: center; margin: 0.4rem 0 1rem; background: var(--bg2);
}
@media (min-width: 881px) {
  .grid-wrap > .start:not([hidden]) {
    min-height: calc(100% - 1rem); margin: 0 0 0.6rem; display: flex; flex-direction: column;
    justify-content: center;
  }
}
.start__title { margin: 0 0 0.25rem; font-size: var(--fs-15); }
.start__sub { margin: 0 0 0.9rem; color: var(--muted); font-size: var(--fs-13); }
.start__acts { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.start__tip { margin: 0.9rem 0 0; color: var(--muted); font-size: var(--fs-12); }
.modal .hint { padding: 0 1.25rem 0.4rem; }
/* ---- 登录 / 注册 ---- */
.modal__panel--sm { width: min(94vw, 420px); }
.auth-body { padding: 1rem 1.15rem; }
.auth-body .field { margin-bottom: 0.75rem; }
.field--block { display: flex; flex-direction: column; gap: 0.3rem; }
.field--block input {
  font: inherit; font-size: var(--fs-15); color: var(--text); width: 100%;
  /* 和整站弹窗里的表单一样拉满内宽，右侧不留空白 */
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.field--block input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.tabs { display: flex; gap: 0.4rem; margin-bottom: 0.95rem; }
.tab {
  font: inherit; font-size: var(--fs-13); font-weight: 600; color: var(--muted);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 0.32rem 0.95rem; cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.tab:hover { color: var(--text); border-color: var(--border-strong); }
.tab.is-active { background: var(--text); color: var(--bg1); border-color: var(--text); }
.auth-error {
  margin: 0.7rem 0 0; font-size: var(--fs-13); color: var(--danger);
  background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; font-weight: 600;
}
html[data-theme="light"] .auth-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.auth-info { display: grid; grid-template-columns: 56px 1fr; gap: 0.55rem 0.7rem; margin: 0 0 0.4rem; }
.auth-info dt { color: var(--muted); font-size: var(--fs-13); }
.auth-info dd { margin: 0; font-size: var(--fs-15); font-weight: 600; word-break: break-all; }
#auth-logout { margin-left: 0; }
/* 顶栏账号固定最右，是这一行唯一的账户入口 */
#open-auth { height: var(--ctl-h-lg); flex: none; margin-left: auto; }
#open-auth.is-on { background: var(--brand-soft); border-color: var(--accent); color: var(--accent-2); }
#open-auth.is-on::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok, #2f9e6b);
  margin-right: 0.4rem; display: inline-block;
}
/* 菜单项右侧的补充说明（导入表格 / 快捷键） */
.more__hint { margin-left: auto; font-size: var(--fs-12); color: var(--muted); font-weight: 400; }
.more__item { display: flex; align-items: center; gap: 0.5rem; }
.sync-status { font-size: var(--fs-12); white-space: nowrap; }
.sync-status::before { content: "· "; opacity: 0.6; }
/* ---- 跨批次搜索结果 ---- */
.xresults {
  margin-bottom: 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg1); max-height: 250px; overflow: auto;
}
.xresults__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); background: var(--bg2);
  position: sticky; top: 0;
}
.xresults__list { list-style: none; margin: 0; padding: 0; }
.xresults__list li + li { border-top: 1px solid var(--border); }
.xr {
  display: flex; align-items: baseline; gap: 0.5rem; width: 100%; text-align: left; font: inherit;
  font-size: var(--fs-13); color: var(--text); background: transparent; border: none;
  padding: 0.42rem 0.6rem; cursor: pointer;
}
.xr:hover { background: var(--panel-2); }
.xr__batch {
  font-size: var(--fs-12); color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 0.05rem 0.5rem; white-space: nowrap; flex: none;
}
.xr__col { color: var(--muted); font-size: var(--fs-12); flex: none; }
.xr__val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 跳到结果时短暂高亮（与「需核对」同款反白） */
.grid tbody tr.is-flash > .grid__cell { background: #d7dade; color: #16181d; }
html[data-theme="light"] .grid tbody tr.is-flash > .grid__cell { background: #191c20; color: #fff; }
/* ---- 销项闭环 ---- */
.tablebar__gap { width: 1px; height: 20px; background: var(--border); }
.grid__cell--clear { text-align: center; min-width: 66px; white-space: nowrap; }
.clear-toggle {
  font: inherit; font-size: var(--fs-12); font-weight: 700; width: 100%; color: var(--text);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 0.16rem 0.5rem; cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.clear-toggle:hover { border-color: var(--border-strong); background: var(--panel-2); }
/* 未销项 = 待办（橙软底 pill），已销 = 绿软底 pill；实心黑块一列 20 个会把表格读成斑马线。 */
.grid__cell--clear:not(.is-done) .clear-toggle {
  background: var(--warn-soft); color: var(--warn); border-color: transparent;
}
html[data-theme="light"] .grid__cell--clear:not(.is-done) .clear-toggle {
  background: var(--warn-soft); color: var(--warn); border-color: transparent;
}
.grid__cell--clear.is-done .clear-toggle { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.grid__cell--clear.is-done { color: var(--muted); }
/* 责任单位 chip：按值稳定分色，同一家单位固定一个色，扫列时靠颜色分组 */
.unit-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-pill); font-size: var(--fs-12); font-weight: 600; line-height: 1;
  white-space: nowrap;
}
.unit-chip::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.65;
}
.unit-chip.u0 { background: #eef3ff; color: #1e40af; }
.unit-chip.u1 { background: #f3efff; color: #5b21b6; }
.unit-chip.u2 { background: #fdf0f6; color: #9d174d; }
.unit-chip.u3 { background: #e9f6f8; color: #155e75; }
.unit-chip.u4 { background: #f0f2f5; color: #334155; }
.unit-chip.u5 { background: #f7f2e8; color: #78600f; }
html[data-theme="dark"] .unit-chip.u0 { background: rgba(59,130,246,.16); color: #93c5fd; }
html[data-theme="dark"] .unit-chip.u1 { background: rgba(139,92,246,.18); color: #c4b5fd; }
html[data-theme="dark"] .unit-chip.u2 { background: rgba(236,72,153,.16); color: #f9a8d4; }
html[data-theme="dark"] .unit-chip.u3 { background: rgba(34,211,238,.14); color: #67e8f9; }
html[data-theme="dark"] .unit-chip.u4 { background: rgba(148,163,184,.16); color: #cbd5e1; }
html[data-theme="dark"] .unit-chip.u5 { background: rgba(234,179,8,.14); color: #fde68a; }
.clear-toggle:hover { filter: brightness(0.97); }
/* ---- 销项看板 ---- */
.modal__panel--board { width: min(96vw, 720px); }
.modal__panel--viewer { width: min(96vw, 880px); }
.board-body { padding: 1.05rem 1.15rem; }
.board-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.65rem; margin-bottom: 0.75rem; }
.kpi {
  border: 1px solid var(--border-row); border-radius: var(--radius-sm); background: var(--bg2);
  padding: 0.65rem 0.75rem;
}
.kpi b {
  display: block; font-size: var(--fs-23); font-weight: 750; letter-spacing: -0.02em;
  line-height: 1.15; font-variant-numeric: tabular-nums;
}
.kpi span { display: block; margin-top: 0.2rem; font-size: var(--fs-12); color: var(--muted); }
.board-bar { height: 8px; border-radius: var(--radius-pill); background: var(--panel-2); overflow: hidden; }
.board-bar i {
  display: block; height: 100%; width: 0; background: var(--brand);
  transition: width var(--dur-3) var(--ease);
}
.board-sec { margin-top: 1.2rem; }
.board-sec h3 { margin: 0 0 0.5rem; font-size: var(--fs-13); font-weight: 700; }
.board-scroll { max-height: 230px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.board-table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
}
.board-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap;
  padding: 0.42rem 0.65rem; background: var(--bg2); border-bottom: 1px solid var(--border-strong);
  font-weight: 600; font-size: var(--fs-12); color: var(--muted);
}
.board-table td { padding: 0.4rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.board-table tbody tr:nth-child(even) { background: rgba(127, 127, 127, 0.04); }
.board-table td:last-child { font-weight: 700; }
/* 未清项 > 0 的行，数字反白提醒 */
.board-table .is-pending {
  background: #d7dade; color: #16181d; font-weight: 700; border-radius: var(--radius-xs);
  padding: 0.06rem 0.4rem; display: inline-block;
}
html[data-theme="light"] .board-table .is-pending { background: #191c20; color: #fff; }
.board-table .is-zero { color: var(--muted); font-weight: 600; }
/* 统计表「占比」列：条内进度条，数字压在条上 */
.stats__share { width: 132px; }
.share-bar {
  position: relative; display: block; width: 100%; height: 20px; border-radius: var(--radius-xs);
  background: var(--bg2); box-shadow: inset 0 0 0 1px var(--border-row); overflow: hidden;
}
.share-bar i {
  position: absolute; inset: 0 auto 0 0; display: block; background: var(--brand-soft);
  border-right: 1px solid rgba(37, 99, 235, 0.45);
}
.share-bar b {
  position: relative; display: block; padding: 0 6px; font-size: var(--fs-12); font-weight: 600;
  line-height: 20px; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.board-mini {
  display: inline-block; width: 74px; height: 6px; border-radius: var(--radius-pill);
  background: var(--panel-2); overflow: hidden; vertical-align: middle; margin-right: 0.45rem;
}
.board-mini i { display: block; height: 100%; background: var(--brand); }
@media (max-width: 700px) {
  .board-kpis { grid-template-columns: repeat(2, 1fr); }
}
/* ---- 数据工具（回收站 / 备份 / 日志） ---- */
.badge {
  display: inline-block; min-width: 16px; margin-left: 0.35rem; padding: 0 0.32rem;
  border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--accent-2);
  font-size: var(--fs-11); font-weight: 800; text-align: center; line-height: 1.45;
}
.dt-body { padding: 1rem 1.15rem; }
.trash-list, .log-list {
  max-height: 300px; overflow: auto; margin-top: 0.7rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.trash-item, .log-item {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.52rem 0.7rem; font-size: var(--fs-13);
}
.trash-item + .trash-item, .log-item + .log-item { border-top: 1px solid var(--border); }
.trash-item__name {
  flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.trash-item__meta { color: var(--muted); font-size: var(--fs-12); white-space: nowrap; }
.trash-item__ops { display: flex; gap: 0.35rem; flex: none; }
.trash-ops { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.7rem; }
.trash-list .empty, .log-list .empty { padding: 1.6rem 1rem; }
.log-item { align-items: flex-start; }
.log-item time {
  color: var(--muted); font-size: var(--fs-12); white-space: nowrap; flex: none; width: 108px;
  font-variant-numeric: tabular-nums;
}
.log-item b { font-weight: 700; flex: none; }
.log-item .log-detail {
  color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.log-act {
  font-size: var(--fs-11); font-weight: 700; padding: 0.05rem 0.45rem;
  border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap; flex: none;
}
.log-act.is-danger {
  background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: rgba(248, 113, 113, 0.4);
}
.backup-ops { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
/* ---- 响应式 ---- */
@media (max-width: 880px) {
  .workspace { grid-template-columns: 1fr; padding: 0.9rem; }
  /* 手机上 136px 够看三行上下文；200px 会把结果表推到第二屏以下 */
  #raw-input { min-height: 136px; }
  .grid-wrap { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
/* ---- 成员管理 / 系统错误 ---- */
.dt-sub { margin: 1.1rem 0 0.45rem; font-size: var(--fs-13); }
.invite-row { display: flex; align-items: center; gap: 0.5rem; }
.invite-code {
  font-family: var(--mono); font-size: var(--fs-17); font-weight: 700; letter-spacing: 0.14em;
  padding: 0.3rem 0.7rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  user-select: all;
}
.tpl-io { display: flex; gap: 0.5rem; margin-top: 0.55rem; }
/* ---- Excel 式底部批次标签 ---- */
.sheetbar {
  display: flex; align-items: stretch; gap: 2px; padding: 0 0.9rem 0.5rem; overflow-x: auto;
  border-top: 1px solid var(--border); margin-top: 0.55rem; padding-top: 0.45rem;
}
.sheet-tab {
  display: inline-flex; align-items: center; gap: 0.4rem; height: var(--ctl-h); padding: 0 0.75rem;
  border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent;
  color: var(--muted); font-size: var(--fs-13); white-space: nowrap; cursor: pointer;
  user-select: none;
}
.sheet-tab:hover { color: var(--text); background: var(--panel-2); }
/* Teable 式选中片：白底凸起 + 发丝描边，不用色条 */
.sheet-tab.is-active {
  color: var(--text); font-weight: 700; background: var(--bg1); border-color: var(--border);
  box-shadow: var(--shadow-raised);
}
.sheet-tab__n { font-size: var(--fs-11); opacity: 0.75; font-variant-numeric: tabular-nums; }
.sheet-tab__x {
  border: none; background: none; color: var(--muted); font-size: var(--fs-12); line-height: 1;
  padding: 0.1rem 0.25rem; border-radius: var(--radius-2xs); cursor: pointer; visibility: hidden;
}
.sheet-tab:hover .sheet-tab__x, .sheet-tab__x:focus { visibility: visible; }
.sheet-tab__x:hover { color: var(--text); background: var(--panel-2); }
.sheet-add {
  border: 1px dashed var(--border); border-radius: var(--radius-xs); background: none;
  color: var(--muted); padding: 0.3rem 0.85rem; font-size: var(--fs-15); cursor: pointer;
}
.sheet-add:hover { color: var(--text); background: var(--panel-2); }
/* ---- 拖拽排序 ---- */
.sheet-tab__name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.sheet-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 合计条：多表才出现；单表时那行是废话 */
.sheet-sum {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0 0.9rem 0.45rem; color: var(--muted); font-size: var(--fs-12);
}
.sheet-sum__txt { font-variant-numeric: tabular-nums; }
.sheet-sum__btn {
  height: var(--ctl-h); padding: 0 0.7rem; border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--panel); color: var(--text);
  font-size: var(--fs-12); cursor: pointer;
}
.sheet-sum__btn:hover { background: var(--panel-2); }
/* 标签太多时的搜索入口：跟「跨表总览」并排，一起右对齐 */
.sheet-sum__acts { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.sheet-jump, .sheet-sum__pop {
  position: fixed; z-index: 60; width: 16rem; max-height: min(60vh, 22rem); overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-overlay); padding: 0.4rem;
}
.sheet-jump__q {
  width: 100%; height: var(--ctl-h-lg); padding: 0 0.6rem; margin-bottom: 0.35rem;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg1); color: var(--text); font-size: var(--fs-13);
}
.sheet-jump__list, .sheet-sum__body { display: flex; flex-direction: column; gap: 1px; }
.sheet-jump__item, .sheet-sum__row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  min-height: 40px; padding: 0 0.55rem; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--text); font-size: var(--fs-13); cursor: pointer; text-align: left;
}
.sheet-jump__item:hover, .sheet-sum__row:hover { background: var(--panel-2); }
.sheet-jump__item.is-active { background: var(--brand-soft); }
.sheet-sum__row.is-active { box-shadow: inset 2px 0 0 var(--accent); }
.sheet-jump__name, .sheet-sum__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-jump__n, .sheet-sum__meta { color: var(--muted); font-size: var(--fs-11); font-variant-numeric: tabular-nums; flex: none; }
.sheet-jump__none { padding: 0.6rem; color: var(--muted); font-size: var(--fs-12); }
.sheet-sum__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  padding: 0.25rem 0.55rem 0.4rem; font-size: var(--fs-12); font-weight: 600;
}
.sheet-sum__head-note { color: var(--muted); font-weight: 400; font-size: var(--fs-11); }
@media (max-width: 520px) {
  .sheet-jump, .sheet-sum__pop { width: calc(100vw - 16px); }
  .sheet-sum__btn { min-height: 40px; }
}
.sheetbar.is-dragging { cursor: grabbing; }
.sheetbar.is-dragging .sheet-tab { touch-action: none; }
.sheet-tab.is-armed { background: var(--panel-2); }
.sheet-tab.is-dragging { opacity: 0.55; }
.sheet-tab.is-drop-before { box-shadow: inset 3px 0 0 var(--brand); }
.sheet-tab.is-drop-after { box-shadow: inset -3px 0 0 var(--brand); }
/* ---- 工作表右键菜单 ---- */
.sheet-menu {
  position: fixed; z-index: 95; min-width: 11rem; display: flex; flex-direction: column; gap: 1px;
  padding: 0.3rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg1); box-shadow: var(--shadow-overlay);
}
.sheet-menu[hidden] { display: none; }
.sheet-menu button {
  border: none; background: none; color: var(--text); text-align: left; padding: 0.4rem 0.6rem;
  border-radius: var(--radius-xs); font-size: var(--fs-13); cursor: pointer;
}
.sheet-menu button:hover { background: var(--panel-2); }
.sheet-menu__head {
  padding: 0.3rem 0.6rem 0.35rem; font-size: var(--fs-12); color: var(--muted);
  border-bottom: 1px solid var(--border); margin-bottom: 0.2rem; max-width: 14rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.sheet-menu__danger { color: var(--danger); }
.sheet-menu__hint {
  padding: 0.3rem 0.6rem 0.1rem; margin-top: 0.2rem; border-top: 1px solid var(--border);
  font-size: var(--fs-11); color: var(--muted); max-width: 13rem; line-height: 1.35;
}
/* 只标「结构可能拆错了」：暖色和「白格」的灰白区分，不造第二个报警色系 */
tr.is-suspect > .grid__cell { background: rgba(251, 191, 36, 0.08); }
tr.is-suspect > .grid__cell--del { box-shadow: inset 3px 0 0 var(--warn); }
.suspect-btn { color: var(--warn); font-weight: 700; }
.suspect-btn:hover { background: rgba(251, 191, 36, 0.16); }
.suspect-legend {
  border: 1px solid rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.1); color: var(--warn);
  border-radius: var(--radius-pill); padding: 0.12rem 0.6rem; font-size: var(--fs-12);
  cursor: pointer; line-height: 1.5;
}
/* 人工确认过的行：⚠ 消失，留绿勾 + 极淡底色 */
tr.is-checked > .grid__cell { background: rgba(46, 158, 91, 0.055); }
tr.is-checked > .grid__cell--del { box-shadow: inset 3px 0 0 var(--ok, #2e9e5b); }
.chk-badge {
  display: inline-flex; align-items: center; justify-content: center; width: 1.02rem; height: 1.02rem;
  margin-right: 0.1rem; border-radius: 50%; background: var(--ok, #2e9e5b); color: #fff;
  font-size: var(--fs-11); font-weight: 800; line-height: 1; flex: 0 0 auto;
}
.suspect-legend:hover { background: rgba(251, 191, 36, 0.2); }
.suspect-legend[hidden] { display: none; }

/* ======== 卡片与照片 ======== */
/* ---- 行照片 ---- */
.icon-btn.has-photos { color: var(--text); font-weight: 700; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.photo-thumb {
  position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: zoom-in;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-del {
  position: absolute; top: 4px; right: 4px; border: none; border-radius: 50%; width: 22px;
  height: 22px; line-height: 20px; background: rgba(0,0,0,0.65); color: #fff; cursor: pointer;
  display: none; font-size: var(--fs-12);
}
.photo-thumb:hover .photo-del { display: block; }
.photo-thumb .photo-pending {
  position: absolute; left: 4px; bottom: 4px; background: var(--warn, #b45309); color: #fff;
  font-size: var(--fs-11); line-height: 1.5; padding: 0 0.3rem; border-radius: var(--radius-2xs);
  pointer-events: none;
}
.photo-grid .empty { grid-column: 1 / -1; }
.viewer-body { display: flex; justify-content: center; max-height: 68vh; overflow: auto; }
.viewer-body img { max-width: 100%; max-height: 66vh; object-fit: contain; }

/* ---- 照片标注 ----
   画布尺寸由 app.js 按图片长边算（≤1400），这里只管「装得下、能画」：
   touch-action:none 是关键，否则手机上手指一划是滚页面，不是画线 */
.modal__panel--mark { width: min(96vw, 60rem); }
.mark-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
}
.mark-tool {
  padding: 0.28rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg1); color: var(--text); font: inherit; font-size: var(--fs-12); cursor: pointer;
}
.mark-tool.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.mark-sep { width: 1px; height: 1.2rem; background: var(--border); margin: 0 0.2rem; }
.mark-color {
  width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0;
}
.mark-color.is-on { border-color: var(--text); box-shadow: 0 0 0 2px var(--brand-soft); }
.mark-color--red { background: #e5484d; }
.mark-color--yellow { background: #f5d90a; }
.mark-color--white { background: #ffffff; }
.mark-stage {
  display: grid; place-items: center; padding: 0.5rem; background: #0b0b0c;
  /* min-height:0 让它在弹窗撑满 max-height 时能被压小：压小了才量得到「还剩多少空间」 */
  min-height: 0; overflow: hidden;
}
/* 具体宽高由 app.js 量可用空间后写成 px（弹窗高度是 max-height 算的，CSS 拿不到）；
   这里只兜底：别撑破容器，别让手指拖动变成滚页面 */
.mark-stage canvas {
  max-width: 100%; touch-action: none; cursor: crosshair;
  border-radius: var(--radius-sm); background: #0b0b0c;
}
/* 确认/输入框永远在最上层，z-index 120 */
#appConfirm, #appPrompt { z-index: 120; }
.appConfirm__msg { white-space: pre-wrap; word-break: break-word; line-height: 1.7; margin: 0; color: var(--text); }
/* 核对原表结果 */
.verify__body { max-height: 54vh; overflow: auto; }
.verify__line { line-height: 1.8; font-size: var(--fs-13); word-break: break-word; }
.verify__head { font-weight: 700; margin-bottom: 0.4rem; }
.verify__ok { color: var(--ok); }
.verify__bad { color: var(--danger); font-weight: 600; }
.verify__hint { color: var(--muted); font-size: var(--fs-13); padding-left: 1rem; }
/* 整理对照：原句 → 区域/问题/单位逐条摆出；可疑行标 ⚠ */
.modal__panel--diff { width: min(96vw, 1080px); }
.diff__sum { margin: 0 1.1rem 0.5rem; font-size: var(--fs-13); color: var(--muted); }
.diff__list { max-height: 60vh; overflow: auto; padding: 0 0.6rem 0.6rem; }
.diff__row {
  display: grid; grid-template-columns: 2.2rem minmax(9rem, 1.1fr) minmax(12rem, 2fr) 1.2rem;
  align-items: center; gap: 0.5rem; width: 100%; padding: 0.35rem 0.5rem; border: 0;
  border-radius: var(--radius-xs); background: transparent; color: inherit; font: inherit;
  text-align: left; cursor: pointer;
  content-visibility: auto; contain-intrinsic-size: auto 2.2rem;
}
.diff__row:nth-child(odd) { background: rgba(127, 127, 127, 0.05); }
.diff__row:hover { background: var(--brand-soft); }
.diff__row.is-suspect { box-shadow: inset 3px 0 0 var(--warn); }
.diff__no { font-size: var(--fs-12); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
/* 不用 break-all：它会把「10-21」拆成「10-2 / 1」，只在真放不下时断行。 */
.diff__src { font-size: var(--fs-13); opacity: 0.85; word-break: normal; overflow-wrap: anywhere; }
.diff__out { display: flex; flex-wrap: wrap; gap: 0.35rem; min-width: 0; }
.diff__cell {
  font-size: var(--fs-13); padding: 0.05rem 0.4rem; border-radius: var(--radius-2xs);
  background: var(--panel-2); max-width: 26rem; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.diff__cell--area { color: var(--accent-2); }
.diff__cell--unit { color: var(--ok); }
.diff__warn { color: var(--warn); font-weight: 700; text-align: center; }
.diff__dup {
  flex: none; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-2xs);
  background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn);
  font-size: var(--fs-12); font-weight: 700; text-align: center; line-height: 18px;
}
.diff__row.is-dup .diff__src { text-decoration: underline dotted color-mix(in srgb, var(--warn) 70%, transparent); }
/* 2,000 行只先列 200 条：这行按钮既是剩余条数说明，也是继续看的入口。 */
.diff__more {
  display: block; width: 100%; min-height: 40px; margin-top: 0.35rem; padding: 0.4rem 0.6rem;
  border: 1px dashed var(--border); border-radius: var(--radius-xs); background: transparent;
  color: var(--muted); font: inherit; font-size: var(--fs-13); text-align: center; cursor: pointer;
}
.diff__more:hover,
.diff__more:focus-visible {
  color: var(--text); border-color: var(--accent); background: var(--brand-soft);
}
.diff__note {
  margin: 0.2rem 0 0.45rem; padding: 0.45rem 0.6rem; border-radius: var(--radius-xs);
  background: var(--panel-2); color: var(--muted); font-size: var(--fs-12); line-height: 1.5;
}
/* 格子联想浮层：fixed 定位，mousedown 接住 —— 比格子失焦先响应，点一下就填值。 */
.cell-suggest {
  position: fixed; z-index: 130; min-width: 200px; max-height: 220px; overflow: auto;
  background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-overlay); padding: 4px; display: flex; flex-direction: column; gap: 2px;
}
.cell-suggest__item {
  appearance: none; border: 0; background: none; text-align: left; font-size: var(--fs-13);
  font-family: inherit; color: var(--text); padding: 6px 10px; border-radius: var(--radius-2xs);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell-suggest__item:hover { background: var(--brand-soft); }
tr.is-flash > .grid__cell { animation: fx-flash 1.3s ease-out; }
@keyframes fx-flash {
  0% { background: var(--brand-soft); }
  100% { background: transparent; }
}
/* ---- 导入向导：逐列核对用途，防止表头错位导错列 ---- */
.modal__panel--imp { width: min(96vw, 860px); max-height: 88vh; display: flex; flex-direction: column; }
.imp__sum { margin: 0 0 0.4rem; font-size: var(--fs-13); color: var(--text); line-height: 1.6; }
.imp__hint { margin: 0 0 0.6rem; font-size: var(--fs-12); color: var(--muted); line-height: 1.5; }
.imp__head,
.imp__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 1fr) minmax(5rem, 0.95fr) 8.6rem minmax(5.5rem, 1fr);
  gap: 0.5rem; align-items: center;
}
.imp__head {
  font-size: var(--fs-12); color: var(--muted); padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border-strong);
}
.imp__map { overflow-y: auto; max-height: 38vh; border-bottom: 1px solid var(--border); }
.imp__row { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border); }
.imp__row:last-child { border-bottom: 0; }
.imp__row.is-skip { opacity: 0.45; }
.imp__src { font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 原表内容（每列两个真实值）灰一档，帮用户判断这列是什么 */
.imp__sample {
  font-size: var(--fs-12); color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.imp__row select,
.imp__row input {
  font: inherit; font-size: var(--fs-13); padding: 0.2rem 0.35rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--panel);
  color: var(--text); width: 100%; min-width: 0;
}
.imp__preview {
  margin: 0.5rem 0 0; font-size: var(--fs-12); color: var(--muted); line-height: 1.6;
  max-height: 8rem; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
/* ---- 结果表 / 统计 视图切换（灰轨道 + 白色凸起选中片） ---- */
.viewtabs {
  display: inline-flex; gap: 2px; margin: 0 0 0.65rem; padding: 2px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-row); background: var(--bg2);
}
.viewtabs__btn {
  border: 0; border-radius: var(--radius-xs); padding: 0.28rem 1rem; background: transparent;
  color: var(--muted); font: inherit; font-size: var(--fs-13); font-weight: 600; cursor: pointer;
}
.viewtabs__btn:hover { color: var(--text); }
.viewtabs__btn.is-active {
  background: var(--bg1); color: var(--text); font-weight: 700;
  box-shadow: var(--shadow-raised), 0 0 0 1px var(--border);
}
.stats { display: flex; flex-direction: column; gap: 0.8rem; padding: 0.2rem 0 0.6rem; }
.stats__head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.stats__title { margin: 0; font-size: var(--fs-15); font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
.stats__kpi { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.stats__kpi .kpi {
  /* 四张 KPI 卡等分（basis 0）：跟内容走的话「已销项」多一行小字就把自己撑宽。 */
  flex: 1 1 0; min-width: 8rem; padding: 0.55rem 0.8rem; border: 1px solid var(--border-row);
  border-radius: var(--radius-sm); background: var(--bg2);
}
.stats__kpi .kpi b {
  display: block; font-size: var(--fs-23); line-height: 1.25; color: var(--text);
  font-variant-numeric: tabular-nums;
}
/* KPI 语义配色：销掉绿、待清橙、完成率看进展 */
.stats__kpi #st-done, .board-kpis #kp-done { color: var(--ok); }
/* 「—」是「没在记」不是 0：模板没有销项列时退回中性灰，绿色破折号会像一条分隔线。 */
.stats__kpi #kpi-done.kpi--link #st-done { color: var(--muted); font-weight: 500; }
.stats__kpi #st-left, .board-kpis #kp-left { color: var(--warn); }
.stats__kpi .kpi span { font-size: var(--fs-12); color: var(--muted); }
/* 统计页图表区：分布环 + Top6 条 + 进度环 */
.stats__charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem; margin: 0.6rem 0; }
.chart {
  min-width: 0; padding: 0.7rem 0.85rem 0.85rem; border: 1px solid var(--border-row);
  border-radius: var(--radius-sm); background: var(--bg1);
}
.chart__head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.55rem; }
.chart__head h3 { margin: 0; font-size: var(--fs-13); font-weight: 650; color: var(--text); letter-spacing: 0.01em; }
.chart__head span { font-size: var(--fs-11); color: var(--muted); }
.chart__body { display: flex; align-items: center; gap: 1.1rem; min-height: 128px; }
.donut {
  position: relative; flex: 0 0 auto; width: 118px; height: 118px; border-radius: 50%;
  background: conic-gradient(var(--border-row) 0 100%);
  transition: background var(--dur-3) var(--ease);
}
.donut::before { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--bg1); }
.donut__mid { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut__mid b {
  display: block; font-size: var(--fs-23); font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.donut__mid span { font-size: var(--fs-11); color: var(--muted); }
.legend { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
/* 图例按内容排、整体左对齐：名字列 1fr 会把数字推到卡片最右，两行看不出对应。 */
.legend li {
  display: grid; grid-template-columns: 8px minmax(0, max-content) auto 42px; justify-content: start;
  align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--text);
}
.legend i { display: block; width: 8px; height: 8px; border-radius: 50%; }
.legend em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend span { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 7px; align-content: start; }
.brow {
  display: grid; grid-template-columns: minmax(52px, 5.2rem) minmax(0, 1fr) 24px; align-items: center;
  gap: 9px; font-size: var(--fs-12);
}
.brow > span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow > b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.track {
  height: 8px; border-radius: var(--radius-pill); background: var(--bg2);
  box-shadow: inset 0 0 0 1px var(--border-row); overflow: hidden;
}
.track > i {
  display: block; height: 100%; border-radius: var(--radius-pill); background: var(--brand);
  transition: width var(--dur-3) var(--ease);
}
.kpi--rate { position: relative; padding-right: 3rem; }
/* 统计页「未销项」卡片可点（→ 结果表只看逾期）；小字只在有逾期时出现 */
.kpi--link {
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.kpi--link:hover { background: var(--bg2); box-shadow: var(--shadow-raised); }
.kpi--link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi__sub {
  display: block; margin-top: 0.25rem; font-style: normal; font-size: var(--fs-11);
  color: var(--warn);
}
.kpi--link .kpi__sub::after { content: " ›"; color: var(--muted); }
.kpi__ring {
  position: absolute; right: 0.75rem; top: 50%; width: 34px; height: 34px; margin-top: -17px;
  border-radius: 50%; background: conic-gradient(var(--brand) 0 0, var(--border-row) 0 100%);
}
.kpi__ring::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg1); }
@media (max-width: 720px) {
  .stats__charts { grid-template-columns: 1fr; }
  .chart__body { min-height: 0; }
  .donut { width: 96px; height: 96px; }
  .donut::before { inset: 12px; }
}
/* 矮屏把图表 / KPI / 行距各收一点，让「合计」+ 脚注 + 工作表条一屏放下。
   不能改定高：面板与结果表共用一列 flex，定高会把统计区压成一条、内容互相叠。 */
@media (min-width: 881px) and (max-height: 820px) {
  .stats { gap: 0.5rem; padding: 0.2rem 0 0.4rem; }
  .stats__kpi { gap: 0.5rem; }
  .stats__kpi .kpi { padding: 0.4rem 0.7rem; }
  .stats__charts { margin: 0.4rem 0; gap: 0.5rem; }
  .chart { padding: 0.5rem 0.7rem 0.55rem; }
  .chart__body { min-height: 88px; }
  .donut { width: 88px; height: 88px; }
  .donut::before { inset: 11px; }
  .stats__table { font-size: var(--fs-13); }
  .stats__table th, .stats__table td { padding: 0.36rem 0.7rem; }
  .stats__hint { margin-top: 0.4rem; }
}
.stats__wrap {
  overflow: auto; max-height: 62vh; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg1);
}
.stats__table { width: 100%; border-collapse: collapse; font-size: var(--fs-15); color: var(--text); }
.stats__table th,
.stats__table td { padding: 0.5rem 0.75rem; text-align: right; white-space: nowrap; }
.stats__table th:first-child,
.stats__table td:first-child { text-align: left; }
.stats__table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg2); color: var(--muted);
  border-bottom: 1px solid var(--border-strong); font-weight: 600; font-size: var(--fs-13);
}
.stats__table tbody td { border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.stats__row { cursor: pointer; }
.stats__row:hover td { background: var(--panel-2); }
.stats__sum td { border-top: 2px solid var(--border-strong); font-weight: 700; background: var(--panel-2); }
.stats__building { font-weight: 700; }
.stats__table .muted { color: var(--muted); }
.stats__table .is-pending { color: var(--warn); font-weight: 700; }
.stats__table .is-zero { color: var(--ok); font-weight: 700; }
/* 楼栋 × 楼层热力图：格子底色用 --accent 透明度分 5 档，不新造颜色；浅档正文色、深档反白。 */
.heat__cell {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px;
  min-height: 24px; padding: 0 .4rem; border-radius: var(--radius-2xs); font-size: var(--fs-12);
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.heat__cell--l1 { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.heat__cell--l2 { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.heat__cell--l3 { background: color-mix(in srgb, var(--accent) 48%, transparent); }
.heat__cell--l4 { background: color-mix(in srgb, var(--accent) 66%, transparent); color: #fff; }
.heat__cell--l5 { background: color-mix(in srgb, var(--accent) 85%, transparent); color: #fff; }
.stats__table td:hover > .heat__cell { outline: 2px solid var(--accent); outline-offset: -2px; }
.stats__table .board-mini {
  display: inline-block; width: 5rem; height: 0.4rem; margin-right: 0.4rem;
  border-radius: var(--radius-pill); background: var(--panel-2); overflow: hidden;
  vertical-align: middle;
}
.stats__table .board-mini i { display: block; height: 100%; background: var(--brand); }
.stats__hint { margin: 0; font-size: var(--fs-12); color: var(--muted); }
/* ---- 每列漏斗 + 多级排序 ---- */
.grid__funnel {
  border: none; background: none; cursor: pointer; margin-left: 0.25rem; padding: 0 0.15rem;
  color: var(--muted); font-size: var(--fs-12); line-height: 1; border-radius: var(--radius-2xs);
  opacity: 0; transition: opacity var(--dur-1) var(--ease);
}
.grid__th:hover .grid__funnel, .grid__funnel.is-active { opacity: 1; }
@media (hover: none) {
  .grid__funnel { opacity: 0.55; }
 }
.grid__funnel:hover { color: var(--text); background: var(--panel-2); }
.grid__funnel.is-active { color: var(--brand); font-weight: 700; }
.grid__sort-n { font-size: var(--fs-11); margin-left: 1px; color: var(--brand); }
.grid__rz { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
/* 末列拖动柄收回格内：伸出 3px 会让表格底下凭空多一条横向滚动条。 */
.grid thead th:last-child .grid__rz { right: 0; }
.grid__th { position: sticky; }
/* 窗口化渲染的上下占位行：只撑高度不画东西（见 js/table.js startVirtual） */
.grid__pad { pointer-events: none; }
.grid__pad-cell { padding: 0 !important; border: 0 !important; background: transparent !important; height: 0; }
.grid__pad td { line-height: 0; font-size: 0; }
.chips { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.filter-chip, .sort-chip {
  display: inline-flex; align-items: center; gap: 0.2rem; font-size: var(--fs-12); font-weight: 600;
  padding: 0.1rem 0.25rem 0.1rem 0.45rem; border-radius: var(--radius-pill);
  background: var(--brand-soft); color: var(--accent-2); border: 1px solid var(--border-row);
  white-space: nowrap;
}
html[data-theme="dark"] .filter-chip, html[data-theme="dark"] .sort-chip { color: var(--accent-2); }
.filter-chip__x, .sort-chip__x {
  border: none; background: none; cursor: pointer; color: inherit; font-size: var(--fs-12);
  line-height: 1; padding: 0 0.2rem; border-radius: 50%;
}
.filter-chip__x:hover, .sort-chip__x:hover { background: rgba(0,0,0,0.12); }
html[data-theme="dark"] .filter-chip__x:hover, html[data-theme="dark"] .sort-chip__x:hover {
  background: rgba(255,255,255,0.15);
}
/* 漏斗弹窗（复用 sheet-menu 骨架 + 专属段） */
.colfilter { min-width: 250px; max-width: 300px; max-height: 70vh; overflow: auto; }
.colfilter__search {
  width: calc(100% - 0.6rem); margin: 0.3rem; font: inherit; font-size: var(--fs-13);
  color: var(--text); background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 0.3rem 0.5rem;
}
.colfilter__search:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.colfilter__floors { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.2rem 0.4rem; align-items: center; }
.colfilter__sec { font-size: var(--fs-11); color: var(--muted); width: 100%; }
.colfilter__floor {
  border: 1px solid var(--border-row); background: var(--bg2); color: var(--text);
  font-size: var(--fs-12); border-radius: var(--radius-pill); padding: 0.06rem 0.45rem;
  cursor: pointer;
}
.colfilter__floor:hover { border-color: var(--accent); color: var(--accent-2); }
.colfilter__list { max-height: 240px; overflow: auto; padding: 0.15rem 0.3rem; }
.colfilter__item {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.18rem 0.3rem;
  border-radius: var(--radius-xs); font-size: var(--fs-13); cursor: pointer;
  /* 楼栋房号这种近唯一列能凑出上万项：列表只有 240px 高，一屏十来行，
     其余的行不参与布局（实测 9900 行 366ms → 90ms 上下），滚动条长度按行高算不变。
     19px 是内容盒高度（整行 24.75px 减掉上下 0.18rem 内边距），别写成整行高，否则滚动条会被撑长 */
  content-visibility: auto;
  contain-intrinsic-size: auto 19px;
}
.colfilter__item:hover { background: var(--panel-2); }
.colfilter__item input { accent-color: var(--brand); }
.colfilter__item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colfilter__item em { font-style: normal; font-size: var(--fs-11); color: var(--muted); white-space: nowrap; }
.colfilter__foot { display: flex; gap: 0.35rem; padding: 0.35rem 0.4rem; border-top: 1px solid var(--border); }
.colfilter__foot button {
  border: 1px solid var(--border); background: var(--bg1); color: var(--text);
  font-size: var(--fs-12); border-radius: var(--radius-xs); padding: 0.18rem 0.55rem; cursor: pointer;
}
.colfilter__foot button:hover { border-color: var(--border-strong); background: var(--panel-2); }
.colfilter__foot .colfilter__ok {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700;
}
.colfilter__foot .colfilter__ok:hover { background: var(--accent-2); }
/* 冻结首列（房号）：横向滚动时始终可见 */
.grid th.is-freeze, .grid td.is-freeze {
  position: sticky; left: 66px; z-index: 1; background: var(--bg1);
  border-right: 1px solid var(--border);
}
.grid th.is-freeze { z-index: 3; background: var(--bg2); left: 66px; }
.grid__th--del { left: 0; }
.grid__th--sel, .grid__cell--sel { left: 36px; }
.grid .grid__th--del, .grid .grid__cell--del { position: sticky; left: 0; z-index: 1; background: var(--bg1); }
.grid .grid__th--del { z-index: 3; background: var(--bg2); }
/* 销项/删除是手机卡片的侧滑层；平板/桌面没有侧滑，它退回普通 div 会挤到第二行，
   所以表格模式一律压成与徽章同一行，宽度交给横向滚动。 */
@media (min-width: 721px) {
  .grid td .swipe-acts {
    display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; white-space: nowrap;
    vertical-align: middle;
  }
  .grid td .swipe-acts .swipe-acts__btn { white-space: nowrap; }
  .grid td .unit-chip { white-space: nowrap; }
}
/* 打印：A4 横版，一页能放下就放下，表头每页重复，行不被撕开，稿顶带「工作表 / 筛选 / 条数」出口对账。 */
.print-head { display: none; }
/* 继承来的楼栋/区域要一眼看出来：跨栋漏写楼栋时裸户号会静默挂到上一栋，错得毫无痕迹。 */
.grid__cell.is-inh { position: relative; }
.grid__cell.is-inh:not(.is-error) { background: rgba(74, 141, 246, 0.05); }
html[data-theme="dark"] .grid__cell.is-inh:not(.is-error) { background: rgba(74, 141, 246, 0.13); }
.grid__cell.is-inh::after {
  content: "↑"; position: absolute; right: 3px; top: 1px; font-size: var(--fs-11); line-height: 1;
  color: var(--accent, #4a8df6); opacity: 0.55; pointer-events: none;
}
@media print {
  @page { size: A4 landscape; margin: 10mm 8mm; }
  /* 屏幕上的一切壳子都不进纸 */
  .topbar, .batchbar, .panel:first-of-type, .panel__head, .panel__tools, .tablebar,
  .selbar, .viewtabs, .panel__foot, .sheetbar, .chips, .grid__funnel, .grid__rz,
  .grid__group-toggle, .grid__group-only, .grid__group-hint, .suspect-legend,
  .flag-legend, .toast, .drawer, .modal, .xresults, .row-select,
  .grid__th--sel, .grid__cell--sel, .grid__th--del, .grid__cell--del,
  .grid__sort, .grid__sort-n, .grid__col-src,
  /* 拍照按钮实际用 icon-btn icon-btn--sm，.photo-btn 是死类 */
  .suspect-btn, .clear-toggle {
    display: none !important;
  }
  /* 打印只要表格本身：隐藏 more-layer 与卡片上的操作按钮排 */
  .more-layer, .card-tools, .card__actions { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .workspace { display: block; padding: 0; }
  .panel { border: none; padding: 0; background: #fff; }
  .grid-wrap { max-height: none; overflow: visible; border: none; border-radius: 0; }
  /* 打印头：工作表名 + 筛选条件 + 条数 + 时间 */
  .print-head { display: block !important; margin: 0 0 6px; }
  .print-head__title { font-size: 13pt; margin: 0 0 2px; font-weight: 700; }
  .print-head__meta { font-size: 9pt; margin: 0; color: #333; }
  .grid { width: 100%; border-collapse: collapse; background: #fff; }
  .grid thead { display: table-header-group; }
  /* 每页自动重复表头 */
  .grid tfoot { display: none; }
  .grid tr { break-inside: avoid; page-break-inside: avoid; }
  .grid__th, .grid__cell {
    position: static !important; background: transparent !important; color: #000 !important;
    border: none; border-bottom: 1px solid #bbb; padding: 3px 4px; font-size: 9pt; max-width: none;
    box-shadow: none !important;
  }
  .grid__th { border-bottom: 1.2px solid #333; font-weight: 700; background: #eee !important; }
  /* 时间列不折行：换行会把日期拆成两段 */
  .grid [data-col="c_date"] { white-space: nowrap; }
  /* 屏幕上限 3 行的长描述，落到纸上要全文（见 makeCell 的 is-long） */
  .cell-clamp { display: block !important; overflow: visible !important; -webkit-line-clamp: unset !important; }
  .grid__col-src { border: none; background: none; padding: 0; font-size: 7.5pt; color: #555; }
  .grid__col-src::before { display: none; }
  /* 黑白打印机：靠灰阶和描边表达，不要整片黑块 */
  .grid__cell.is-error {
    background: #eee !important; color: #000 !important; box-shadow: inset 2px 0 0 #000 !important;
  }
  .grid tr.is-suspect > .grid__cell { background: #f2f2f2 !important; box-shadow: none !important; }
  .grid tr.is-checked > .grid__cell { background: transparent !important; box-shadow: none !important; }
  .grid tr.is-checked > .grid__cell--del { box-shadow: inset 2px 0 0 #666 !important; }
  .chk-badge { background: #fff !important; color: #000 !important; border: 1px solid #000; }
  .grid tr.is-selected > .grid__cell { background: transparent !important; }
  .grid tr.grid__group > td {
    position: static !important; background: #e6e6e6 !important; border-top: 1px solid #333;
    border-bottom: 1px solid #333; font-weight: 700; font-size: 9pt;
  }
  a { color: #000; text-decoration: none; }
  /* 手机端打印：隐藏底部导航，卡片流在纸上恢复表格版式（A4 横向按列出表）。 */
  .mnav { display: none !important; }
  .grid tr { display: table-row !important; }
  .grid th, .grid td { display: table-cell !important; }
  .grid .grid__cell--room { font-weight: 600; }
  .board-table { width: 100%; border-collapse: collapse; background: #fff; }
  .board-table thead { display: table-header-group; }
  .board-table tr { break-inside: avoid; page-break-inside: avoid; }
  .board-table th, .board-table td {
    position: static !important; background: transparent !important; color: #000 !important;
    border: none; border-bottom: 1px solid #bbb; padding: 3px 4px; font-size: 9pt; max-width: none;
    box-shadow: none !important;
  }
  .board-table th { border-bottom: 1.2px solid #333; font-weight: 700; background: #eee !important; }
}
/* 销项报告：#print-report 平时不出屏，body.print-report 时只打印报告容器；
   A4 横版、表头每页重复、行不撕开沿用上面的 @media print 基线。 */
#print-report { display: none; }
@media print {
  body.print-report .workspace,
  body.print-report .print-head { display: none !important; }
  body.print-report #print-report { display: block !important; }
  .report__title { font-size: 13pt; margin: 0 0 2px; font-weight: 700; }
  .report__meta { font-size: 9pt; margin: 0 0 8px; color: #333; }
  .report__h2 { font-size: 10.5pt; margin: 10px 0 4px; }
  .report__table { width: 100%; border-collapse: collapse; }
  .report__table thead { display: table-header-group; }
  .report__table tr { break-inside: avoid; page-break-inside: avoid; }
  .report__table th, .report__table td {
    border: 1px solid #999; padding: 3px 5px; font-size: 9pt; text-align: left; vertical-align: top;
  }
  .report__table th { background: #eee !important; font-weight: 700; }
  .report__table td.is-num { text-align: right; }
  .report__table tr.is-total td { font-weight: 700; background: #f2f2f2 !important; }
  /* 报告四格概览 / 类型分布与单位排名条形 / 逾期提醒；全是打印口径（pt、灰阶），不占令牌。 */
  .report__kpi { display: flex; gap: 6px; margin: 0 0 8px; }
  .report__kpi-box { flex: 1; border: 1px solid #999; padding: 5px 7px; }
  .report__kpi-box b { display: block; font-size: 15pt; line-height: 1.1; }
  .report__kpi-box span { font-size: 8pt; color: #444; }
  .report__alert {
    font-size: 9pt; margin: 0 0 8px; padding: 4px 7px; border-left: 3px solid #c00; background: #fdf0f0;
  }
  .report__table--type td .report__bar,
  .report__table--unit td .report__bar {
    display: inline-block; height: 7px; margin-right: 5px; vertical-align: 1px; background: #7a9cc6;
    max-width: 60%;
  }
  .report__table--unit td .report__bar--warn { background: #c98b3a; }
  .report__table td.is-over { color: #b00; font-weight: 700; }
  /* 交付件三块：每家一页的整改通知单（带签收/复查栏）/ 照片墙 / 三方签认页；同为打印口径，不占令牌。 */
  .report__unit, .report__wall, .report__sign-page { break-before: page; page-break-before: always; }
  .report__h2--notice { font-size: 12pt; margin-top: 0; }
  .report__sign { margin-top: 12px; padding-top: 6px; border-top: 1px dashed #999; }
  .report__sign p { font-size: 9pt; margin: 10px 0 0; }
  .report__shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .report__shot { margin: 0; break-inside: avoid; page-break-inside: avoid; }
  .report__shot img {
    display: block; width: 100%; height: 50mm; object-fit: cover; border: 1px solid #bbb;
    background: #f4f4f4;
  }
  .report__shot figcaption { font-size: 7.5pt; color: #333; margin-top: 2px; line-height: 1.3; }
  .report__sign-row { font-size: 10.5pt; margin: 26px 0 0; }
}
/* ---- 合并视图：组头吸顶可折叠 ---- */
.grid tr.grid__group > td {
  position: sticky; top: 33px; z-index: 2; background: var(--bg2);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 0.32rem 0.7rem; font-size: var(--fs-13); cursor: pointer; user-select: none;
}
.grid__group-toggle {
  border: none; background: none; cursor: pointer; color: var(--muted); font-size: var(--fs-12);
  width: 18px; text-align: center;
}
.grid__group-meta { color: var(--muted); font-size: var(--fs-12); margin-left: 0.5rem; }
.grid__group-hint { color: var(--muted); font-size: var(--fs-11); margin-left: 0.7rem; opacity: 0.8; }
/* 手机换短句：长句在 390 上会断成三行，把组头撑到 63px */
.grid__group-hint-short { display: none; }
@media (max-width: 720px) {
  .grid__group-hint-long { display: none; }
  .grid__group-hint-short { display: inline; }
}
.grid__group-only {
  float: right; border: 1px solid var(--border); background: var(--bg1); color: var(--text);
  font-size: var(--fs-12); border-radius: var(--radius-xs); padding: 0.1rem 0.5rem; cursor: pointer;
}
.grid__group-only:hover { border-color: var(--accent); color: var(--accent-2); }
.grid tr.is-group-hidden > td { display: none; }
.grid tr.is-group-hidden { height: 0; }
/* 按列筛选的两个下拉默认收起：表头漏斗已能干这事，并排摆着只会挤窄搜索框；点「列筛选」才展开。 */
.tablebar #filter-col, .tablebar #filter-val { display: none; }
.tablebar--adv #filter-col, .tablebar--adv #filter-val { display: inline-flex; }
.tablebar__count {
  font-size: var(--fs-12); color: var(--accent); white-space: nowrap; padding: 0 2px;
  font-weight: 600;
}
/* 条子里已有右对齐的「筛出 x / 共 y 行」，条件按钮后的「显示 x / y」是同一件事，桌面收掉。 */
#filter-info { display: none; }
/* basis 用 0 而不是 260px：固定基准会先换行，给 0 让它吃剩余宽度，放不下时自己收窄到 12rem。 */
.tablebar__search {
  position: relative; display: flex; align-items: center; flex: 1 1 0; max-width: 460px;
  min-width: 12rem;
}
.tablebar__search > #filter-text { flex: 1 1 auto; width: 100%; max-width: none; min-width: 0; }
/* 搜索框跟着工具条变宽：钉死 172px 会把占位提示截断，右边还空一大截。 */
.tablebar #filter-text { flex: 1 1 260px; max-width: 460px; width: auto; }
/* 手机上主操作与工具条给到 44（Apple HIG 最小触控目标）；卡片里的按钮按 40 收，否则一张卡撑成两屏。 */
@media (max-width: 720px) {
  #run { height: 44px; }
  .batchbar select, .batchbar .btn, .tablebar .btn, .tablebar__input, .tablebar__select { min-height: 40px; }
  .panel__head .icon-btn, .panel__tools .icon-btn, .card-ops .icon-btn { min-width: 40px; min-height: 40px; }
  .mnav__btn { min-height: 48px; }
}
@media (max-width: 720px) {
  .grid-wrap { max-height: none; overflow: visible; border: none; background: transparent; padding: 0; }
  .grid { display: block; width: 100%; border-collapse: separate; border-spacing: 0; }
  .grid thead { display: none; }
  /* 字段名改由每格 ::before 显示 */
  .grid tbody { display: block; }
  /* 卡片顶栏：勾选框在左、拍照/删除在右 —— 删除 ✕ 挨着缩略图放左上角正好落在拇指位，一次误触就删。 */
  .grid tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; position: relative; margin: 0 0 0.7rem;
    padding: 0.2rem 0 0.25rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg1); box-shadow: var(--shadow-raised);
  }
  html[data-theme="dark"] .grid tbody tr { box-shadow: none; }
  .grid tbody tr.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
  .grid tbody tr.is-suspect { border-color: var(--warn); border-left-width: 3px; }
  .grid tbody tr:hover > .grid__cell,
  .grid tbody tr.is-selected > .grid__cell { background: transparent; }
  /* 卡片顶栏：⚠/📷/✕ + 勾选框，列序是删除格、勾选格、数据列 */
  .grid .grid__cell--del,
  .grid .grid__cell--sel {
    display: inline-block; width: auto; padding: 0.4rem 0.5rem; border: none; vertical-align: middle;
    background: transparent;
  }
  .grid .grid__cell--sel { order: 1; }
  /* 顶栏三个图标收到 34px、内边距减半，一行装得下房号；否则房号长一点就换行，标题行空一片。 */
  .grid .grid__cell--del { padding: 0.2rem 0.25rem; }
  .grid .grid__cell--del .icon-btn { width: 34px; height: 34px; }
  .grid .grid__cell--sel { padding: 0.3rem 0.4rem; }
  /* 动作格排到标题行最右：房号+区域先占位，auto 外边距把按钮顶过去 */
  .grid .grid__cell--del { order: 3; margin-left: auto; }
  .grid tbody tr > .grid__cell:not(.grid__cell--del):not(.grid__cell--sel) { order: 4; width: 100%; }
  /* 现场看一张卡最要紧的是「销了没有」：销项提到顶栏正下方第一位，序号收掉，时间放卡片尾当小字注脚。 */
  .grid tbody tr > .grid__cell:not(.grid__cell--del):not(.grid__cell--sel)[data-label="是否销项"] {
    order: 3; border-top: none; padding-top: 0.55rem;
  }
  .grid tbody tr > .grid__cell[data-label="是否销项"] .clear-toggle { min-height: 36px; font-size: var(--fs-14); }
  .grid tbody tr > .grid__cell[data-col="c_index"] { display: none; }
  .grid tbody tr > .grid__cell[data-label="时间"],
  .grid tbody tr > .grid__cell[data-label="日期"] {
    order: 9; border-top: none; color: var(--muted); font-size: var(--fs-12); padding-top: 0;
    padding-bottom: 0.6rem;
  }
  .grid tbody tr > .grid__cell[data-label="时间"]::before,
  .grid tbody tr > .grid__cell[data-label="日期"]::before {
    opacity: 0.7;
  }
  /* 单位胶囊靠左、日期靠右同排；特异性要压过上面 .is-slimmable 的 order:9，否则日期另起一行。 */
  html[data-density] .grid tbody tr > .grid__cell[data-col="c_date"].is-slimmable,
  html[data-density] .grid tbody tr > .grid__cell[data-label="时间"]:not([data-col]) {
    display: block; width: auto; flex: 1 1 auto; order: 5; margin-left: auto; text-align: right;
  }
  html[data-density] .grid tbody tr > .grid__cell[data-col="c_unit"] {
    width: auto; flex: 0 1 auto; padding-right: 0.3rem;
  }
  /* 卡片不横滚，冻结列的 sticky 只剩副作用：Chromium 给整格单开合成层，卡片被裁掉一角的残影就是它。 */
  .grid .grid__cell--del { position: static; left: auto; z-index: auto; }
  .grid .grid__cell--sel { position: static; left: auto; padding-left: 0.1rem; }
  .grid .grid__cell--del .icon-btn { font-size: var(--fs-15); padding: 0.32rem 0.44rem; }
  .grid .grid__cell--del .icon-btn[data-act="photo"] {
    background: var(--brand-soft); border-radius: var(--radius-sm); font-size: var(--fs-17);
  }
  html[data-density] .grid tbody tr > .grid__cell.grid__cell--room,
  html[data-density] .grid tbody tr > .grid__cell.grid__cell--area {
    width: auto; order: 2; border-top: none;
  }
  html[data-density] .grid tbody tr > .grid__cell.grid__cell--room {
    flex: 0 1 auto; min-width: 0; margin-left: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
  }
  html[data-density] .grid tbody tr > .grid__cell.grid__cell--area {
    /* 区域必须可压缩 + 省略号：不可压时房号一长就把图标挤到第二行。 */
    flex: 0 1 auto; min-width: 0; margin: 0.52rem 0 0 0.1rem; padding: 0.1rem 0.85rem 0.1rem 0;
    background: none; font-size: var(--fs-13); color: var(--muted); line-height: 1.5; max-width: 42%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* 字段名那条规则的优先级是 (0,4,0)，选择器必须带 [data-label]:not([data-label=""])，否则残留一个绝对定位的标签叠在标题上。 */
  .grid tbody tr > .grid__cell.grid__cell--room[data-label]:not([data-label=""])::before { display: none; }
  .grid tbody tr > .grid__cell.grid__cell--area[data-label]:not([data-label=""])::before {
    content: "·"; position: static; display: inline; width: auto; top: auto; left: auto;
    margin-right: 0.34rem; font-weight: 400; opacity: 0.55;
  }
  /* 冻结列的那条竖线是给桌面横向滚动定位用的；手机上卡片不横滚，竖线正好落在「房号 · 区域」中间 */
  .grid tbody tr > .grid__cell.is-freeze { border-right: 0; }
  /* 数据格：字段名做成行内前缀，值紧贴标签，一行装得下就不换行；卡高 175 → 141，390 一屏从 3 条变 5 条。 */
  .grid .grid__cell {
    display: block; width: auto; max-width: none; min-width: 0; position: relative;
    padding: 0.24rem 0.75rem; border: none; font-size: var(--fs-15); line-height: 1.5;
    word-break: break-word;
  }
  .grid .grid__cell:empty:not([data-req="1"]) { display: none; }
  /* 空着的次要格不占一整行 */
  /* 必填列空着不能藏：现场要一眼看出「这条还没填谁」 */
  .grid .grid__cell:empty[data-req="1"]::after {
    content: "未填"; color: var(--muted); font-size: var(--fs-13); opacity: 0.75;
  }
  /* 问题描述是卡片主体，加半档字重先被看到；字号仍走 --fs-15，不新造令牌。 */
  .grid .grid__cell--grow { font-weight: 500; }
  .grid .grid__cell[data-label]:not([data-label=""])::before {
    /* position 必须显式写 static：上面那条基础规则给过 absolute/left/top，只改 display 还会叠在值上面。 */
    content: attr(data-label) "\FF1A"; position: static; display: inline; width: auto; left: auto;
    top: auto; margin: 0 0.15rem 0 0; color: var(--muted); font-size: var(--fs-12); font-weight: 500;
    white-space: normal; overflow: visible; text-overflow: clip;
  }
  .grid .grid__cell--grow[data-label]:not([data-label=""])::before,
  .grid .grid__cell[data-col="c_unit"][data-label]:not([data-label=""])::before {
    display: none;
  }
  .grid th.is-freeze { position: static; left: auto; }
  /* td 不能一起 static：字段名是绝对定位的 ::before，td 一旦 static 就会挂到 tr 上，字段名跑到卡片顶栏。 */
  .grid td.is-freeze { position: relative; left: auto; }
  .grid__rz { display: none; }
  /* 现场单手点：📷/⚠/✕ 抬到 34~36 并留 4px 间距，相邻按钮才不抢点击。 */
  .grid .grid__cell--del .icon-btn {
    min-width: 34px; min-height: 34px; display: inline-flex; align-items: center;
    justify-content: center; margin-right: 2px;
  }
  .grid .grid__cell--del .icon-btn[data-act="del"] {
    border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg1);
    color: var(--muted);
    /* 顶栏这两个控件最常按；顶栏本身 48 高，撑到 40 不会再长高 */
    width: 36px; height: 36px;
  }
  .grid .grid__cell--sel { min-height: 40px; }
  .grid .grid__cell--sel .row-select { width: 18px; height: 18px; }
  /* 密度规则的 padding 特异性更高，会盖掉卡片自己那份；这里只补 padding，不动 display（否则把 del/sel 的 inline-flex 压回 block）。 */
  html[data-density="compact"] .grid .grid__cell[data-label],
  html[data-density="cozy"] .grid .grid__cell[data-label],
  html[data-density="comfortable"] .grid .grid__cell[data-label] {
    padding: 0.24rem 0.75rem;
  }
  /* 房号当卡片标题，字号提一档；必须写在密度规则之后，否则被带 html[data-density] 前缀的规则覆盖。选择器同时认 data-col 与 .grid__cell--room 两种模板。 */
  html[data-density] .grid .grid__cell[data-col="c_room"][data-label],
  html[data-density] .grid .grid__cell.grid__cell--room[data-label] {
    padding: 0.15rem 0 0.55rem 0.85rem; border-top: none; font-size: var(--fs-16); font-weight: 650;
    background: transparent; box-shadow: none; text-align: left;
  }
  html[data-density] .grid .grid__cell[data-col="c_room"][data-label]::before,
  html[data-density] .grid .grid__cell.grid__cell--room[data-label]::before {
    display: none;
  }
  /* 日期放卡片页脚一行小字：slim 会把它一起收掉，现场想按日期追溯就没处看。 */
  html[data-density] .grid tbody tr > .grid__cell[data-col="c_date"].is-slimmable { display: block; order: 9; }
  html[data-density] .grid .grid__cell[data-col="c_date"][data-label] {
    padding: 0 0.85rem 0.42rem; border-top: none; font-size: var(--fs-12); color: var(--muted);
    text-align: right; opacity: 0.85;
  }
  html[data-density] .grid .grid__cell[data-col="c_date"][data-label]::before { display: none; }
  /* 320 档装不下「房号 + 区域 + 两个动作」：硬挤会把房号截断还把按钮顶到下一行，两个动作改放卡片页脚。 */
@media (max-width: 360px) {
    html[data-density] .grid tbody tr > .grid__cell--del { order: 10; }
    html[data-density] .grid tbody tr > .grid__cell[data-col="c_date"][data-label] {
      width: auto; flex: 1 1 auto; text-align: left; padding: 0 0.5rem 0 0.75rem;
    }
    }
  /* 泛化的 .grid__cell{display:block} 排在前面，会盖掉上面的 inline-block；这里补一条同级但靠后的规则 */
  .grid .grid__cell--del,
  .grid .grid__cell--sel {
    display: inline-flex; align-items: center; justify-content: flex-start; width: auto;
    padding: 0.35rem 0.5rem; border: none; background: transparent; vertical-align: middle;
  }
  .grid .grid__cell--sel { padding-left: 0.2rem; }
  .grid tbody tr { text-align: left; }
  .grid .grid__cell--clear .clear-toggle { font-size: var(--fs-13); padding: 0.2rem 0.9rem; }
  /* 窄屏下工具栏/筛选条允许换行，别把搜索框挤没 */
  .tablebar, .panel__tools { flex-wrap: wrap; gap: 0.4rem; }
  .sheetbar { padding-bottom: 0.6rem; }
}
/* emoji 在部分安卓机渲染成方框，行内照片按钮改用 SVG 线框图标 */
.icon-btn[data-act="photo"] svg { display: block; }
.icon-btn[data-act="photo"] { display: inline-flex; align-items: center; gap: 2px; }
.icon-btn[data-act="photo"] .ph-count { font-size: var(--fs-11); line-height: 1; }
/* 721~1020 批量栏折成两行时，「合并导出」要贴右跟「仅本地」同一端，否则看着像被丢弃。 */
@media (max-width: 1020px) {
  .batchbar { flex-wrap: wrap; row-gap: 0.4rem; }
  .batchbar #export-all { margin-left: auto; }
}
/* 721~880 批次条装不下（两个下拉 + 四个按钮约 900px）：标签交给 aria-label，两个下拉平分剩余宽度，按钮一律不缩。 */
@media (min-width: 721px) and (max-width: 880px) {
  .batchbar { flex-wrap: nowrap; gap: 0.35rem; }
  .batchbar__label { display: none; }
  .batchbar__spacer { display: none; }
  .batchbar__select { flex: 1 1 0; min-width: 0; max-width: none; }
  .batchbar .btn { flex: none; white-space: nowrap; }
  .batchbar .muted { white-space: nowrap; }
  /* 这一段是单列布局，粘贴框最低 120、实际撑到 ~200：按视口高度封顶，否则结果表整块在屏外。 */
  .workspace:not(.is-paste-collapsed) > .panel:first-child { max-height: 46vh; }
  .workspace:not(.is-paste-collapsed) > .panel:first-child #raw-input { min-height: 0; }
  /* 收起态在这一段只有 174px，横屏 844×390 上吃掉半屏：输入条 44、上下内边距减半。 */
  .workspace.is-paste-collapsed > .panel:first-child { padding: 0.3rem 0.7rem 0.35rem; }
  .workspace.is-paste-collapsed > .panel:first-child .panel__head { padding: 0; }
  /* 13px/18px 行高 + 6px 内边距正好两行；15px/24px 时第二行会被切在字形中间 */
  .workspace.is-paste-collapsed > .panel:first-child #raw-input {
    height: 50px; min-height: 50px;
    /* 2×18 行高 + 2×6 内边距 + 2px 边框，正好两整行 */
    font-size: var(--fs-13); line-height: 18px; padding: 6px 9px;
  }
  .workspace.is-paste-collapsed > .panel:first-child .panel__foot { padding: 0.3rem 0.15rem 0; }
  /* 单列两卡：粘贴卡 auto、结果表吃剩下的 1fr；不写这条，结果表会落到隐式 auto 行被压成 2px。 */
@media (min-height: 700px) {
    .workspace { grid-template-rows: auto minmax(0, 1fr); }
    .workspace.is-single { grid-template-rows: minmax(0, 1fr); }
    }
}
/* 只读成员：隐藏一切写入口，服务端 403 兜底 */
body[data-readonly="1"] #import-header,
body[data-readonly="1"] #import-records,
body[data-readonly="1"] #run,
body[data-readonly="1"] #add-row,
body[data-readonly="1"] #dedupe,
body[data-readonly="1"] #fill-units,
body[data-readonly="1"] #clear-table,
body[data-readonly="1"] #open-settings,
body[data-readonly="1"] #photo-add,
body[data-readonly="1"] .sheet-add,
body[data-readonly="1"] .icon-btn[data-act="del"] {
  display: none !important;
}
/* ---- 交互体验统一打磨：纯观感/触感层，零 DOM 结构改动 ---- */
body { -webkit-tap-highlight-color: transparent; }
button, .sheet-tab, .grid__th--sort, .clear-toggle, label[data-guide] { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
.grid-wrap, .trash-list, .log-list, .colfilter, .modal__panel, .viewer-body,
.steps + .drawer__panel {
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.grid-wrap::-webkit-scrollbar,
.trash-list::-webkit-scrollbar, .log-list::-webkit-scrollbar,
.colfilter::-webkit-scrollbar, .modal__panel::-webkit-scrollbar,
.viewer-body::-webkit-scrollbar {
  width: 10px; height: 10px;
}
.grid-wrap::-webkit-scrollbar-thumb,
.trash-list::-webkit-scrollbar-thumb, .log-list::-webkit-scrollbar-thumb,
.colfilter::-webkit-scrollbar-thumb, .modal__panel::-webkit-scrollbar-thumb,
.viewer-body::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: var(--radius-pill); border: 3px solid transparent;
  background-clip: content-box;
  /* 浮在内容上，不入边缘 */
}
.grid-wrap::-webkit-scrollbar-thumb:hover,
.trash-list::-webkit-scrollbar-thumb:hover, .log-list::-webkit-scrollbar-thumb:hover,
.colfilter::-webkit-scrollbar-thumb:hover, .modal__panel::-webkit-scrollbar-thumb:hover {
  background: var(--muted); background-clip: content-box;
}
.grid-wrap::-webkit-scrollbar-track, .grid-wrap::-webkit-scrollbar-corner { background: transparent; }
.grid-wrap, .trash-list, .log-list, .colfilter, .modal__panel, .viewer-body { overscroll-behavior: contain; }
.btn, .icon-btn, .sheet-tab {
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.btn:active, .icon-btn:active, .sheet-tab:not(.is-dragging):active { transform: translateY(1px); }
.btn:disabled, .icon-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
/* 键盘操作焦点环：只用键盘 Tab 到达才出现（鼠标点击不糊一整圈） */
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
/* 上面只覆盖了输入类；链接、带 tabindex 的单元格、可编辑区、summary 也要有焦点环，否则键盘用户等于盲走。 */
a[href]:focus-visible, [tabindex]:focus-visible, [contenteditable="true"]:focus-visible,
summary:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
/* ---------- 移动端（≤720px）追加基线（与上面卡片式布局叠加） ---------- */
@media (max-width: 720px) {
  /* iOS 聚焦自动放大防范：所有输入/下拉统一 ≥16px */
  input, select, textarea { font-size: 16px !important; }
  /* iOS 原生日期控件不吃 width：内容比盒子宽就往外画，压到旁边按钮上；关掉原生外观 + 裁溢出，点一下仍弹系统日历。 */
  input[type="date"] {
    -webkit-appearance: none; appearance: none; text-align: left; overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 390 下「导入表格」会被裁到屏幕外（x=327→417），而它是录入段的起点：允许换行，落到第二行。 */
  .topbar__actions { flex-wrap: wrap; overflow-x: visible; width: 100%; row-gap: 0.4rem; padding-bottom: 0.15rem; }
  .topbar__actions::-webkit-scrollbar { display: none; }
  .topbar { flex-wrap: wrap; }
  /* 390 下「默认批次 / + 新建 / 更多」全在屏外，横滑又没有滑动提示：改换行。 */
  .batchbar { flex-wrap: wrap; overflow-x: visible; row-gap: 0.35rem; padding-bottom: 0.5rem; }
  .batchbar::-webkit-scrollbar { display: none; }
  .batchbar, .panel__tools, .tablebar {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .batchbar__spacer { flex: none; }
  .batchbar .btn, .btn--sm { min-height: 40px; flex: none; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 92vw; }
  /* 手机只留「加行 / 导出 Excel / 更多」一行，其余收进「更多」菜单，菜单项 data-proxy 直连原按钮。 */
  .panel__tools, .tablebar { flex-wrap: wrap; overflow-x: visible; row-gap: 0.35rem; }
  .panel__tools { flex-wrap: nowrap; }
  .panel__tools #dedupe,
  .panel__tools #fill-units,
  .panel__tools #undo,
  .panel__tools #redo,
  .panel__tools #open-board {
    display: none;
  }
  .panel__tools #add-row { order: 1; }
  .panel__tools #more-result { order: 3; margin-left: auto; }
  .more__menu .m-only.more__item { display: flex; }
  .more__menu .m-only.more__sep { display: block; }
  .more__menu .more__head.m-only { display: block; }
  .panel__tools::-webkit-scrollbar, .tablebar::-webkit-scrollbar { display: none; }
  .panel__tools .btn, .panel__tools .btn--sm { flex: none; min-height: 40px; }
  .tablebar__input, .tablebar__select { flex: none; }
  /* 390 上筛选条排 4 行要 131px：只留一行（搜索可伸 + 列筛选 + 更多），视图/分组/多条件收进「列筛选」展开区。 */
  .tablebar #filter-views,
  .tablebar #group-by,
  .tablebar #cond-btn { display: none; }
  .tablebar--adv #filter-views,
  .tablebar--adv #group-by,
  .tablebar--adv #cond-btn { display: inline-flex; }
  /* min-width 5.5rem：没有它，筛过之后「清除筛选 / 显示 8 / 24」一挤，搜索框缩成一条缝，自己刚输入的字都看不见。 */
  .tablebar__search { flex: 1 1 0; max-width: none; min-width: 5.5rem; }
  .tablebar__search > #filter-text { min-width: 0; }
  /* 「筛出 4 / 共 12」与「显示 4 / 12」是同一件事说两遍：手机留短的，长的那句给桌面（那边右对齐、宽度富余）。 */
  .tablebar #tablebar-count { display: none; }
  .tablebar #filter-info {
    display: inline; position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
    pointer-events: none; font-size: var(--fs-11); color: var(--muted); white-space: nowrap;
  }
  .tablebar__search.has-info > #filter-text { padding-right: 2.7rem; }
  /* 没筛选时它是空串：空的 flex 项仍要占一个 gap，会把空态筛选条从 40px 撑到 65px。 */
  .tablebar #filter-info:empty { display: none; }
  /* 窄屏工具条是横向滚动（overflow-x:auto），绝对定位的菜单会被裁掉，所以「更多」用贴底面板；条目 ≥44px 合手指尺寸。 */
  .more { flex: none; }
  .more__btn { min-height: 40px; }
  .more__menu {
    position: fixed; left: 10px; right: 10px; top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none;
    max-height: 64vh; overflow-y: auto; border-radius: var(--radius); padding: 0.45rem;
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.45);
  }
  .more__item { min-height: 44px; font-size: var(--fs-15); }
  .more__head { font-size: var(--fs-11); }
  /* 「更多」是贴底浮层：没有遮罩时后面的卡片看着还能点，一滑就点到删除叉；遮罩要自己吃事件（pointer-events:auto）才拦得住，关闭由 document 监听负责。 */
  .more-layer.is-open { background: rgba(15, 23, 42, 0.32); pointer-events: auto; }
  /* 卡片里的格子是收缩宽的，桌面那圈 inset 描边只箍住两个字；改用整卡描边 + 命中格浅底。用 :focus-within 而非 :has(:focus)：Chromium 对后者重算不可靠。 */
  .grid tbody tr:focus-within { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius); }
  .grid__cell[contenteditable="true"]:focus { box-shadow: none; }
  .batchbar, .panel__tools, .tablebar { -webkit-mask-image: none; mask-image: none; }
  /* 不用 order 重排：换行后自然顺序就是「日期 → 导入表格 → 比对原表 → 更多」，重排会让「导入表格」看着像属于日期控件。 */
  .topbar__actions .field { flex: none; }
  /* 登录按钮移出动作行、钉到 header 右上角，否则它跟着横滑行一起滑走，用户找不到入口 */
  /* 右内边距只让第一行的品牌文字避让：整条加 4.6rem 会把动作组压窄 74px，iOS 原生日期控件就画到「工具」按钮底下。 */
  .topbar { position: relative; padding-right: 1.25rem; }
  .brand { padding-right: 4.2rem; }
  .topbar > #open-auth { position: absolute; top: 0.72rem; right: 0.85rem; z-index: 3; }
  .topbar__actions .btn { flex: none; white-space: nowrap; }
  /* 中文四字按钮别被挤成竖排 */
  .topbar__actions .field input { width: 132px; min-width: 0; }
  .topbar__actions .field select { width: 124px; min-width: 0; }
  /* 整理对照弹层：桌面是四列网格，手机上原文会挤成竖条 → 改「卡片流」 */
  .diff__list { max-height: 62vh; }
  .diff__row {
    grid-template-columns: 1.5rem 1fr; align-items: start; row-gap: 0.28rem; padding: 0.55rem 0.6rem;
    margin-bottom: 0.4rem; border: 1px solid var(--border); border-radius: var(--radius);
  }
  .diff__row:nth-child(odd) { background: transparent; }
  .diff__no { text-align: left; padding-top: 0.1rem; }
  .diff__src, .diff__out, .diff__warn { grid-column: 2; }
  .diff__warn { text-align: left; }
  .diff__cell { max-width: 100%; overflow-wrap: anywhere; }
  .panel__tools .btn, .batchbar .btn { white-space: nowrap; }
  .batchbar > *, .panel__tools > * { flex: none; }
  .batchbar label, .batchbar span, .batchbar__label { white-space: nowrap; }
  .batchbar select, .batchbar input { max-width: 62vw; }
  /* 「合并导出 Excel」按 DOM 顺序排在最后一行，不再钉到最前（否则读起来像「合并导出 Excel 工程 全部工程」） */
  /* 结果区「导出 Excel」在 .panel__tools 里（不在 .tablebar），钉到工具栏最左，390 下第一眼就能看到交付出口。 */
  .panel__tools #export-xls { order: -1; }
  /* 悬浮主 CTA：单手可达；页面里的「自动整理」可见时收起（JS 用 IntersectionObserver 加 .is-on） */
  .fx-fab {
    display: inline-flex; position: fixed; right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 80; border: none;
    border-radius: var(--radius-pill); padding: 0.8rem 1.15rem; font: inherit; font-size: var(--fs-13);
    font-weight: 700; color: #fff; background: var(--brand);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35); align-items: center; gap: 0.35rem; opacity: 0;
    pointer-events: none; transform: translateY(8px);
    transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
  }
  .fx-fab.is-on { opacity: 1; pointer-events: auto; transform: none; }
  .fx-fab:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
    .fx-fab { transition: none; }
   }
}
@media (min-width: 721px) {
  .fx-fab { display: none; }
 }
body.paste-collapsed .fx-fab { display: none; }
body[data-readonly="1"] .fx-fab { display: none !important; }
/* ---- 顶栏控件对齐：输入与按钮统一 36px，动作区整体贴右 ---- */
@media (min-width: 721px) {
  .topbar__actions { justify-content: flex-end; row-gap: 0.5rem; }
  .topbar__actions .btn { height: 36px; padding: 0 0.85rem; font-size: var(--fs-13); }
  .topbar .field input, .topbar .field select { height: 36px; }
}
/* ---------- Ctrl+K 快速查找（Linear / Notion Quick-Find 同款） ---------- */
.fxpal {
  position: fixed; inset: 0; z-index: 220; display: flex; align-items: flex-start;
  justify-content: center; padding: 12vh 16px 16px; background: rgba(15, 23, 42, 0.32);
}
html[data-theme="dark"] .fxpal { background: rgba(0, 0, 0, 0.58); }
.fxpal__panel {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-overlay); overflow: hidden;
  animation: fxpal-in 0.14s ease both;
}
@keyframes fxpal-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }
.fxpal__input {
  width: 100%; border: 0; outline: none; background: transparent; padding: 0.95rem 1.05rem;
  font: inherit; font-size: var(--fs-15); color: var(--text);
  border-bottom: 1px solid var(--border-row);
}
.fxpal__list { list-style: none; margin: 0; padding: 0.35rem; max-height: min(52vh, 400px); overflow: auto; }
.fxpal__item {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.65rem;
  border-radius: var(--radius-xs); cursor: pointer;
}
.fxpal__item.is-cur { background: var(--brand-soft); }
.fxpal__item.is-empty {
  color: var(--muted); font-size: var(--fs-13); cursor: default; justify-content: center;
  padding: 1rem;
}
.fxpal__icon { flex: none; width: 1.5rem; text-align: center; opacity: 0.9; }
.fxpal__t { min-width: 0; flex: 1; }
.fxpal__t b {
  display: block; font-weight: 600; font-size: var(--fs-13); color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fxpal__t span {
  display: block; font-size: var(--fs-12); color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fxpal__tag {
  flex: none; font-size: var(--fs-11); color: var(--muted); background: var(--bg2);
  border-radius: var(--radius-pill); padding: 0.12rem 0.5rem; max-width: 9rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fxpal__foot {
  display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0.9rem;
  border-top: 1px solid var(--border-row); font-size: var(--fs-12); color: var(--muted);
}
.fxpal__kbd {
  font-family: var(--mono); font-size: var(--fs-11); border: 1px solid var(--border);
  border-radius: var(--radius-2xs); padding: 0.06rem 0.4rem;
}
@media (max-width: 640px) {
  .fxpal { padding-top: 8vh; }
 }
/* 行内删除 ✕ 桌面端悬停才显形（Notion / Airtable 同款）：减少每行视觉噪音；触屏始终可见，键盘 focus 时显现。 */
@media (hover: hover) and (pointer: fine) {
  .grid tbody tr .grid__cell--del .icon-btn[data-act="del"] {
    opacity: 0; transition: opacity var(--dur-1) var(--ease);
  }
  .grid tbody tr:hover .grid__cell--del .icon-btn[data-act="del"],
  .grid tbody tr:focus-within .grid__cell--del .icon-btn[data-act="del"] {
    opacity: 1;
  }
}
/* 移动端底部导航：只在 ≤720px 出现，桌面靠 hidden 属性不占位 */
.mnav { display: none; }
@media (max-width: 720px) {
  .mnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.92); border-top: 1px solid var(--border-row);
    backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  }
  .mnav[hidden] { display: none; }
  .mnav__btn {
    display: grid; justify-items: center; gap: 2px; padding: 7px 0 6px; border: 0;
    background: transparent; color: var(--muted); font-size: var(--fs-11); font-weight: 600;
    border-radius: var(--radius); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .mnav__btn svg {
    width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .mnav__btn.is-active { color: var(--brand); }
  .mnav__btn:active { background: var(--bg2); }
  /* 导航带边框 61px，留 70px 才不压住最后一张卡 */
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .fx-fab { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  /* 提示条别压在底部导航上：默认 bottom 正好盖住四个页签，撤销还跟「结果表」图标叠在一起 */
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  /* 「撤销」只有 32×22 时按不准，撑到 40 高；上下内边距收一点，总高不超 50 */
  .toast { padding: 0.2rem 1rem; }
  .toast__act { min-height: 40px; display: inline-flex; align-items: center; padding: 0 0.55rem; }
  /* 万一还有更窄的屏，占位文字宁可省略号也别硬切半个字 */
  #filter-text::placeholder { text-overflow: ellipsis; }
  /* 两个下拉共用一行（标签交给 aria-label），第二行放 新建 / 更多 / 合并导出；合并导出放回手机，多工作表才能一次导出。 */
  #batch-info, #sync-status { display: none; }
  .batchbar { gap: 6px; row-gap: 6px; flex-wrap: wrap; }
  .batchbar .batchbar__label { display: none; }
  .batchbar__select#project-select { flex: 0 0 33%; max-width: 33%; min-width: 0; }
  .batchbar__select#batch-select { flex: 1 1 auto; max-width: none; min-width: 0; }
  #export-all, #batch-new { display: none; }
  .batchbar { flex-wrap: nowrap; }
  /* 手机上印「Ctrl K」没意义，键位提示只在真键盘的设备上出现 */
  .more__hint.kbd { display: none; }
  /* 新建 / 合并导出都进了「更多」，工作表下拉必须留够宽度，否则被挤成「默认批…」 */
  .batchbar__select#project-select { flex: 0 1 auto; max-width: 34%; }
  .batchbar__select#batch-select { flex: 1 1 auto; }
}
/* 320 宽只剩 257px 可用：一行放不下四个按钮，两个下拉也被压到切字。放在 720 媒体块之后，才盖得住上面那条 34%（同特异性看先后）。 */
@media (max-width: 380px) {
  /* 「加行」在「更多」菜单里本来就有同一项，撤掉按钮，一行放得下，也不用渐隐遮一半 */
  .panel__tools #add-row { display: none; }
  /* 两个下拉各 103px，而「全部工程」16px 四字 + 内边距 + 箭头要 108：内边距收到 0.3rem；字不能缩，缩了 iOS 聚焦会放大整页。 */
  .batchbar { gap: 0.3rem; }
  .batchbar__select { padding: 0 0.3rem; text-overflow: ellipsis; }
  .batchbar .btn--sm { padding: 0 0.55rem; }
  .batchbar__select#project-select { flex: 1 1 0; max-width: 46%; }
  /* 两边都从 0 开始分，才不会一边按内容撑、一边被内容压成「全...」 */
  .batchbar__select#batch-select { flex: 1 1 0; }
}
[data-theme="dark"] .mnav { background: rgba(22, 24, 29, 0.9); border-top-color: rgba(255, 255, 255, 0.08); }
/* 360 上筛选条差 8px 塞不下，「更多」会被挤到第三行：窄屏藏掉冗长的「清除筛选」 */
@media (max-width: 380px) {
  .narrow-hide { display: none; }
 }
/* 粘贴框键盘提示：手机没有实体键盘，≤720px 不显示 */
.kbd-hint {
  margin-left: auto; margin-right: 0.6rem; font-size: var(--fs-11); color: var(--muted);
  opacity: 0.85;
}
@media (max-width: 720px) {
  .kbd-hint { display: none; }
 }
/* 首屏骨架：本地库读出来之前的占位；shimmer 走 background-position，不触发重排 */
.grid-skel { display: grid; gap: 12px; padding: 18px 16px; }
.grid-skel[hidden] { display: none; }
.grid-skel__bar {
  height: 12px; width: 100%; border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg1) 37%, var(--bg2) 63%);
  background-size: 400% 100%; animation: skel 1.25s ease-in-out infinite;
}
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .grid-skel__bar { animation: none; }
 }
[data-theme="dark"] .grid-skel__bar {
  background: linear-gradient(90deg, #1b1e24 25%, #23272f 37%, #1b1e24 63%);
  background-size: 400% 100%;
}
/* 表格滚动后表头加一道分界线；阴影用 color-mix 跟主题走（写死 rgba 在暗色下像一道脏印），过渡在文件末尾那条 .grid__th 规则里。 */
.grid-wrap.is-scrolled thead th {
  box-shadow: 0 1px 0 var(--border), 0 6px 12px -8px color-mix(in srgb, #000 24%, transparent);
}
@media (max-width: 720px) {
  /* 底部导航已经是一模一样的四个入口，表上方这排 tabs 白占 34px */
  .viewtabs { display: none; }
  /* 「自动整理」浮钮与粘贴面板里那个按钮重复，还悬在卡片右侧挡内容：手机上收掉 */
  .fx-fab { display: none; }
  /* 没筛任何东西时「清除筛选」点了没反应；规则在全局 #filter-clear 处 */
  /* 统计页标题「按楼栋统计」和它下面的维度下拉说的是同一件事，手机上去掉标题省一行 */
  .stats__title { display: none; }
}
/* ---- 整改前 / 整改后：照片从「一堆图」变成「一组证据」，分两栏并排对比，拍摄时烧上房号和时间 ---- */
.photo-body { display: flex; flex-direction: column; gap: 14px; padding: 1rem 1.15rem; }
.photo-sec__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.photo-sec__ttl { font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.photo-sec__ttl b {
  margin-left: 6px; font-weight: 600; font-size: var(--fs-12); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.photo-sec__empty {
  margin: 0; padding: 16px 12px; text-align: center; font-size: var(--fs-11); color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius-xs);
}
.photocmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 1rem 1.15rem; }
.photocmp__col { min-width: 0; }
.photocmp__hd {
  display: flex; gap: 6px; margin-bottom: 6px; font-size: var(--fs-11); font-weight: 600;
  color: var(--muted);
}
.photocmp__hd b { font-variant-numeric: tabular-nums; color: var(--text); }
.photocmp__list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-content: start;
  gap: 8px; max-height: min(58vh, 520px); overflow: auto;
}
.photocmp__list img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border-radius: var(--radius-xs); background: var(--panel-2); cursor: zoom-in;
}
.photo-wm {
  display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: var(--fs-11);
  color: var(--muted);
}
.photo-wm input { width: 15px; height: 15px; accent-color: var(--accent); }
.modal__panel.is-compare { width: min(920px, 94vw); }
@media (max-width: 720px) {
  .photocmp { grid-template-columns: 1fr; gap: 10px; }
  /* 手机只有一列，别再套内滚动：照片会被 28vh 拦腰截断，连水印都看不全，让弹窗本体滚。 */
  .photocmp__list { max-height: none; overflow: visible; }
  .photo-wm { width: 100%; margin: 0 0 6px; }
  /* 手机上一张照片就是证据，别缩成 116px 的小方块 */
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-thumb { aspect-ratio: 4 / 3; }
}
/* ---------- 断网状态带 ---------- */
.netbar {
  display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--warn-soft);
  color: var(--warn); font-size: var(--fs-12); font-weight: 600;
}
.netbar.is-offline { background: var(--danger-soft); color: var(--danger); }
.netbar__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
/* ---------- 工具条：条件计数、逾期胶囊 ---------- */
.cond-n {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 0.3rem;
  padding: 0 4px; border-radius: var(--radius-pill); background: var(--brand); color: #fff;
  font-size: var(--fs-11); font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums;
}
.is-danger-ghost { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 32%, transparent); }
.is-danger-ghost b { font-variant-numeric: tabular-nums; }
.is-danger-ghost.is-on { background: var(--danger-soft); border-color: var(--danger); }
/* ---------- 多条件筛选面板 ---------- */
.condpanel {
  margin: 0 0 0.6rem; padding: 0.7rem 0.8rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg1); box-shadow: var(--shadow-raised);
}
.condpanel__head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.55rem; }
.condpanel__head strong { font-size: var(--fs-13); }
.condpanel__head .tablebar__select { margin-left: auto; }
.condpanel__x { flex: none; }
.condpanel__list { display: flex; flex-direction: column; gap: 0.45rem; }
.condrow { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.condrow .tablebar__select { min-width: 7.5rem; }
.condrow__op { min-width: 5.2rem; }
.condrow__val { flex: 1 1 8rem; min-width: 6rem; }
.condpanel__foot { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.65rem; }
.tablebar__gap { flex: 1 1 auto; }
/* ---------- 分组表头 ---------- */
.grid__grouprow > .grid__groupcell { padding: 0; border-bottom: 1px solid var(--border); background: var(--bg2); }
.grid__groupbtn {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.42rem 0.7rem; border: 0;
  background: transparent; cursor: pointer; font: inherit; color: var(--text); text-align: left;
}
.grid__groupbtn:hover { background: var(--brand-soft); }
.grid__groupbtn b { font-size: var(--fs-13); font-weight: 700; }
.grid__grouparrow { font-style: normal; color: var(--muted); width: 12px; flex: none; }
.grid__groupmeta { font-size: var(--fs-12); color: var(--muted); font-variant-numeric: tabular-nums; }
.grid__groupbar {
  margin-left: auto; width: 84px; height: 5px; border-radius: var(--radius-pill);
  background: var(--border); overflow: hidden; flex: none;
}
.grid__groupbar > i {
  display: block; height: 100%; border-radius: inherit; background: var(--ok);
  transition: width var(--dur-2) var(--ease);
}
.grid__grouprow.has-over .grid__groupbar > i { background: var(--danger); }
/* ---------- 派单 / 超时 ---------- */
.grid tbody tr.is-overdue > .grid__cell { background: color-mix(in oklab, var(--danger) 6%, var(--bg1)); }
.grid tbody tr.is-overdue { box-shadow: inset 3px 0 0 var(--danger); }
.grid tbody tr.is-overdue td[data-col="c_due"] { color: var(--danger); font-weight: 700; }
.grid tbody tr.is-duesoon > .grid__cell { background: color-mix(in oklab, var(--warn) 7%, var(--bg1)); }
.grid tbody tr.is-duesoon td[data-col="c_due"] { color: var(--warn); font-weight: 600; }
.grid tbody tr.is-due-done td[data-col="c_due"] { color: var(--muted); }
@media (max-width: 720px) {
  .grid tbody tr.is-overdue { border-color: var(--danger); }
  .grid tbody tr.is-duesoon { border-color: var(--warn); }
}
/* ---------- 底部导航角标 ---------- */
.mnav__btn { position: relative; }
.mnav__badge {
  /* left:50%+2px 正好压在图标右上角，挪到图标右边缘之外才读得清 */
  position: absolute; top: 2px; left: calc(50% + 9px); margin-left: 0; min-width: 16px; height: 16px;
  padding: 0 4px; display: inline-grid; place-items: center; border-radius: var(--radius-pill);
  background: var(--danger); color: #fff; font-size: var(--fs-10, 0.62rem); font-weight: 700;
  font-style: normal; font-variant-numeric: tabular-nums; line-height: 1;
  box-shadow: 0 0 0 2px var(--bg1);
}
/* ---------- 手机：左滑行操作 ---------- */
@media (max-width: 720px) {
  .grid tbody tr { transition: transform var(--dur-2) var(--ease); will-change: transform; }
  /* 左滑：按钮从卡片右侧滑进来盖在卡上；整行位移会被 content-visibility 的 paint containment 裁掉，落点也算不准。 */
  .grid tbody tr.is-swiped { z-index: 5; }
  .swipe-acts {
    position: absolute; top: 0; right: 0; bottom: 0; width: 96px; display: flex; flex-direction: column;
    gap: 3px; padding: 4px; transform: translateX(102%); transition: transform var(--dur-2) var(--ease);
    z-index: 4; border-radius: 0 var(--radius) var(--radius) 0;
    background: linear-gradient(90deg, transparent 0, var(--bg1) 26%);
  }
  .grid tbody tr.is-swiped .swipe-acts { transform: translateX(0); }
  .swipe-acts__btn {
    flex: 1 1 0; min-height: 34px; border: 0; border-radius: var(--radius-xs); background: var(--brand);
    color: #fff; font-size: var(--fs-12); font-weight: 600; cursor: pointer;
  }
  .swipe-acts__btn--danger { background: var(--danger); }
}
/* ---------- 手机：下拉刷新提示 ---------- */
.pulltip {
  position: fixed; left: 50%; top: 8px; transform: translate(-50%, -140%); padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill); background: var(--text); color: var(--bg1);
  font-size: var(--fs-12); font-weight: 600; z-index: 90;
  transition: transform var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease); opacity: 0;
  pointer-events: none;
}
.pulltip.is-on { transform: translate(-50%, 0); opacity: 1; }
/* ---------- 单据（打印用） ---------- */
.docprint { display: none; }
.doc__sheet { color: #111; background: #fff; font-size: 12pt; }
.doc__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  border-bottom: 2px solid #111; padding-bottom: 6mm; margin-bottom: 4mm;
}
.doc__brand b { display: block; font-size: 13pt; letter-spacing: 0.08em; }
.doc__brand span { font-size: 9pt; color: #555; }
.doc__head h1 { margin: 0; font-size: 20pt; letter-spacing: 0.2em; text-align: center; flex: 1; }
.doc__no { margin: 0; font-size: 9pt; color: #333; white-space: nowrap; }
.doc__meta { margin: 0 0 3mm; font-size: 10pt; color: #222; }
.doc__table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.doc__table th, .doc__table td { border: 1px solid #333; padding: 2mm 2.5mm; vertical-align: top; text-align: left; }
.doc__table th { background: #f1f1f1; font-weight: 600; white-space: nowrap; }
.doc__h2 { font-size: 11pt; margin: 6mm 0 2mm; border-left: 3px solid #111; padding-left: 2mm; }
.doc__photoset { display: flex; flex-wrap: wrap; gap: 2mm; margin-bottom: 3mm; break-inside: avoid; }
.doc__fig { margin: 0; width: 56mm; }
.doc__fig img { width: 100%; height: 40mm; object-fit: cover; border: 1px solid #333; }
.doc__fig figcaption { font-size: 8pt; color: #333; margin-top: 0.8mm; }
.doc__sign { display: flex; justify-content: space-between; gap: 6mm; margin-top: 12mm; font-size: 10pt; }
.docopt { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.7rem; }
.docopt__item {
  display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.55rem 0.65rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.docopt__item.is-checked { border-color: var(--brand); background: var(--brand-soft); }
.docopt__item b { display: block; font-size: var(--fs-13); }
.docopt__item em {
  display: block; font-style: normal; font-size: var(--fs-12); color: var(--muted);
  margin-top: 0.1rem;
}
/* ---------- 变更记录 ---------- */
.histlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.histitem {
  display: grid; grid-template-columns: 4.6rem 4.2rem 6rem 6rem 1fr; gap: 0.5rem;
  align-items: baseline; padding: 0.42rem 0.15rem; border-bottom: 1px solid var(--border-row);
  font-size: var(--fs-12);
}
.histitem__t { color: var(--muted); font-variant-numeric: tabular-nums; }
.histitem__who { color: var(--brand); font-weight: 600; }
.histitem__room { font-weight: 600; }
.histitem__col { color: var(--muted); }
.histitem__delta { color: var(--text); }
.histlist__empty { padding: 1.2rem 0; color: var(--muted); font-size: var(--fs-12); text-align: center; }
@media (max-width: 720px) {
  .histitem { grid-template-columns: 3.6rem 3.4rem 1fr; grid-auto-rows: auto; }
  .histitem__col { grid-column: 3; }
  .histitem__delta { grid-column: 1 / -1; color: var(--muted); }
}
/* ---------- 空态插画 ---------- */
.start__art {
  display: flex; justify-content: center;
  color: color-mix(in oklab, var(--brand) 46%, var(--border-strong)); margin: 0.2rem 0 0.9rem;
}
.start__art svg { width: 100%; max-width: 208px; height: auto; display: block; }
/* ---------- 手机卡片长表：跳过屏外行的渲染 ---------- */
@media (max-width: 720px) {
  .grid tbody tr[data-id] { content-visibility: auto; contain-intrinsic-size: auto 148px; }
}

/* ======== 打印 ======== */
/* ---------- 打印：只印单据 ---------- */
@media print {
  body.printing-doc { background: #fff; }
  body.printing-doc > * { display: none !important; }
  body.printing-doc > #doc-print-root { display: block !important; }
  #doc-print-root { display: block; }
  @page { size: A4; margin: 14mm; }
}
/* 分隔条本意是 1px 竖线，被 flex:1 拉宽后成了 20px 高的灰块，像没填的输入框 */
.tablebar__gap { width: 0; height: 0; background: none; }
.condpanel__list { gap: 0.5rem; }
.condrow { flex-wrap: nowrap; gap: 0.45rem; }
.condrow .tablebar__select { flex: none; }
.condrow__val { flex: 1 1 auto; max-width: 24rem; }
.condrow > .icon-btn { margin-left: 0.1rem; }
.condpanel__foot { margin-top: 0.75rem; }
.modal__body .field { margin: 0 0 0.85rem; gap: 0.35rem; }
.modal__body .field > span { display: block; }
.modal__body .field input, .modal__body .field select { width: 100%; }
.modal__body .field--row { flex-direction: row; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem; }
.modal__body .field--row > span { order: 2; font-size: var(--fs-13); color: var(--text); }
.modal__body .field--row input[type="checkbox"] { order: 1; flex: none; width: 16px; height: 16px; margin: 0; }
.modal__body > :last-child { margin-bottom: 0; }
.modal__panel { max-height: min(86vh, 760px); display: flex; flex-direction: column; }
.modal__panel > .modal__body { overflow-y: auto; overscroll-behavior: contain; }
.modal__panel > .modal__head, .modal__panel > .modal__foot { flex: none; }
.modal__panel--sm { width: min(460px, 94vw); }
#histPanel .modal__panel { width: min(580px, 94vw); }
.histlist__empty {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 1.6rem 1rem;
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg2);
  color: var(--muted); font-size: var(--fs-12); text-align: center;
}
.histlist__empty svg { stroke: currentColor; fill: none; stroke-width: 1.6; opacity: 0.5; }
.histlist__empty b { font-size: var(--fs-13); color: var(--text); }
.histlist__empty span { max-width: 26rem; line-height: 1.6; }
.histitem:last-child { border-bottom: none; }
/* 列一多（派单后常见十列）时藏掉表头的「来源」标签，把宽度让给内容，避免最右一列被切 */
.is-many-cols .grid__col-src, .grid.is-many-cols .grid__col-src { display: none; }
/* 派单：常用期限一点即填（手输日期在手机上太费劲） */
.quickdue { display: flex; align-items: center; gap: 0.35rem; margin: -0.45rem 0 0.9rem; flex-wrap: wrap; }
.quickdue__btn {
  height: var(--ctl-h); padding: 0 0.62rem; border: 1px solid var(--border);
  border-radius: var(--radius-pill); background: var(--bg1); color: var(--text);
  font-size: var(--fs-12); line-height: 1; cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.quickdue__btn:hover { border-color: var(--brand); color: var(--brand); }
.quickdue__btn.is-on {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
/* 派单消息可能在「整理对照」之后打开（派完顺手发消息）：它必须盖在上面，不然半边被挡住 */
#dispatchMsgPanel { z-index: 100; }
/* 派单消息：目的是「看一眼就能发」，所以给足宽度和行距，超出在框里滚动，别把弹窗顶高 */
.dispatch-msg__text {
  display: block; width: 100%; min-height: 9.5rem; max-height: 42vh; resize: vertical;
  padding: 0.55rem 0.65rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg1); color: var(--text); font: inherit; line-height: 1.55;
  white-space: pre-wrap; overflow: auto;
}
.filter-chip--cond { gap: 0.15rem; }
.filter-chip--cond .filter-chip__t {
  max-width: 15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filter-chip--mode {
  background: transparent; border-style: dashed; color: var(--muted); font-weight: 500;
  padding: 0.1rem 0.45rem;
}
.filter-chip--clear {
  cursor: pointer; font: inherit; font-size: var(--fs-12); background: transparent;
  border-style: dashed; color: var(--muted); padding: 0.1rem 0.45rem;
}
.filter-chip--clear:hover { color: var(--danger); border-color: var(--danger); }
/* 筛选/排序标签行：工具条在手机上是横滑的，标签放里面会被推到看不见的地方 */
.chipsrow { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; padding: 0.1rem 0.15rem 0.45rem; }
.chipsrow .chips { display: inline-flex; }
@media (max-width: 720px) {
  /* 手机上每条条件自带 ×，「清空条件」留给条件面板，别让标签行多占一行 */
  .chipsrow .filter-chip--clear { display: none; }
  .chipsrow { padding: 0 0.15rem 0.35rem; }
}
/* 弹窗正文原先没有内边距：用 .hint 的 1.25rem 冒充，结果提示文字缩进、输入框贴边，两不对齐。 */
.modal__body { padding: 1rem 1.15rem 1.05rem; }
.modal__body .hint { padding: 0; }
/* 统计表：数字列收窄靠右，别让六列均分 970px（限宽居中的版本会变成一条悬在卡片中间的白带）。 */
.stats__table th, .stats__table td { width: 1%; }
.stats__table th:first-child, .stats__table td:first-child { width: auto; }
/* 桌面最左一列同时挂 ⚠ / 📷 / ✕，30px 宽里竖着一排 ×，像噪点还容易被误点：鼠标设备完全不占视觉，悬停/选中/键盘聚焦才浮出，触摸屏保持可见。 */
.grid__cell--del [data-act="del"] { transition: opacity var(--dur-1) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .grid tbody tr .grid__cell--del .icon-btn[data-act="del"],
  .grid tbody tr .grid__cell--del .icon-btn[data-act="photo"] {
    opacity: 0;
  }
  .grid tbody tr:hover .grid__cell--del .icon-btn[data-act="del"],
  .grid tbody tr:hover .grid__cell--del .icon-btn[data-act="photo"],
  .grid tbody tr.is-selected .grid__cell--del .icon-btn[data-act="del"],
  .grid tbody tr.is-selected .grid__cell--del .icon-btn[data-act="photo"],
  .grid tbody tr:focus-within .grid__cell--del .icon-btn[data-act="del"],
  .grid tbody tr:focus-within .grid__cell--del .icon-btn[data-act="photo"],
  .grid__cell--del .icon-btn[data-act="del"]:focus-visible,
  .grid__cell--del .icon-btn[data-act="photo"]:focus-visible,
  .grid__cell--del .icon-btn.has-photos {
    opacity: 1;
  }
}
/* 触摸屏没有 hover：38% 会一直挂着，✕ 看着像禁用。留一点弱化但能看清 */
@media (hover: none) {
  .grid__cell--del [data-act="del"] { opacity: 0.72; }
}
/* 表头列悬停高亮（Airtable / Teable 同款）：扫过哪列哪列压深一档，也给只在悬停出现的「排序/漏斗」图标一个落点。 */
.grid thead th:hover { background: var(--panel-2); }
.pastehint {
  margin: 0.4rem 0 0; padding: 0 0.1rem; font-size: var(--fs-12); color: var(--muted);
  line-height: 1.5;
}
.pastehint b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
/* 0 行时工具条 / 勾选条点了没反应，直接收起来 */
body.is-empty-table .tablebar,
body.is-empty-table .chipsrow,
body.is-empty-table .selbar {
  display: none !important;
}
/* 手机上勾了行，两排操作条并排会把「更多」挤掉半截：有选中只留选中那排 */
@media (max-width: 720px) {
  body.has-sel .panel__tools { display: none; }
}
.sheet-tab.is-active {
  background: var(--panel-2); border-color: transparent; box-shadow: inset 0 -2px 0 var(--brand);
}
.sheet-tab__n {
  margin-left: 0.1rem; padding: 0 0.34rem; border-radius: 999px;
  background: rgba(127, 127, 127, 0.16); font-size: var(--fs-11); opacity: 1; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.board-kpis--ghost { opacity: 0.5; filter: grayscale(1); margin-bottom: 0.4rem; }
.empty--board { text-align: left; padding: 0.2rem 0 0.1rem; }
.empty__title { margin: 0 0 0.25rem; font-size: var(--fs-15); font-weight: 600; color: var(--text); }
.empty__sub { margin: 0 0 0.85rem; font-size: var(--fs-13); color: var(--muted); }
.start__sub--view { margin-top: 0.15rem; max-width: 34rem; }
/* 手机卡片把「整改期限 / 责任人」提进顶栏：逾期临期最该第一眼看到，跟拍照/删除同排。 */
@media (max-width: 720px) {
  /* !important 是必须的：后面那条泛化的 `.grid tbody tr > .grid__cell:not(–del):not(–sel)` 特异性更高，不硬来就压不住 */
  .grid tbody tr > .grid__cell--due,
  .grid tbody tr > .grid__cell--owner {
    display: inline-flex !important; align-items: center; order: 2 !important; width: auto !important;
    max-width: 44%; padding: 0.4rem 0.5rem 0.4rem 0.55rem !important; border: none !important;
    border-left: 1px dashed var(--border-row) !important; border-radius: 0;
    background: transparent !important; box-shadow: none; font-size: var(--fs-13); line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .grid tbody tr > .grid__cell--due.is-slimmable,
  .grid tbody tr > .grid__cell--owner.is-slimmable {
    width: auto !important; display: inline-flex !important;
  }
  .grid .grid__cell--due[data-label]:not([data-label=""])::before,
  .grid .grid__cell--owner[data-label]:not([data-label=""])::before {
    position: static; width: auto; margin-right: 0.25rem; overflow: visible; white-space: nowrap;
    font-size: var(--fs-11);
  }
  .grid tbody tr.is-overdue > .grid__cell--due { color: var(--danger); font-weight: 700; }
  /* 空的责任人/期限不该把裸标签顶进顶栏：一列没填值，顶栏右侧多出一条孤字，看着像还该填什么 */
  .grid tbody tr > .grid__cell--due:empty,
  .grid tbody tr > .grid__cell--owner:empty { display: none !important; }
  /* slim 把销项三件套整列收掉，但「销了没有」最要紧：只把开关单独放回卡片（人员、时间在详情里填）。与 table.grid--slim 同特异性，靠位置排后面取胜，必须写在其后。 */
  .grid tbody tr > .grid__cell--clear { display: block !important; width: 100% !important; }
  .grid tbody tr > .grid__cell--clear .clear-toggle { min-height: 36px; font-size: var(--fs-14); }
}
/* 宽屏把参数栏并进顶栏（挪节点由 app.js 的 mergeBatchbar 负责），这里只管长相：蹭成顶栏一体，标签/选择器小一号。 */
body.batchbar-in-top .topbar { flex-wrap: nowrap; }
body.batchbar-in-top .batchbar {
  flex: 1 1 auto; min-width: 0; padding: 0; margin: 0 0.6rem; border: none; background: transparent;
  gap: 0.45rem; align-items: center; overflow: visible; -webkit-mask-image: none; mask-image: none;
}
body.batchbar-in-top .batchbar__label { font-size: var(--fs-12); }
body.batchbar-in-top .batchbar__select { width: 190px; max-width: 26vw; height: 32px; min-height: 32px; }
body.batchbar-in-top .batchbar .btn { height: 32px; min-height: 32px; }
body.batchbar-in-top .batchbar__spacer { flex: 1 1 0; }
body.batchbar-in-top #sync-status { font-size: var(--fs-12); }
/* 宽屏（≥1400）参数栏并进顶栏后压成一行；1021~1399 仍允许折行 —— 控件宽度不够，硬压会横向溢出、把「合并导出」切掉。 */
@media (min-width: 1400px) {
  body.batchbar-in-top .topbar { flex-wrap: nowrap; align-items: center; gap: 0.85rem; }
  /* 分组：品牌｜参数（日期/写法/工具） ｜ 上下文（工程/工作表/新建/更多）｜ 导出 ｜ 账户 */
  body.batchbar-in-top .topbar__actions { flex: none; margin-left: 0.15rem; padding-right: 0.9rem; }
  body.batchbar-in-top .topbar .batchbar { border: 0; border-left: 1px solid var(--border); padding: 0 0 0 0.9rem; }
  body.batchbar-in-top .topbar__actions { flex-wrap: nowrap; align-items: center; gap: 0.45rem; }
  /* 只限定顶栏里的表单：不限定会把登录/注册弹窗的 label 也拉成一行，输入框被压扁 */
  body.batchbar-in-top .topbar .field { flex-direction: row; align-items: center; gap: 0.32rem; }
  body.batchbar-in-top .topbar .field input,
  body.batchbar-in-top .topbar .field select { height: var(--ctl-h-lg); }
  body.batchbar-in-top .batchbar {
    flex-wrap: nowrap; padding: 0; margin: 0; border: 0; background: none; box-shadow: none;
    gap: 0.4rem;
  }
  body.batchbar-in-top .batchbar__select { height: var(--ctl-h-lg); }
  body.batchbar-in-top #sync-status { display: none; }
  body.batchbar-in-top .brand__text p { display: none; }
  /* 顶栏只有一行时别再挂副标题 */
  /* 标签竖排是 flex 挤压的副产品：span 被压到十几 px 就一个字一个字往下堆 */
  body.batchbar-in-top .topbar .field span { white-space: nowrap; }
  /* 下拉框自己写着「全部工程」「默认批次」，前面再挂「工程/工作表」只是占宽 */
  body.batchbar-in-top .batchbar__label { display: none; }
  body.batchbar-in-top #project-select { min-width: 8.5rem; max-width: 8.5rem; }
  body.batchbar-in-top #batch-select { min-width: 10rem; max-width: 10rem; }
  /* 内容一多（多个工作表时后面会多出一段「共 N 个批次 · M 行」）就又挤爆：这几条把可变宽度收干净。 */
  body.batchbar-in-top .brand { flex: none; }
  body.batchbar-in-top .brand__text h1 { white-space: nowrap; }
  body.batchbar-in-top #batch-info { display: none; }
  body.batchbar-in-top .batchbar { min-width: 0; }
  body.batchbar-in-top .batchbar__spacer { flex: 1 1 0; }
  body.batchbar-in-top #open-auth { margin-left: 0.25rem; }
  /* 顶栏这一行所有控件同高 36：别让 32 的按钮和 36 的参数栏一高一矮排在同一行 */
  body.batchbar-in-top .batchbar .btn,
body.batchbar-in-top .batchbar .btn--sm {
    height: var(--ctl-h-lg); min-height: var(--ctl-h-lg);
  }
  /* 一行放不下的 91px：从留白和「Excel」三个字里省，别去砍按钮 */
  body.batchbar-in-top .wide-hide { display: none; }
  body.batchbar-in-top { --topbar-pad-x: 0.8rem; }
  body.batchbar-in-top .topbar { padding-left: 0.75rem; padding-right: 0.75rem; gap: 0.7rem; }
  body.batchbar-in-top .topbar__actions { gap: 0.3rem; }
  body.batchbar-in-top .batchbar { gap: 0.3rem; }
}
/* ---------- 判定规则表编辑器（模板设置抽屉） ---------- */
.ruletable-editor { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.3rem 0 0.45rem; }
.ruletable-row { display: grid; grid-template-columns: 1fr 130px 30px 30px 30px; gap: 0.4rem; align-items: center; }
.ruletable-row .rt-pattern { min-width: 0; }
.ruletable-row .rt-unit { min-width: 0; }
.ruletable-empty { color: var(--muted); font-size: var(--fs-13); padding: 0.2rem 0; }
.ruletable-ops { display: flex; align-items: center; gap: 0.7rem; margin: 0.35rem 0; flex-wrap: wrap; }
.switch--inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--fs-13); }
.rt-badge {
  display: inline-block; margin-left: 0.45rem; padding: 0.05rem 0.45rem;
  border: 1px solid var(--accent); color: var(--accent); border-radius: 999px;
  font-size: var(--fs-12); font-weight: 600; vertical-align: 2px;
}
/* 手机统计表 6 列在 390 下超 32px，「占比」被切：收窄内边距与条形列 */
@media (max-width: 720px) {
  .stats__table { font-size: var(--fs-13); }
  .stats__table th,
  .stats__table td { padding: 0.45rem 0.35rem; }
  .stats__share { width: 78px; }
  /* 手机 390 宽下 6 列塞不进：占比条是装饰，楼栋格里已有 mini 条，整列收起 */
  .stats__table .stats__share { display: none; }
  .share-bar { height: 18px; }
  .share-bar b { padding: 0 4px; font-size: var(--fs-11); line-height: 18px; }
  .topbar .btn { min-height: 40px; }
  /* 手机顶栏两个日期控件原本各 132/124 宽，原生日期只显示到「11/07/202?」：两列各占一半、字号 15 起 */
  .topbar__actions { gap: 6px 8px; }
  .topbar__actions > .field { flex: 1 1 0; min-width: 0; }
  .topbar__actions > .more { flex: 0 0 auto; }
  /* 「日期写法」只是显示偏好，挤在一行会把日期本身挤到看不清：手机上收起（桌面/平板仍在），设置值照样生效 */
  .topbar__actions .field--datefmt { display: none; }
  .topbar__actions .field input,
  .topbar__actions .field select {
    width: 100%; min-width: 0; font-size: var(--fs-15);
  }
  .topbar__actions .more { flex: 0 0 auto; }
  .start__acts .btn { min-height: 40px; }
  .sheet-tab { height: 36px; }
  .sheet-tab__x { visibility: visible; width: 22px; height: 22px; padding: 0; }
  .sheet-add { min-height: 36px; min-width: 44px; }
  /* 热力表在手机上要横向滚（层数多），首列钉住才不至于滚完不知道在看哪一栋 */
  .stats__table tr > *:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--bg1);
    box-shadow: 1px 0 0 var(--line), 6px 0 8px -6px rgba(15, 23, 42, 0.18);
  }
  .stats__table thead tr > *:first-child { z-index: 3; }
  /* 按内容定宽：width 100% 会把 7 个楼层列压到 35px，格子里的数字被挤没，横向滚动也就没意义 */
  .stats__table { width: max-content; min-width: 100%; }
  .stats__table th, .stats__table td { white-space: nowrap; }
  .stats__table .heat__cell {
    min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  }
  .stats__table .stats__building { min-width: 44px; }
}
/* ---------- 按工程拆包：一个工程一行的清单 ---------- */
.pack__list { display: grid; gap: 6px; max-height: 46vh; overflow: auto; margin: 10px 0 6px; }
.pack__row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg2);
}
.pack__name {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px;
  font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pack__meta { font-size: var(--fs-11); color: var(--muted); font-variant-numeric: tabular-nums; }
/* ---------- 教它认词：原句用引用块显形，免得用户去表格里对着念 ---------- */
.learn__src {
  margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--bg2);
  font-size: var(--fs-13); color: var(--text); line-height: 1.5; word-break: break-word;
}
.learn__src:empty { display: none; }
/* ---------- 窄屏收口（字体清晰度 / 层级精简） ---------- */
@media (max-width: 360px) {
  /* 品牌副标题在 320 上把首屏又压下一行、字又最小：窄屏直接不显示，标题本身够说明。 */
  .brand__text p { display: none; }
  /* 顶栏三个图标 34px + 16px 房号在 320 上会把图标挤到第二行：图标收到 30、房号回到 15，标题行重新装下。 */
  .grid .grid__cell--del .icon-btn { min-width: 30px; min-height: 30px; }
  html[data-density] .grid .grid__cell[data-col="c_room"][data-label],
  html[data-density] .grid .grid__cell.grid__cell--room[data-label] {
    font-size: var(--fs-15);
  }
}
/* ---- 左滑「销项 / 删除」动作层必须挂在 tr 上 ---- 格子自己 position:relative，挂格子上 right:0 只相对那个 69px 的格子，translateX(102%) 推不出卡外。 */
@media (max-width: 720px) {
  .grid tbody tr.has-swipe { position: relative; }
}
/* ---- 桌面控制层降噪 ---- 高度 40→34 跟行高对齐，次要按钮去掉常驻描边，输入/下拉用浅底、hover 露边、focus 上主色环；手机不动（要 40px 以上可点面积）。 */
@media (min-width: 721px) {
  .topbar .btn, .topbar select, .topbar input[type="date"],
  .panel__tools .btn, .panel__tools .icon-btn,
  .tablebar .btn, .tablebar__input, .tablebar__select,
  .batchbar .btn, .batchbar select {
    height: 34px; min-height: 34px;
  }
  .topbar .btn, .panel__tools .btn, .tablebar .btn, .batchbar .btn { padding: 0 11px; }
  .btn--ghost { border-color: transparent; }
  .btn--ghost:hover { border-color: transparent; background: var(--panel-2); }
  .btn--ghost:active { background: var(--border-row); }
  .tablebar__input, .tablebar__select, .topbar select, .topbar input[type="date"] {
    border-color: transparent;
    transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
  }
  .tablebar__input:hover, .tablebar__select:hover,
  .topbar select:hover, .topbar input[type="date"]:hover {
    border-color: var(--border);
  }
  .topbar select:focus, .topbar input[type="date"]:focus,
  .batchbar select:focus {
    outline: none; border-color: var(--accent); box-shadow: var(--ring);
  }
  /* 顶栏混着三种来源（topbar 自己的按钮、挪进顶栏的批次条、id 上挂高度的登录键）：前两条规则特异性更高，这里统一压到 34 */
  body.batchbar-in-top .batchbar .btn,
  body.batchbar-in-top .batchbar .btn--sm,
  body.batchbar-in-top .batchbar select,
  body.batchbar-in-top .topbar .field select,
  body.batchbar-in-top .topbar .field input,
  #batch-date,
  #open-auth {
    height: 34px; min-height: 34px;
  }
  /* 统计页明细表：41px 行高比数据表松一档，压到 34；表头字色跟数据表统一 */
  .stats__table th, .stats__table td { padding: 0.26rem 0.7rem; }
  .stats__table thead th { color: var(--muted); font-weight: 600; }
  /* KPI 四张卡 0.9rem 内边距 + 23px 数字，比下面的图重；收一档让图当主角 */
  .stats__kpi .kpi { padding: 0.7rem 0.85rem; }
}
/* ---- 卡片顶栏三个图标统一成一种按钮 ---- 34px 圆形无边框；只有「拍照」留淡主色底（现场最高频），按下给浅灰反馈。 */
@media (max-width: 720px) {
  .grid .grid__cell--del .icon-btn[data-act],
  .grid .grid__cell--del .row-dispatch {
    width: 34px; height: 34px; border: none; border-radius: var(--radius-pill); background: transparent;
    color: var(--muted);
  }
  .grid .grid__cell--del .icon-btn[data-act="photo"] { background: var(--brand-soft); border-color: transparent; }
  .grid .grid__cell--del .icon-btn:active,
  .grid .grid__cell--del .row-dispatch:active { background: var(--panel-2); }
}
/* ---- 统计页空 KPI 别抢戏 ---- 值只有一条横杠却占 1/3 屏宽、字号 23px：用描边卡 + 灰字，读作「这项还没启用」；点它仍能补列。 */
.stats__kpi .kpi--empty { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.stats__kpi .kpi--empty b { color: var(--muted); font-size: var(--fs-17); font-weight: 600; }
/* ---- 选中行左侧压一条主色竖线 ---- 选中行只有一层很淡的蓝底，分不清选了哪几行；行首补 2px 主色线。 */
.grid tbody tr.is-selected > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
/* ---- 筛空后的空态 ---- 居中的一块：放大镜线稿 + 「没有匹配的结果」+ 说明 + 一键清除（跟工具条同一个函数）。 */
.emptyblock {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-sizing: border-box; min-height: 100%; padding: 1.2rem; text-align: center;
}
.emptyblock[hidden] { display: none; }
.emptyblock__ico {
  position: relative; width: 34px; height: 34px; margin-bottom: 0.7rem;
  border: 2px solid var(--border-strong); border-radius: 50%;
}
.emptyblock__ico::after {
  content: ""; position: absolute; right: -7px; bottom: -5px; width: 13px; height: 2px;
  border-radius: 2px; background: var(--border-strong); transform: rotate(45deg);
}
.emptyblock__title { margin: 0 0 0.2rem; font-size: var(--fs-15); font-weight: 600; color: var(--text); }
.emptyblock .empty { margin: 0; padding: 0; border: 0; font-size: var(--fs-13); color: var(--muted); }
.emptyblock__btn { margin-top: 0.9rem; }
/* ---- 手机统计页别让空 KPI 占半屏 ---- 没「是否销项」列时三张只有一条横杠却占两格：手机只留「总条数」和带引导的那张，桌面四张当预览。 */
@media (max-width: 720px) {
  /* 未销项 / 销项率都要有销项列才算得出；已销项那张带「还没有销项列 ›」引导，留着 */
  .stats__kpi .kpi--empty#kpi-left,
  .stats__kpi .kpi--rate.kpi--empty { display: none; }
}
/* ---- 导入向导别横向溢出 ---- 四列在 390 上要 426px：窄屏改两行两列，上行「原表列 ｜ 原表内容」，下行「用途 ｜ 导入后的列名」。 */
@media (max-width: 720px) {
  .imp__head { display: none; }
  .imp__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 0.35rem; column-gap: 0.5rem; }
  .imp__row > .imp__src { grid-column: 1; grid-row: 1; font-weight: 600; }
  .imp__row > .imp__sample { grid-column: 2; grid-row: 1; text-align: right; }
  .imp__row > select { grid-column: 1; grid-row: 2; width: 100%; }
  .imp__row > input { grid-column: 2; grid-row: 2; width: 100%; }
}
/* 弹窗打开时焦点落进面板，面板本身不是控件，别给它描一圈焦点环 */
.modal__panel:focus,
.modal__panel:focus-visible { outline: none; }
/* 没有疑点的行也给「…」入口：这组操作原先只有 ⚠ 行点得开，解析干净但内容错的行只能手改格子。鼠标设备 hover 才现形。 */
.grid__cell--del .rowmore-btn {
  transition: opacity var(--dur-1) var(--ease); color: var(--muted); letter-spacing: 0;
}
@media (hover: hover) and (pointer: fine) {
  .grid tbody tr .grid__cell--del .rowmore-btn { opacity: 0; }
  .grid tbody tr:hover .grid__cell--del .rowmore-btn,
  .grid tbody tr.is-selected .grid__cell--del .rowmore-btn,
  .grid tbody tr:focus-within .grid__cell--del .rowmore-btn,
  .grid__cell--del .rowmore-btn:focus-visible {
    opacity: 1; color: var(--text);
  }
}
/* 触摸屏没有 hover：跟 ✕ 一样弱化到 72%，别让它一直全黑着抢眼（也不能藏 —— 藏了就没入口了） */
@media (hover: none) {
  .grid__cell--del .rowmore-btn { opacity: 0.72; }
}
/* 手机不显示：卡片顶栏已经有 ✕ / 拍照 / 派单，再加就挤了 */
@media (max-width: 720px) {
  /* 必须写三段权重：两段压不住上面 `.grid .grid__cell--del .icon-btn{display:inline-flex}`，写了两段等于没藏 */
  .grid .grid__cell--del .rowmore-btn { display: none; }
}
/* ---- 手机点行 → 底部抽屉 ---- 点一格直接进 contenteditable，键盘弹起来遮住上下文；抽屉把关键字段一次摆出，键盘只在最下面顶起面板。
   hidden 必须自己压住：UA 的 [hidden]{display:none} 输给类选择器的 display。 */
.esheet { position: fixed; inset: 0; z-index: 66; }
.esheet[hidden] { display: none !important; }
.esheet:not([hidden]) { display: flex; align-items: flex-end; }
.esheet__mask { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.42); }
.esheet__panel {
  position: relative; width: 100%; max-height: 84vh; overflow: auto; display: flex;
  flex-direction: column; gap: 0.55rem;
  padding: 0.6rem 0.9rem calc(0.8rem + env(safe-area-inset-bottom, 0px)); background: var(--bg1);
  border-top: 1px solid var(--border-strong); border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18); animation: esheet-up var(--dur-2) var(--ease);
}
@keyframes esheet-up {
  from { transform: translateY(16px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.esheet__head { display: flex; align-items: center; gap: 0.5rem; }
.esheet__title {
  flex: 1; min-width: 0; font-size: 1rem; font-weight: 650; color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.esheet__x {
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 1.05rem;
}
.esheet__x:hover { background: var(--bg2); color: var(--text); }
.esheet__body { display: flex; flex-direction: column; gap: 0.5rem; }
.esheet__field { display: flex; flex-direction: column; gap: 0.25rem; }
.esheet__field[hidden] { display: none; }
.esheet__field > span { font-size: 0.72rem; letter-spacing: 0.02em; color: var(--muted); }
/* 16px 是关键：iOS 上 <16px 的输入框一聚焦就会把整页放大 */
.esheet__field input,
.esheet__field textarea,
.esheet__field select {
  width: 100%; font: inherit; font-size: 16px; line-height: 1.45; padding: 0.5rem 0.6rem;
  color: var(--text); background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.esheet__field textarea { min-height: 3.1rem; resize: vertical; }
.esheet__field input:focus,
.esheet__field textarea:focus,
.esheet__field select:focus {
  outline: none; border-color: var(--accent); background: var(--bg1); box-shadow: var(--ring);
}
.esheet__foot { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.1rem; }
.esheet__foot .btn { min-height: 40px; }
.esheet__foot #esheet-save { margin-left: auto; }
/* 抽屉打开时 toast 挪到顶部：底部整块被面板占着，弹在下面正好盖住「责任单位」 */
body.has-esheet .toast { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 12px); }
@media (min-width: 721px) {
  .esheet { display: none !important; }
 }
/* ---- 账号与用量 / 找回码 / 协议链接 ---- 用量条只读，颜色只用主题变量；找回码用等宽字体 + 选择态方便抄。 */
.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--brand);
  font-size: var(--fs-12); text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--text); }
.auth-forgot { margin: 0.35rem 0 0; }
.legal-links { margin: 0.6rem 0 0; color: var(--muted); font-size: var(--fs-12); }
.legal-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.legal-links a:hover { color: var(--text); }
.legal-links--center { text-align: center; }
.legal-links--center a { margin: 0 0.45rem; }
#auth-signed-out.is-reset > :not(#auth-reset):not(#auth-error) { display: none; }
.auth-reset__acts { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.6rem; }
.usage { display: grid; gap: 0.45rem; margin: 0.2rem 0 0.3rem; }
.usage__row { display: grid; grid-template-columns: 6.2rem 1fr auto; align-items: center; gap: 0.5rem; }
.usage__label { font-size: var(--fs-12); color: var(--muted); }
.usage__bar { height: 6px; border-radius: 999px; background: var(--border-strong); overflow: hidden; }
.usage__fill {
  display: block; height: 100%; border-radius: 999px; background: var(--brand);
  transition: width 0.25s ease;
}
.usage__fill.is-hot { background: #d97706; }
.usage__fill.is-full { background: #dc2626; }
.usage__num {
  font-size: var(--fs-12); color: var(--text); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.usage__note { font-size: var(--fs-12); color: var(--muted); margin: 0; }
.usage__code {
  margin: 0.4rem 0 0; padding: 0.5rem 0.6rem; border-radius: var(--radius);
  background: var(--brand-soft); border: 1px dashed var(--border-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-13);
  letter-spacing: 0.06em; word-break: break-all; user-select: all;
}
.usage__acts, .drawer .usage__acts { display: flex; gap: 0.5rem; flex-wrap: wrap; }
/* 派单责任人没填：输入框闪一下红边（1.6s 后自己消），别只弹提示 */
#dispatch-owner.is-invalid {
  border-color:var(--danger) !important;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent);
}
/* 规则判出来的责任单位（原文没写）：虚线下划线提示「这是推断」 */
.unit-chip--guess { text-decoration:underline dotted; text-underline-offset:3px; text-decoration-color:var(--muted); }
/* 卡片里的「是否销项」让 label 和小 pill 排一行、pill 自适应宽度：通栏拉满像一条空着的横槽，还把卡片顶高 40px。 */
@media (max-width: 720px) {
  .grid tbody tr > .grid__cell[data-label="是否销项"] {
    /* 上面 .grid tbody tr > .grid__cell--clear 用 !important 钉成 block，这里必须同样 !important 才盖得住 */
    display:flex !important; align-items:center; justify-content:flex-start; gap:.4rem; text-align:left;
    padding-top:.45rem; padding-bottom:.15rem;
  }
  .grid tbody tr > .grid__cell[data-label="是否销项"]::before { margin:0; flex:none; }
  .grid tbody tr > .grid__cell[data-label="是否销项"] .clear-toggle {
    width:auto; flex:none; min-width:0; min-height:28px; height:28px; padding:0 .85rem;
    font-size:var(--fs-13); line-height:26px;
  }
}
/* 卡片只剩勾选和图标时的兜底：≤720 里字段格若被藏了，app.js 的 guardCardText() 给 body 挂 fx-cellguard，这里把格子硬放回来。正常手机不会命中。 */
@media (max-width: 720px) {
  body.fx-cellguard .grid tbody tr > .grid__cell {
    display: block !important; width: auto !important; max-width: none !important;
    min-width: 0 !important; height: auto !important; opacity: 1 !important;
    visibility: visible !important; color: var(--text, #16181d);
  }
  body.fx-cellguard .grid tbody tr > .grid__cell[data-col] { flex: 1 1 100% !important; }
  body.fx-cellguard .grid thead { display: none !important; }
}
/* 输入区底部的「新建表」出口（表里有数据才出现）：手机上这一行塞不下四个元素，窄屏本来就有底部「+」新建，收起。 */
@media (max-width: 720px) {
  #run-new { display: none !important; }
}
#run-new { margin-right: .4rem; }
/* 工具条 select 用无边框的浅底胶囊：形状靠底色区分，视线不被六个小三角框住；悬停加深、聚焦才出主色描边。 */
.batchbar__select, .tablebar__select {
  background: color-mix(in srgb, var(--text) 4%, transparent); border-color: transparent;
  border-radius: 999px; padding: 0 0.7rem;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.batchbar__select:hover, .tablebar__select:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.batchbar__select:focus, .tablebar__select:focus { background: var(--bg1); border-color: var(--accent); }
/* 结果表是大头：桌面上去掉外层大卡片，左右之间只留一根 1px 细线，表格自己撑到卡片边缘。 */
@media (min-width: 881px) {
  .workspace > .panel { background: transparent; border-color: transparent; padding: 0.55rem 0.9rem; }
  .workspace > .panel:first-child { border-right: 1px solid var(--border); border-radius: 0; }
  .workspace > .panel:nth-child(2) { border-radius: 0; }
}
.batchbar select, .tablebar select, .topbar select,
.batchbar .field select, .batchbar .field select:hover,
.topbar .field select, .topbar .field select:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent); border-color: transparent;
  border-radius: 999px;
}
/* 导出是这一屏的最终交付动作 —— 给它一点主色淡底，和旁边的「加行 / 更多」不是一个重量 */
#export-xls {
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: transparent;
  color: var(--accent); font-weight: 600;
}
#export-xls:hover { background: color-mix(in srgb, var(--accent) 17%, transparent); }
.start { border-style: dashed; background: transparent; }
/* 1280/1366 笔记本上顶栏本来就紧：胶囊的内边距在这里收窄一圈，别把「工程」整组挤到第二行去 */
@media (max-width: 1400px) and (min-width: 881px) {
  .topbar select, .batchbar select, .tablebar select { padding: 0 0.35rem; }
  .topbar { gap: 0.55rem; }
  .topbar__actions { gap: 0.45rem; }
  .batchbar { gap: 0.4rem; }
}
/* 模板设置：三段分段控制器 + 「?」收说明（app.js enhanceTemplateDrawer） */
.drawer__body .seg {
  position: sticky; top: 0; z-index: 3; display: flex; gap: 0.25rem; padding: 0.25rem;
  margin: 0 0 0.9rem; border-radius: 999px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
.seg__btn {
  flex: 1; height: 30px; border: 0; background: transparent; border-radius: 999px; font: inherit;
  font-size: var(--fs-12); color: var(--muted); cursor: pointer;
}
.seg__btn.is-on {
  background: var(--bg1); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in srgb, #000 10%, transparent);
}
.seg__item > h3 { display: flex; align-items: center; gap: 0.35rem; }
.seg__q {
  width: 17px; height: 17px; flex: none; padding: 0; border: 1px solid var(--border);
  border-radius: 50%; background: transparent; color: var(--muted); font-size: 11px; line-height: 1;
  cursor: pointer;
}
.seg__q:hover { color: var(--accent); border-color: var(--accent); }
.seg__hint { display: none !important; }
.seg__item.show-hints .seg__hint { display: block !important; }
.chart__head b { font-variant-numeric: tabular-nums; }
/* 筛选生效时，对应的两个胶囊才染主色 —— 平时安静，用上了才跳出来 */
.tablebar.has-filter #filter-col,
.tablebar.has-filter #filter-val {
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  font-weight: 600;
}
/* 筛选 Popover：一个胶囊收四个下拉（app.js mergeFilterBar） */
.tablebar { position: relative; }
#filter-open { display: inline-flex; align-items: center; gap: 0.3rem; }
#filter-open.is-on {
  background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: transparent;
  color: var(--accent); font-weight: 600;
}
.fpop__n {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent);
  color: #fff; font-size: var(--fs-10); line-height: 16px; text-align: center;
}
.fpop {
  position: absolute; z-index: 40; top: calc(100% - 2px); left: 0;
  width: min(340px, calc(100vw - 24px)); padding: 0.7rem; display: grid; gap: 0.45rem;
  background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px);
  box-shadow: 0 14px 34px color-mix(in srgb, #000 16%, transparent);
}
.fpop__row { display: flex; align-items: center; gap: 0.55rem; }
.fpop__row > span { flex: none; width: 2.6rem; color: var(--muted); font-size: var(--fs-12); }
.fpop__row > select {
  flex: 1 1 auto; min-width: 0; height: 32px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 0.5rem;
}
.fpop__row[hidden] { display: none; }
.fpop__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding-top: 0.15rem;
}
.fpop__foot .btn:first-child { margin-right: auto; }
/* 面板搬进来后两个 select 要常显，只有真正无值可选的（带 hidden 属性）才藏 */
.fpop .tablebar__select { display: block !important; }
.fpop select[hidden] { display: none !important; }
/* 面板里的下拉保持表单色（外面胶囊的激活染色不要漏进来） */
.fpop #filter-col, .fpop #filter-val {
  background: var(--bg2) !important; color: var(--text) !important; font-weight: 400 !important;
}
/* 长描述悬停浮层（app.js longCellTip）：比系统 title 快、可滚动、跟着格子走 */
.celltip {
  position: fixed; z-index: 60; max-width: min(420px, 90vw); max-height: 40vh; overflow: auto;
  padding: 0.6rem 0.7rem; background: var(--bg1); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 30px color-mix(in srgb, #000 18%, transparent);
  font-size: var(--fs-12); line-height: 1.55; white-space: pre-wrap;
}
/* 桌面：问题描述列夹到 2 行，悬停看全文（longCellTip），编辑时整格展开，打印也展开；手机卡片不套这套。 */
@media (min-width: 721px) {
  .grid__cell--grow { max-height: 4rem; overflow: hidden; }
  /* 表头中文不许一字一行地竖着断（「序号」「楼栋房号」被拆两行最难看） */
  #grid thead th { white-space: nowrap; }
  .grid__cell--grow .cell-clamp { -webkit-line-clamp: 2; }
  .grid__cell--grow:focus { max-height: none; overflow: visible; }
}
@media print {
  .grid__cell--grow { max-height: none; overflow: visible; }
}
/* 问题描述列在桌面上要够宽，才不会一行只放四个字 */
@media (min-width: 881px) {
  .grid__th--grow, .grid__cell--grow { min-width: 208px; }
}
/* 桌面：表格那半边给一块白面，左栏留在画布上。结构靠「一块面 + 一点影」，不再画分割线（1px 灰线在浅灰画布上几乎看不见）。 */
@media (min-width: 881px) {
  .workspace > .panel:nth-child(2) {
    background: var(--bg1); border-radius: 14px;
    box-shadow: 0 1px 2px color-mix(in srgb, #000 5%, transparent);
  }
  .workspace > .panel:first-child { border-right: 0; }
}
/* 统计空态：别留一个几百像素的空框，缩成一条虚线提示 + 出口 */
.stats__wrap.is-empty {
  flex: 0 0 auto !important; height: auto !important; min-height: 0 !important;
  border: 1px dashed var(--border); border-radius: 12px; background: transparent; overflow: visible;
}
.stats__wrap.is-empty #stats-empty { margin: 0; padding: 1.8rem 1rem 0.5rem; }
.stats-cta { display: flex; justify-content: center; padding: 0 1rem 1.8rem; }
.stats-cta[hidden] { display: none; }
/* 「合并导出 Excel」在 1021~1399 换行成两行，按钮变高把整行顶歪：禁止折行，1400 以下只留「合并导出」四字。 */
#export-all { white-space: nowrap; }
@media (max-width: 1399px) {
  #export-all .wide-hide { display: none !important; }
}
@media (min-width: 881px) {
  .grid-wrap { min-height: 260px; }
}
/* 左栏窄到 380 以下时脚注 + 主按钮挤不进一行，按钮被推到卡片外还压住表格：1200 以下折行，1100 以下先收起「Ctrl / ⌘ + Enter」提示。 */
@media (max-width: 1200px) and (min-width: 881px) {
  .panel__foot { flex-wrap: wrap; row-gap: 0.45rem; }
  .panel__foot #run { margin-left: auto; }
}
@media (max-width: 1100px) {
  .panel__foot .kbd-hint { display: none !important; }
}
/* 手机空态：插画 + 三颗按钮 + 两行说明摞了 370px，首屏只露出半张插画。插画压到 76、说明让位（筛空提示例外），按钮排成 1 主 + 2 次的网格。 */
@media (max-width: 720px) {
  .start { padding: 1.1rem 0.8rem; }
  .start__art { max-height: 76px; overflow: hidden; margin-bottom: 0.5rem; }
  .start__art svg { height: 76px; width: auto; }
  .start__sub:not(.start__sub--view), .start__tip { display: none; }
  .start__acts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: 0.7rem; }
  .start__acts > #start-import { grid-column: 1 / -1; }
}
/* .mnav 是 62px 固定位，70px 的 padding 只够垫它自己；34px 的工作表标签条正好压在它上面，滚到底也翻不出来 → 一起垫进去。 */
@media (max-width: 880px) {
  body { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  .fx-fab { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
}
/* 工作表标签条贴住底栏上沿（62px），滚到哪都在，不会藏到 .mnav 下面 */
@media (max-width: 880px) {
  .sheetbar {
    position: sticky; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); z-index: 59;
    background: var(--bg1); border-top: 1px solid var(--border);
  }
}
/* 390 的批次组头挤成两行、右半边只剩「只看此批」悬空：说明句让位，整行压回一行 */
@media (max-width: 480px) {
  .grid tr.grid__group > td > div { flex-wrap: nowrap; overflow: hidden; }
  .grid__group-hint-short { display: none; }
  .grid__group-only { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 480px) {
  .grid__group-only {
    border: 0 !important; background: transparent !important; color: var(--accent) !important;
    padding: 0 0.2rem !important;
  }
}
/* 1021~1399 标签一直竖在控件上面，顶栏就这么被撑到 84px；这一段宽度足够横排，跟 ≥1400 一个排法。 */
@media (min-width: 1021px) and (max-width: 1399px) {
  .topbar { flex-wrap: nowrap; }
  .topbar .field { flex-direction: row; align-items: center; gap: 0.32rem; }
  .topbar .field input, .topbar .field select { height: var(--ctl-h-lg); }
  .topbar .field span { white-space: nowrap; }
}
/* 不写 color-scheme 时，日期选择器弹层、select 下拉、滚动条、勾选框在暗色主题下仍是一片白，像另一个应用。 */
:root { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
:root { accent-color: var(--accent); }
/* 表头吸顶阴影原先是硬切上去的，滚动时「啪」一下出现：补过渡，rgba 换 color-mix 跟暗色主题走。 */
.grid__th { transition: box-shadow var(--dur-2) var(--ease); }
.grid-wrap.is-scrolled .grid__th {
  box-shadow: 0 1px 0 var(--border), 0 8px 14px -10px color-mix(in srgb, #000 24%, transparent);
}
.grid-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  .grid__th { transition: none; }
 }
/* ---- Modern Web Guidance 落地 ---- WebKit 那套滚动条只对 Chrome/Safari 有效，Firefox 还是系统粗条：标准属性写一遍，深色主题才跟着变。 */
.grid-wrap, .stats__wrap, .drawer__body, .diff__list, .modal__panel, .modal__panel > .modal__body, .trash-list, .log-list {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 26%, transparent) transparent;
}
/* 表格出现纵向滚动条时列宽别跳：为滚动条预留槽位 */
.grid-wrap { scrollbar-gutter: stable; }
/* ② 中文正文的行内标点：`text-spacing-trim` 收掉行首多余的全角间距，段落更齐 */
body { text-spacing-trim: trim-start; }
/* 标题与空态这类短句用 balance 断行，别出现「记录」独占一行的孤字 */
.modal__panel h2, .start__title { text-wrap: balance; }
.start__sub, .pastehint, .stats-empty, .celltip { text-wrap: pretty; }
/* ③ 弹窗打开时背景锁滚：手机上一滑底下的表格跟着动，就是「两层页面」的错觉来源。 */
html.fx-locked { overflow: hidden; }
/* 粘贴框自己的滚动条还是系统粗条（Chrome ≥121 认 scrollbar-width）；resize 手柄保留，用户仍可拖高。 */
#raw-input, .modal textarea, .rules-input {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 26%, transparent) transparent;
}
/* ---- 判定留痕 ---- 责任单位旁的小点＝「这一格有依据可查」：判出来的（规则/默认/案例库/AI）用强调色，原文写明的用静音色，不新造色板。 */
.why-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  margin-left: 1px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 0; line-height: 1; cursor: pointer; position: relative;
  vertical-align: middle; transition: background var(--dur-1) var(--ease);
}
/* 点本身：4px 实心圆。不写字符 —— 字符在不同字体下会偏、会糊 */
.why-dot::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55;
  transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.why-dot:hover::before, .why-dot:focus-visible::before { opacity: 1; transform: scale(1.6); }
/* 视觉 18px、手指可点 40px：往外扩一圈命中区，不占布局 */
.why-dot::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
.why-dot:hover, .why-dot:focus-visible { color: var(--accent); background: var(--bg1); outline: none; }
.why-dot:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.why-dot--vocab, .why-dot--none { color: var(--muted); opacity: .72; }
.why-dot--vocab-unknown { color: var(--warn); }
.why-dot--pending { color: var(--warn); }
.why-dot--vocab { color: var(--muted); }
.why-pop {
  position: fixed; z-index: 90; width: 300px; max-width: calc(100vw - 16px); padding: 12px 14px 13px;
  border-radius: var(--radius-sm); background: var(--panel); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
  font-size: var(--fs-12); line-height: 1.65;
}
.why-pop__hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.why-pop__badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: var(--radius-pill); font-size: var(--fs-11); font-weight: 600;
  background: var(--brand-soft); color: var(--accent);
}
.why-pop__badge { border: 1px solid transparent; }
.why-pop__badge--vocab, .why-pop__badge--none {
  background: var(--bg1); color: var(--muted); border-color: var(--border);
}
.why-pop__badge--correction, .why-pop__badge--case, .why-pop__badge--ai {
  background: var(--accent-soft, var(--bg1));
}
.why-pop__badge--vocab-unknown, .why-pop__badge--pending { background: var(--warn-soft); color: var(--warn); }
.why-pop__x {
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: var(--fs-15); cursor: pointer;
}
.why-pop__x:hover { background: var(--bg1); color: var(--text); }
.why-pop__unit { font-size: var(--fs-13); font-weight: 600; margin-bottom: 2px; }
.why-pop__label { color: var(--text); }
.why-pop__src { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-row); color: var(--muted); }
.why-pop__tip { margin-top: 6px; color: var(--muted); }
@media (max-width: 720px) {
  .why-pop { width: calc(100vw - 20px); left: 10px !important; right: 10px; }
}
/* ---- 大图查看：同一行的照片左右翻（手机可滑） ---- 一行最多 18 张，翻一张就退出重进太费手；
   计数放在标题右边，翻到第几张一眼能看到。两条按钮 44px，手指够得着，也不挡图像中间。 */
/* 大图标题：房号/前后与「第几张」挨着放左边，关闭按钮仍然贴右（modal__head 默认 space-between 会把它推到中间） */
#photoViewer .modal__head { justify-content: flex-start; gap: .55rem; }
#photoViewer .modal__head .icon-btn { margin-left: auto; }
.viewer-count {
  font-size: var(--fs-12); color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.viewer-body { position: relative; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--bg1) 84%, transparent);
  color: var(--text); font-size: 24px; line-height: 1; padding-bottom: 3px;
  box-shadow: 0 2px 10px color-mix(in srgb, #000 12%, transparent);
  transition: background var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.viewer-nav:hover { background: var(--bg1); }
.viewer-nav:disabled { opacity: .32; cursor: default; }
.viewer-nav[hidden] { display: none !important; }
.viewer-nav--prev { left: 10px; }
.viewer-nav--next { right: 10px; }
@media (max-width: 720px) {
  .viewer-nav { width: 40px; height: 40px; font-size: 22px; }
  .viewer-nav--prev { left: 4px; }
  .viewer-nav--next { right: 4px; }
}
/* ---- 手机端打印收口 · 压轴覆盖块 ---- 必须放在文件最后：720px 卡片流规则在文件后段，同特异性下靠位置取胜；打印（A4 横向）时恢复表格版式，表头每页重复，字号 ≥9pt。 */
@media print {
  .mnav, .more-layer { display: none !important; }
  .grid { display: table !important; width: 100%; }
  .grid thead { display: table-header-group !important; }
  .grid thead th { display: table-cell !important; }
  .grid tr { display: table-row !important; break-inside: avoid; page-break-inside: avoid; }
  .grid td { display: table-cell !important; }
  .grid thead th, .grid td {
    font-size: 9pt !important; width: auto !important; max-width: none !important;
    border-bottom: 1px solid #bbb !important; padding: 3px 4px !important;
    background: transparent !important; color: #000 !important; box-shadow: none !important;
  }
  .grid thead th {
    border-bottom: 1.2px solid #333 !important; background: #eee !important;
    font-weight: 700 !important;
  }
}
@media print {
  /* 卡片/表格里的操作按钮（发送/拍照/删除/派单）不进纸 */
  .grid .icon-btn, .grid .suspect-btn, .grid .clear-toggle, .grid button { display: none !important; }
}
