/* ============================================================
 * 任务督办流程页 · flow-page
 * 仅使用 tokens.css 变量与 components.css 既有组件样式
 * ============================================================ */

/* ---------- 页头 / 范围快捷筛选 ---------- */
.process-page .page-head { margin-bottom: 12px; }
.process-page .page-sub .sub-dot { color: #D0D5DD; }

.process-scopebar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px;
}
.scope-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scope-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--ink-2); font-size: 12.5px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s; white-space: nowrap;
}
.scope-chip:hover { border-color: #C9D6EA; background: #F8FAFD; }
.scope-chip b { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); font-size: 12px; }
.scope-chip .scope-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); flex: none; }
.scope-chip.tone-red .scope-dot { background: var(--red); }
.scope-chip.tone-orange .scope-dot { background: var(--orange); }
.scope-chip.tone-purple .scope-dot { background: var(--purple); }
.scope-chip.tone-green .scope-dot { background: var(--green); }
.scope-chip.tone-blue .scope-dot { background: var(--brand); }
.scope-chip.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); font-weight: 600; }
.scope-chip.active b { color: var(--brand); }
.scope-chip.active .scope-dot { box-shadow: 0 0 0 3px rgba(31, 107, 255, .12); }
.scope-chip.tone-red.active { background: var(--red-bg); border-color: var(--red-line); color: var(--red-600); }
.scope-chip.tone-red.active b { color: var(--red-600); }
.scope-chip.tone-orange.active { background: var(--orange-bg); border-color: var(--orange-line); color: var(--orange-600); }
.scope-chip.tone-orange.active b { color: var(--orange-600); }
.scope-chip.tone-purple.active { background: var(--purple-bg); border-color: #D9D6FE; color: var(--purple); }
.scope-chip.tone-purple.active b { color: var(--purple); }
.scope-chip.tone-green.active { background: var(--green-bg); border-color: var(--green-line); color: var(--green-600); }
.scope-chip.tone-green.active b { color: var(--green-600); }
.scope-note { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-4); line-height: 1.5; }
.scope-note .icon { color: var(--ink-4); }

/* ---------- 已生效筛选 chip ---------- */
.active-filters { display: none; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.active-filters.show { display: flex; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 9px;
  border: 1px solid var(--brand-100); border-radius: 5px; background: var(--brand-50);
  color: var(--brand-700); font-size: 12px; line-height: 1;
}
.fchip.tone-red { background: var(--red-bg); border-color: var(--red-line); color: var(--red-600); }
.fchip .fchip-label { color: var(--ink-3); }
.fchip button {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border: 0; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; opacity: .72; padding: 0;
}
.fchip button:hover { opacity: 1; background: rgba(31, 107, 255, .1); }
.fchip-clear { border: 0; background: transparent; color: var(--ink-3); font-size: 12px; cursor: pointer; padding: 0 4px; }
.fchip-clear:hover { color: var(--brand); }

/* ---------- 表格卡片 ---------- */
.process-table { position: relative; }
.process-table .table-toolbar { padding: 10px 12px; gap: 8px; }
#pp-search::-webkit-search-cancel-button, #pp-search::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.process-table .toolbar-left .btn { height: 30px; }
.tool-btn .pp-badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--brand);
  color: #fff; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center;
  justify-content: center; font-variant-numeric: tabular-nums; margin-left: 1px;
}
.tool-btn.is-spinning .icon { animation: spin .5s linear; }
.tool-btn.is-fs { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); }
.tool-btn.is-fs .icon { color: var(--brand); }

