/* 跨页公共件样式：列表页 与 独立模板 共用一份
 *
 * 只放「多类页面都要复用、且能独立使用」的组件：
 *   · 分页器 .pager*（唯一实现在 js/page-common.js 的 DP.renderPager，见架构说明 §1.2.9 ③）
 *   · 状态文本 / 空态 .status-text / .empty / .loading
 *   · 人员胶囊 .person-chip*（企微头像 + 成员管理命名，全系统人员字段统一口径）
 *
 * 列表页底座（容器 / 表格 / 冻结列 / 页头工具条）仍在 css/table-page.css。
 * 独立模板（审批页 / 录入模版 / 成员页 / 二维码页 / 工序字典 等）只需引三样：
 *   css/dp-common.css + js/dp-ui.js + js/page-common.js
 * 即可与列表页共用同一套分页器与提示，不必再各写一套。
 *
 * 颜色一律走变量 + fallback（全系统统一浅色）：独立模板的主题变量名不一定齐全
 * （列表页用 --muted，表单·详情类页面用 --text-muted），取不到就回落固定浅色值。
 * 页面若确需微调控件观感，在自己的 <style> 里覆盖 .pager-btn 即可（不要改本文件）。
 */

/* Keep the first paint blank until identity is resolved or navigation completes. */
body.page-auth-pending *,
body.page-auth-redirecting * {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ---- 分页器 ----
   页码式：首页 / 上一页 / 页码（当前页高亮）/ 下一页 / 末页 + 「第 x–y 条 / 共 N 条」。
   隐藏一律用 [hidden] 属性，页面不要再写一套 .pager / .show。 */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; padding: 10px 0 2px; }
.pager[hidden] { display: none; }
.pager-btn {
  border: 1px solid var(--border, #e2e8f0); background: #fff; color: var(--text, #0f172a);
  border-radius: 8px; min-width: 34px; height: 30px; padding: 0 9px; font-size: 12px;
  line-height: 1; cursor: pointer; font-family: inherit; transition: .15s ease;
}
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-btn.is-active {
  border-color: rgba(37, 99, 235, 0.18); color: var(--primary, #2563eb);
  background: var(--primary-soft, rgba(37, 99, 235, 0.10)); font-weight: 600;
}
.pager-gap { color: var(--muted, var(--text-muted, #64748b)); padding: 0 2px; }
/* 追加式（仅审批页、看板移动端两处例外）：整宽按钮居中，观感与旧「加载更多」一致 */
.pager.is-more { flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; }
.pager.is-more .pager-btn { width: 100%; height: 38px; }
.pager.is-more .pager-text { text-align: center; }
.pager-text { font-size: 12px; color: var(--muted, var(--text-muted, #64748b)); white-space: nowrap; }
.pager-select {
  width: auto; min-width: 92px; padding: 6px 8px; font-size: 12px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px; background: #fff;
  color: var(--text, #0f172a); font-family: inherit; outline: none;
}

/* ---- 状态文本 / 空态 / 加载态 ----
   分工（§1.2.9）：内容区为空时的加载占位＝.loading（小圆环 + 文案）；
   表格/列表已有内容时的行内状态＝.status-text（灰字，无圆环，见 DP.setStatus）。 */
.status-text { font-size: 12px; color: var(--muted, var(--text-muted, #64748b)); }
.status-text.error { color: var(--danger, #dc2626); }
.status-text.ok { color: var(--success, #059669); }
/* 空态：视觉统一在这里，语义（暂无数据 / 筛选无结果 / 加载失败 / 读满截断）由调用方给，
   统一写法＝DPUI.empty(host, {kind, text, hint, onClear})（见 dp-ui.js）。
   图标＝内联 SVG（.empty-icon，不依赖图标字体，任何页面都画得出来）。 */
.empty {
  padding: 22px; text-align: center; font-size: 13px;
  color: var(--muted, var(--text-muted, #64748b));
}
.empty-icon { width: 34px; height: 34px; margin: 0 auto 10px; display: block; opacity: .35; }
.empty p { margin: 0; line-height: 1.7; }
.empty p + p, .empty .empty-hint { margin-top: 4px; font-size: 12px; opacity: .8; }
.empty.is-error { color: var(--danger, #dc2626); }
.empty.is-error .empty-icon { opacity: .6; }
.empty-action {
  margin-top: 12px; padding: 7px 14px; font-size: 13px; font-family: inherit; cursor: pointer;
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px; background: #fff;
  color: var(--primary, #2563eb); transition: .15s ease;
}
.empty-action:active { opacity: .75; }
/* 加载态：唯一视觉＝小圆环（CSS 绘制，不依赖字体图标）+ 居中灰字。
   页面不要再自写 .loading / 图标型 loading，统一用 DPUI.loading(host, text)（见 dp-ui.js）。 */
.loading {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px; text-align: center; font-size: 13px;
  color: var(--muted, var(--text-muted, #64748b));
}
.loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border, #e2e8f0); border-top-color: var(--primary, #2563eb);
  animation: dp-loading-spin .8s linear infinite;
}
/* 失败态：与加载态同一占位，换语义色、去掉转圈（由 DPUI.loadingError 使用） */
.loading.is-error { color: var(--danger, #dc2626); }
.loading.is-error::before { display: none; }
@keyframes dp-loading-spin { to { transform: rotate(360deg); } }

/* ---- 清残影（C.1）----
   「上一批数据算出来的控件」（分页条 / 筛选条 / 条件胶囊 / 状态徽标…）由页面在模板里打
   data-dp-transient，取数失败时调一次 js/dp-ui.js 的 DPUI.clearTransient() 整批收掉 ——
   页面不必再各自维护「要清哪些节点」的清单。
   标记过的宿主 hidden 恒生效，不被它自己的 display 规则盖掉（内联 display 由 clearTransient 清掉）。 */
[data-dp-transient][hidden] { display: none; }

/* ---- 人员胶囊（企微头像 + 成员管理里的命名）：全系统人员字段统一展示口径 ---- */
.person-chips {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; max-width: 100%;
}
.person-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 8px 2px 2px; border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px; background: #fff; font-size: 12px; line-height: 1.4;
  color: var(--text, #0f172a);
}
.person-chip-avatar {
  width: 18px; height: 18px; border-radius: 50%; object-fit: cover;
  flex: 0 0 auto; display: block;
}
.person-chip-avatar.is-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft, rgba(37, 99, 235, 0.10)); color: var(--primary, #2563eb);
  font-size: 10px; font-weight: 600;
}
.person-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.person-chip-pick {
  border: 0; background: transparent; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; max-width: 100%;
}

/* ---- 选项值彩色小标签 ----
   列表单元格 / 详情 / 卡片里的「选项类字段值」（客户类型、意向产品、客户等级…）统一用它：
   底色极浅 + 同色系深字 + 细边框，不做大面积色块（第 2 条视觉红线）。
   --opt-bg / --opt-fg / --opt-bd 由 js/page-common.js 的 DP.optionChipStyle 按选项文本给出，
   与下拉候选用的是同一套调色板与稳定哈希 —— 同一个选项文本，全站同色。 */
.opt-chip {
  display: inline-flex; align-items: center; justify-content: center; max-width: 100%;
  padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--opt-bd, #e2e8f0);
  background: var(--opt-bg, #f1f5f9);
  color: var(--opt-fg, #334155);
  font-size: 11px; line-height: 1.7; white-space: nowrap; text-align: center;
  vertical-align: middle;
}
/* 「超期完成」告警变体：直接落 background/color/border-color（比 .opt-chip 高一级特异度），
   覆盖掉 optionChipHtml 内联给的 --opt-* 变量色，确保延误结果一律显红。
   注：行内样式只设了 --opt-* 自定义属性、没设这几个具体属性，故此处无需 !important。 */
.opt-chip.is-late {
  background: var(--danger-soft, rgba(220, 38, 38, 0.10));
  border-color: rgba(220, 38, 38, 0.28);
  color: var(--danger, #dc2626);
}

/* ---- 可点选项胶囊 .chip-btn ----
   全站唯一底座（快捷筛选 / 客户模块多选 / 录入模版多选共用）：
   默认白底细边，`.on`（或 `.primary`）为选中态。列表页底座 table-page.css 不再重复定义。
   需要「胶囊形 + 移除 ×」的页面（录入模版多选）在此之上只做局部覆盖。 */
.chip-btn {
  border: 1px solid var(--border, #e2e8f0); background: #fff; color: var(--text, #0f172a);
  border-radius: 6px; cursor: pointer; padding: 6px 10px;
  font-size: 11px; line-height: 1; white-space: nowrap; transition: .15s ease;
  font-family: inherit;
}
.chip-btn.on, .chip-btn.primary {
  border-color: rgba(37, 99, 235, 0.18); color: var(--primary, #2563eb);
  background: var(--primary-soft, rgba(37, 99, 235, 0.10)); font-weight: 600;
}

button.row-delete {
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  vertical-align: middle;
}
button.row-delete:hover { color: #64748b; }

/* ---- 附件文件清单 + 上传区（汇报资料位）----
   文件 chip：点开预览；可带一枚右上角轻量 × 用来移除（只用于「提交前」的待提交清单，
   已落库的只读清单不给删除入口）。
   上传区：整块可点，点开就是系统选文件（**不再叠一个「选择文件」按钮**）。
   注：`templates/order_manage.html` 里另有一份早期的页内实现（.file-chip / .file-thumb），
   那边样式优先级更高、行为不受影响；下次改那一页时并入这里，避免长期两份。 */
.file-row { display: flex; gap: 12px; flex-wrap: wrap; }
.file-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 200px;
  padding: 2px 8px; border: 1px solid var(--border, #e2e8f0); border-radius: 6px;
  background: #fff; color: var(--primary, #2563eb); font-size: 12px; text-decoration: none;
}
.file-chip:hover { border-color: var(--primary, #2563eb); }
.file-chip a { color: inherit; text-decoration: none; }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip-x {
  flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
  color: var(--muted, #64748b); font-size: 13px; line-height: 1; padding: 0 0 0 2px;
}
.file-chip-x:hover { color: var(--danger, #dc2626); }
.dp-upload-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--border, #e2e8f0); border-radius: 50%;
  background: #fff; color: var(--muted, #64748b); cursor: pointer;
  font-size: 16px; line-height: 1;
}
.dp-upload-remove:hover { border-color: var(--danger, #dc2626); color: var(--danger, #dc2626); }
.upload-zone {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; border: 1px dashed var(--border, #e2e8f0); border-radius: 10px;
  background: #f8fafc; color: var(--muted, #64748b); font-size: 12px; cursor: pointer;
}
.upload-zone:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.upload-zone.is-busy { opacity: .6; pointer-events: none; }

/* ---- 附件列：缩略图 / 文件图标（全站唯一实现，标准见《系统架构说明》§1.2.11）----
   图片出缩略图，其它出扩展名图标；**不显示文件名**（名字只放进 title 悬浮）。
   DOM 由 DP.attachmentChipsHtml 生成，页面只给代理地址 urlOf。 */
.attach-row {
  display: inline-flex; gap: 12px; flex-wrap: nowrap; align-items: center;
  vertical-align: middle; width: max-content; max-width: none; white-space: nowrap;
}
.attach-thumb {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; flex: 0 0 48px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 6px;
  background: #f8fafc; overflow: hidden; text-decoration: none;
}
/* 智能表格原生上传：右下角「表」角标，明确来源而不是当成坏图 */
.attach-thumb-badge {
  position: absolute; right: 0; bottom: 0; z-index: 1;
  min-width: 13px; height: 13px; padding: 0 2px;
  border-radius: 4px 0 0 0; background: #475569; color: #fff;
  font-size: 9px; line-height: 13px; text-align: center; font-weight: 600;
}
.attach-thumb:hover { border-color: var(--primary, #2563eb); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb.is-file { background: #eef2f7; color: var(--muted, #475569); font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.attach-thumb.is-image-unavailable, .thumb-sm.is-image-unavailable, .attach-item.is-image-unavailable {
  background: #f1f5f9; color: var(--muted, #64748b); font-size: 9px;
}
.attach-image-unavailable { display: inline-flex; align-items: center; justify-content: center; }
.attach-thumb.is-more { background: #f1f5f9; color: var(--muted, #64748b); font-size: 12px; font-weight: 600; }
/* 缩略图既能是链接/占位，也能是可点按钮（详情页打开预览）：按钮形态清掉浏览器默认内边距与字体 */
button.attach-thumb { padding: 0; font: inherit; cursor: pointer; }
.attach-ext { text-transform: uppercase; }

/* ---- 附件 / 图片「预览浮窗」标准组件（DOM 由 DP.attachViewer 懒注入，全站共用）----
   点缩略图打开；右上角「删除 + ×」；点遮罩/Esc 关闭。预览走 pdf.js（PDF / Word·Excel 后端统一转 PDF），
   图片直出。z-index 夹在详情抽屉(30) 与 toast(999)/确认弹窗(1200) 之间：浮窗之上要能看到提示与确认。 */
.attach-viewer { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; }
.attach-viewer[hidden] { display: none; }
.attach-viewer-mask { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.attach-viewer-panel {
  position: relative; display: flex; flex-direction: column;
  width: min(920px, calc(100vw - 24px)); height: min(88vh, 940px);
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(15,23,42,.35);
}
.attach-viewer-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.attach-viewer-name {
  flex: 1 1 auto; min-width: 0; font-size: 13px; color: #334155;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-viewer-tools { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; }
/* 下载：右上角与「添加 / 删除 / ×」并排 */
.attach-viewer-download {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px;
  border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
  color: #1e293b; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.attach-viewer-download:hover { border-color: var(--primary); color: var(--primary); }
.attach-viewer-download[hidden] { display: none; }
.attach-viewer-download[aria-busy="true"] { opacity: .6; pointer-events: none; }
/* 打印：与下载并排的主操作，预览渲染完成前置灰 */
.attach-viewer-print {
  min-height: 30px; padding: 0 12px; border: 1px solid var(--primary); border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.attach-viewer-print:hover { filter: brightness(1.05); }
.attach-viewer-print[hidden] { display: none; }
.attach-viewer-print:disabled { opacity: .55; cursor: wait; }
/* 删除：红底明确按钮（不是小图标），点后走二次确认 */
.attach-viewer-remove {
  min-height: 32px; padding: 0 14px; border: 1px solid var(--danger); border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.attach-viewer-remove[hidden] { display: none; }
.attach-viewer-remove:disabled { opacity: .55; cursor: wait; }
.attach-viewer-add {
  min-height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer;
}
.attach-viewer-add[hidden] { display: none; }
.attach-viewer-replace {
  min-height: 30px; padding: 0 12px; border: 1px solid var(--primary); border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.attach-viewer-replace[hidden] { display: none; }
.attach-viewer-replace:disabled { opacity: .55; cursor: wait; }
.attach-viewer-close {
  width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: #475569; font-size: 18px; line-height: 1; cursor: pointer;
}
.attach-viewer-body {
  flex: 1 1 auto; min-height: 0; overflow: auto; background: #f1f5f9;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  gap: 10px; padding: 12px;
}
/* 图片预览：整张缩进浮窗里（不铺成一整页），在内容区水平、垂直居中；过宽过高都等比收敛 */
.attach-viewer-image { max-width: 100%; max-height: calc(88vh - 140px); object-fit: contain; margin: auto; }
.attach-viewer-pdf { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.attach-viewer-page { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.18); }
.attach-viewer-loading { color: var(--muted); font-size: 13px; padding: 24px 0; }
.attach-viewer-fallback {
  color: #475569; font-size: 13px; text-align: center; padding: 28px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
/* 不能预览：浅色底卡片把「为什么看不了 / 怎么下载」讲清楚，而不是丢一句无从下手的提示 */
.attach-viewer-fallback.is-unavailable {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 22px 20px; max-width: 440px; width: 100%; gap: 8px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.attach-viewer-type { font-weight: 700; color: #334155; }
.attach-viewer-reason { color: #64748b; font-size: 13px; line-height: 1.65; word-break: break-word; }
.attach-viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0; border-radius: 999px;
  border: 2px solid #334155; background: #fff; color: #0f172a;
  font-size: 24px; font-weight: 700; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 10px rgba(15,23,42,.32);
}
.attach-viewer-nav:hover { background: #0f172a; border-color: #0f172a; color: #fff; }
.attach-viewer-nav[hidden] { display: none; }
.attach-viewer-nav.prev { left: 10px; }
.attach-viewer-nav.next { right: 10px; }

/* ---- 定位（地理位置）标准组件（DOM 由 DP.locationControlHtml / locationTextHtml 生成）----
   取值前是灰字「未获取」；取到后地点文字统一显蓝（与日期 / 附件 / 选项同属标准件）。
   列表 / 详情里的定位列也走 .dp-loc-text，保证「哪儿看到都是蓝色地点」。 */
.dp-loc { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dp-loc-btn { flex: 0 0 auto; }
.dp-loc-choices { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.dp-loc-choice.is-selected { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
.dp-loc-btn.is-set { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.dp-loc-text { color: var(--muted, #94a3b8); font-size: 12px; word-break: break-all; }
.dp-loc-text.is-set { color: var(--primary, #2563eb); font-weight: 600; }
.dp-loc-text.is-error { color: var(--danger, #dc2626); }
a.dp-loc-text { text-decoration: none; }
a.dp-loc-text:hover { text-decoration: underline; }

/* Content-driven rings are shared presentation; server owns permission and advancement. */
.board-rings { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 8px 0; }
.board-ring { flex: 0 0 auto; }
.board-ring-node {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 88px; height: 88px; border: 2px solid #dbe3ec; border-radius: 50%;
  background: #fff; color: #64748b; cursor: default; font: inherit;
}
.board-ring.current .board-ring-node { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.board-ring.current .board-ring-node:not(:disabled) { cursor: pointer; }
.board-ring.done .board-ring-node { border-color: #a7d9bc; color: #15803d; }
.board-ring-title { font-size: 12px; white-space: nowrap; }
.board-ring-status { font-size: 11px; opacity: .8; }