/* 批量操作栏 */
.batch-bar {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100);
  color: var(--brand-700); font-size: 12.5px;
}
.batch-bar.show { display: flex; }
.batch-bar b { font-variant-numeric: tabular-nums; font-weight: 650; }
.batch-bar .batch-sub { color: #6E8BB5; font-size: 11.5px; }
.batch-bar .batch-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 表格内单元格 */
.process-table .table-scroll { min-height: 120px; }
.process-table .data-table th { padding: 9px 10px; }
.process-table .data-table td { padding: 9px 10px; }
.process-table .data-table th.col-check, .process-table .data-table td.col-check { padding-left: 13px; padding-right: 4px; }
.cell-instance { min-width: 0; }
.cell-instance .ci-title {
  font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-instance .ci-meta { display: flex; align-items: center; gap: 5px; margin-top: 3px; min-width: 0; }
.cell-instance .ci-meta .tag { height: 18px; padding: 0 5px; font-size: 10.5px; border-radius: 3px; }
.cell-instance .ci-name { font-size: 11px; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-no { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-no .mono { font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-no .cell-sub { font-size: 10.5px; }
.cell-name { min-width: 0; }
.cell-name .cn-title { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name .cn-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 10.5px; color: var(--ink-4); }
.cell-name .cn-meta .tag { height: 17px; padding: 0 4px; font-size: 10px; border-radius: 3px; }
.cell-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.cell-user { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cell-user .cu-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cell-user .cu-name { font-size: 12px; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-user .cu-dept { font-size: 10.5px; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-due { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.cell-due .tag { height: 18px; padding: 0 4px; font-size: 10px; border-radius: 3px; }
.cell-initiator { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cell-initiator .ci-name { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.process-table .table-actions { gap: 6px; flex-wrap: nowrap; }
.process-table .table-actions .link-btn { font-size: 12px; }

/* 空态 */
.process-table .empty-state { padding: 46px 20px; }
.process-table .empty-cta { margin-top: 12px; }
.process-table tbody tr.pp-empty-row { cursor: default; }
.process-table tbody tr.pp-empty-row:hover { background: transparent; }
.process-table tbody tr.pp-empty-row td { padding: 0; }

/* ---------- 工具栏弹层 ---------- */
.popover .popover-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2);
}
.popover .popover-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 1px 4px 8px; }
.popover .popover-title-row .popover-title { padding: 0; }
.popover .filter-group-label { display: flex; align-items: center; justify-content: space-between; }
.popover .assignee-grid { display: flex; gap: 5px; flex-wrap: wrap; max-height: 132px; overflow-y: auto; }
.popover .assignee-grid .filter-chip { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
.popover .sort-list { display: flex; flex-direction: column; gap: 2px; }
.popover .sort-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px;
  border: 0; border-radius: 5px; background: transparent; color: var(--ink-2);
  font-size: 12.5px; cursor: pointer; text-align: left;
}
.popover .sort-item:hover { background: #F4F7FC; }
.popover .sort-item.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.popover .sort-item .sort-arrow { margin-left: auto; display: inline-flex; color: currentColor; }
.popover .sort-dir-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.popover .sort-dir-row .filter-chip { flex: 1; text-align: center; }
.popover .col-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 4px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.popover .col-row:hover { background: #F4F7FC; }
.popover .col-row .checkbox { width: 14px; height: 14px; }
.popover .col-row .col-count { margin-left: auto; font-size: 10.5px; color: var(--ink-4); }

/* ---------- 全屏表格体验 ---------- */
body.pp-fullscreen { overflow: hidden; }
body.pp-fullscreen .sidebar, body.pp-fullscreen .topbar { display: none !important; }
body.pp-fullscreen .main { margin-left: 0 !important; }
body.pp-fullscreen .page-root { max-width: none; padding: 14px 18px 18px; }
body.pp-fullscreen .process-page { height: calc(100vh - 32px); display: flex; flex-direction: column; }
body.pp-fullscreen .process-scopebar { margin-bottom: 10px; }
body.pp-fullscreen .process-table { flex: 1; display: flex; flex-direction: column; min-height: 0; }
body.pp-fullscreen .process-table .table-scroll { flex: 1; min-height: 0; overflow: auto; }
body.pp-fullscreen .process-table .data-table thead th { position: sticky; top: 0; z-index: 2; }
body.pp-fullscreen .process-page .page-head { margin-bottom: 8px; }
body.pp-fullscreen .page-head-left .page-title { font-size: 17px; }

/* 列宽拖拽 */
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing .process-table tbody tr { pointer-events: none; }
.process-table .col-resize { width: 8px; right: -4px; }
.process-table .col-resize::after {
  content: ""; position: absolute; left: 3px; top: 8px; bottom: 8px; width: 1px;
  background: var(--line); transition: background .15s;
}
.process-table .col-resize:hover::after, .process-table .col-resize.active::after { background: var(--brand); }
.process-table th:last-child .col-resize { display: none; }

/* ---------- 新增 / 导入 / 动作弹窗 ---------- */
.action-context {
  border: 1px solid var(--line); border-radius: 8px; background: #FBFCFE;
  padding: 10px 12px; margin-bottom: 14px;
}
.action-context .ac-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.action-context .ac-meta { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
.action-context .ac-meta b { color: var(--ink-2); font-weight: 600; }
.action-context .ac-meta .tag { height: 19px; padding: 0 5px; font-size: 10.5px; }
.modal-note { display: flex; align-items: flex-start; gap: 7px; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; margin-top: 10px; }
.modal-note .icon { color: var(--ink-4); flex: none; margin-top: 1px; }
.form-grid .field-hint-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-grid .field-hint-row .link-btn { font-size: 11.5px; }
.field-invalid .input, .field-invalid .select, .field-invalid .textarea { border-color: var(--red); box-shadow: 0 0 0 3px rgba(244, 68, 56, .1); }
.field .field-hint { display: flex; align-items: center; gap: 5px; }

/* 新增任务弹窗 */
.create-task-modal .span-2 { grid-column: span 2; }
.instance-title-row { display: flex; gap: 8px; align-items: center; }
.instance-title-row .input { flex: 1; }

/* 更新进展 */
.pp-range { width: 100%; height: 24px; accent-color: var(--brand); cursor: pointer; }
.progress-edit-row { display: flex; align-items: center; gap: 14px; }
.progress-edit-row .pp-range { flex: 1; }
.progress-edit-row .pp-num {
  width: 78px; height: 32px; border: 1px solid var(--line); border-radius: 6px;
  padding: 0 8px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right;
}
.progress-edit-row .pp-unit { font-size: 11.5px; color: var(--ink-4); }
.pp-att-list { display: flex; flex-direction: column; gap: 6px; }
.pp-att-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 9px;
  border: 1px solid var(--line-2); border-radius: 6px; background: #FBFCFE; font-size: 12px; color: var(--ink-2);
}
.pp-att-row .icon { color: var(--brand); }
.pp-att-row .att-size { margin-left: auto; font-size: 10.5px; color: var(--ink-4); }
.pp-att-row .att-remove { border: 0; background: none; color: var(--ink-4); cursor: pointer; padding: 2px; display: inline-flex; }
.pp-att-row .att-remove:hover { color: var(--red); }
.pp-att-empty { font-size: 11.5px; color: var(--ink-4); }
.pp-file-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* 催办弹窗 */
.remind-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 8px; margin-bottom: 14px; }
.remind-meta .rm-item { border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 10px; background: #FBFCFE; min-width: 0; }
.remind-meta .rm-label { font-size: 10.5px; color: var(--ink-4); }
.remind-meta .rm-value { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-textarea { min-height: 236px; line-height: 1.75; font-size: 12.5px; }
.reminder-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.reminder-count { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.radio-line .radio-opt {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; cursor: pointer; background: #fff;
}
.radio-line .radio-opt.active { border-color: var(--brand); background: var(--brand-50); color: var(--brand); font-weight: 500; }
.radio-line .radio-opt input { accent-color: var(--brand); margin: 0; }
.fixed-field {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 6px; background: #F8FAFC;
  font-size: 12.5px; color: var(--ink-2);
}
.fixed-field .icon { color: var(--ink-4); }
.fixed-field .fixed-hint { margin-left: auto; font-size: 10.5px; color: var(--ink-4); }

/* 转派弹窗 */
.transfer-parties {
  display: flex; align-items: stretch; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #FBFCFE; margin-bottom: 14px;
}
.transfer-party { flex: 1; min-width: 0; }
.transfer-party-label { font-size: 11px; color: var(--ink-4); margin-bottom: 5px; }
.transfer-party .user-inline { width: 100%; }
.transfer-arrow { display: flex; align-items: center; color: var(--brand); }

/* 导入弹窗 */
.import-panel { display: flex; flex-direction: column; gap: 12px; }
.import-drop {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px dashed #C9D6EA; border-radius: 8px; background: #FAFBFE;
}
.import-drop .id-icon {
  width: 34px; height: 34px; border-radius: 8px; background: var(--brand-50); color: var(--brand);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.import-drop .id-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.import-drop .id-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.import-drop .id-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-textarea { min-height: 138px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7; }
.import-hint { font-size: 11.5px; color: var(--ink-4); line-height: 1.65; }
.import-hint b { color: var(--ink-3); font-weight: 500; }
.import-preview { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.import-preview-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: #F8FAFC; border-bottom: 1px solid var(--line-2);
  font-size: 12px; color: var(--ink-3);
}
.import-preview-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.import-table-wrap { max-height: 226px; overflow: auto; }
.import-table { table-layout: fixed; }
.import-table th, .import-table td { padding: 6px 10px; font-size: 11.5px; }
.import-table .imp-idx { color: var(--ink-4); font-variant-numeric: tabular-nums; width: 42px; }
.import-table .imp-state { width: 150px; }
.import-table .tag { height: 18px; padding: 0 5px; font-size: 10.5px; }
.import-table .imp-state .tag { display: inline-block; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; vertical-align: middle; }
.import-empty { padding: 22px 12px; text-align: center; color: var(--ink-4); font-size: 12px; }
.import-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--ink-4); }
.import-legend .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 4px; }

/* ---------- 打印视图 ---------- */
.print-area { display: none; color: var(--ink); }
.print-head { padding-bottom: 12px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.print-brand { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #475467; letter-spacing: .04em; }
.print-brand .print-mark {
  width: 18px; height: 18px; border-radius: 4px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
}
.print-head h2 { font-size: 19px; font-weight: 650; margin-top: 8px; letter-spacing: -.2px; }
.print-meta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; color: #475467; }
.print-meta b { color: var(--ink); font-weight: 600; }
.print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.print-table th {
  background: #F2F5FA; font-size: 10.5px; font-weight: 600; color: #344054; text-align: left;
  padding: 7px 8px; border: 1px solid #D0D5DD; white-space: nowrap;
}
.print-table td { font-size: 10.5px; color: #101828; padding: 6px 8px; border: 1px solid #D0D5DD; vertical-align: top; }
.print-table tbody tr:nth-child(even) td { background: #FAFBFD; }
.print-table .pt-num { font-variant-numeric: tabular-nums; }
.print-table .pt-mono { font-family: var(--font-mono); font-size: 9.5px; }
.print-table .pt-desc { color: #475467; line-height: 1.45; }
.print-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 8px; border-top: 1px solid #D0D5DD; font-size: 10px; color: #667085; }
.print-detail { font-size: 11px; line-height: 1.7; }
.print-detail .pd-section { margin-bottom: 12px; }
.print-detail .pd-title { font-size: 12px; font-weight: 650; border-left: 3px solid var(--brand); padding-left: 8px; margin-bottom: 6px; }
.print-detail .pd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 22px; }
.print-detail .pd-row { display: flex; gap: 8px; border-bottom: 1px dotted #D0D5DD; padding: 3px 0; }
.print-detail .pd-row .pd-k { width: 76px; color: #667085; flex: none; }
.print-detail .pd-row .pd-v { color: #101828; word-break: break-word; }
.print-detail .pd-quote { border-left: 3px solid #D0D5DD; background: #F8FAFC; padding: 8px 10px; color: #344054; white-space: pre-wrap; }
.print-detail .pd-flow { display: flex; flex-wrap: wrap; gap: 6px; }
.print-detail .pd-node { border: 1px solid #D0D5DD; border-radius: 5px; padding: 5px 9px; font-size: 10.5px; color: #344054; }
.print-detail .pd-node.done { border-color: #A6F4C5; background: #ECFDF3; }
.print-detail .pd-node.current { border-color: #B2CCFF; background: #EDF3FF; }

@media print {
  body.is-printing { background: #fff; }
  body.is-printing .page-root, body.is-printing .sidebar, body.is-printing .topbar,
  body.is-printing #toast-root, body.is-printing .drawer, body.is-printing .drawer-mask,
  body.is-printing .modal-mask, body.is-printing .dropdown-menu, body.is-printing .popover { display: none !important; }
  body.is-printing .print-area { display: block !important; }
  .print-area { padding: 0; }
}
@page { margin: 14mm 12mm; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .process-page .page-sub { font-size: 11.5px; }
  .scope-note { display: none; }
  .process-table .data-table th, .process-table .data-table td { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 1024px) {
  .process-page .page-head { align-items: flex-start; }
  .batch-bar .batch-sub { display: none; }
}
