/* ── DMS 文档管理首页（M2b）────────────────────────────────────────────
   Explorer 风格：左树（我的文件/共享给我/已归档）+ 右列表。
   设计：docs/文档管理改造调研报告.md v3.2 §12。纯静态，无构建步骤。 */

/* DMS 模式下主区占满：隐藏编校相关顶栏元素（编校工作区
   经 router.js showWorkspace 摘掉 dms-mode 后恢复显示；
   旧 sidebar 已于 2026-09-23 随本模式永久化删除） */
.app-layout.dms-mode #stepper,
.app-layout.dms-mode #header-step5-nav,
.app-layout.dms-mode #btn-return-batch,
.app-layout.dms-mode #btn-back-dms,
.app-layout.dms-mode #btn-exceptions { display: none; }

.dms-view {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(241,245,249,0.15);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
  position: relative;
  z-index: 1;
}
.dms-view.hidden { display: none; }

/* ── 左：文件夹树 ── */
.dms-tree-pane {
  width: 240px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dms-tree-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.dms-tree-section-title:hover { background: #eef2f7; }
.dms-tree-section-title.active { background: #e2e8f0; color: #1e293b; }
.dms-tree:empty { display: none; }
.dms-tree-empty { font-size: 12px; color: #94a3b8; padding: 2px 12px 6px; }
.dms-tree-node {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px 3px calc(6px + var(--depth, 0) * 16px);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #1e293b;
  user-select: none;
}
.dms-tree-node:hover { background: #eef2f7; }
.dms-tree-node.selected { background: #dbe4ef; font-weight: 600; }
.dms-tree-node.inherited { color: #94a3b8; font-style: italic; }
.dms-tree-caret {
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  color: #64748b;
  font-size: 10px;
  cursor: pointer;
}
.dms-tree-icon { flex-shrink: 0; margin-right: 4px; }
/* M8：SVG 图标（dms_icons.js）尺寸与对齐 */
.dms-file-icon, .dms-tree-icon { display: inline-flex; align-items: center; vertical-align: -2px; }
.dms-file-icon svg { width: 16px; height: 16px; display: block; }
.dms-tree-icon svg { width: 14px; height: 14px; display: block; }
/* M8：名称徽标——原件只读 / 编校稿 / 用户主文件夹 */
.dms-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 16px;
  white-space: nowrap;
  vertical-align: 1px;
}
.dms-tag-original { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.dms-tag-edit { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.dms-tag-user { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
/* M10：被安排人徽标 / 软链接徽标 */
.dms-tag-assign { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.dms-tag-link { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.dms-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 右：主区 ── */
.dms-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.dms-toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.dms-breadcrumb {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 14px;
  color: #475569;
}
.dms-crumb {
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  color: #1e293b;
}
.dms-crumb:hover { background: #eef2f7; }
.dms-crumb:last-child { font-weight: 700; }
.dms-crumb-sep { color: #cbd5e1; }
.dms-toolbar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dms-toolbar .btn { white-space: nowrap; flex-shrink: 0; }
.dms-search {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 180px;
  outline: none;
}
.dms-search:focus { border-color: #c9a84c; }

/* ── 列表 ── */
.dms-list-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  position: relative;
}
.dms-list-wrap.dragover { outline: 2px dashed #c9a84c; outline-offset: -4px; background: #fffdf5; }
.dms-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
/* fixed 布局：列宽只看首行（配合列表虚拟滚动，2026-09-23 性能） */
.dms-table th.dms-col-check, .dms-table td.dms-col-check { width: 34px; }
.dms-table th[data-sort="size"] { width: 74px; }
.dms-table th[data-sort="time"] { width: 148px; }
.dms-table th.dms-col-status { width: 86px; }
.dms-table th.dms-col-owner { width: 86px; }
.dms-table th.dms-ops { width: 440px; }
/* 虚拟滚动定高行：36px 单行截断（ Explorer 式长名省略），上下 spacer 行占位 */
#dms-tbody > tr:not(.dms-vspacer) { height: 36px; }
#dms-tbody > tr:not(.dms-vspacer) > td {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-top: 4px; padding-bottom: 4px;
}
#dms-tbody > tr.dms-vspacer > td { padding: 0; border: none; }
/* 树节点离屏跳过渲染（div 上 content-visibility 生效可靠） */
.dms-tree-node { content-visibility: auto; contain-intrinsic-size: auto 26px; }
.dms-table th, .dms-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}
.dms-table th {
  color: #475569;
  font-weight: 600;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
  user-select: none;
}
.dms-table th.dms-sortable { cursor: pointer; }
.dms-table th.dms-sortable:hover { background: #eef2f7; }
.dms-table th .dms-sort-arrow { font-size: 10px; color: #c9a84c; margin-left: 2px; }
.dms-table tbody tr { cursor: default; }
.dms-table tbody tr:hover { background: #f8fafc; }
.dms-table tbody tr.selected { background: #eef2f7; }
.dms-col-owner { display: none; }
.dms-view.show-owner .dms-col-owner { display: table-cell; }
.dms-name-cell { max-width: 340px; }
.dms-name-cell .dms-file-icon { margin-right: 6px; }
.dms-name-text { overflow-wrap: anywhere; }
.dms-cell-muted { color: #94a3b8; }
.dms-cell-time { white-space: nowrap; color: #475569; }
.dms-status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}
.dms-status-badge.st-active { background: #dbeafe; color: #1d4ed8; }
.dms-status-badge.st-done { background: #d1fae5; color: #047857; }
.dms-status-badge.st-error { background: #fee2e2; color: #b91c1c; }
/* M10 稿件登记状态：未安排（灰）/ 未编校（黄）/ 编校中=复用 st-active / 编校完=复用 st-done */
.dms-status-badge.st-reg-unassigned { background: #f1f5f9; color: #64748b; }
.dms-status-badge.st-reg-pending { background: #fef3c7; color: #b45309; }
.dms-rename-input {
  width: 90%;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid #c9a84c;
  border-radius: 4px;
  outline: none;
}

/* 行末悬停操作钮（M3/M4 的「编校」「编校要求」入口预留同排按钮位） */
.dms-ops { white-space: nowrap; text-align: right; }
.dms-ops .dms-op {
  opacity: 0;
  transition: opacity 0.12s;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  padding: 2px 6px;
  border-radius: 5px;
}
.dms-table tbody tr:hover .dms-ops .dms-op,
.dms-table tbody tr.selected .dms-ops .dms-op { opacity: 1; }
.dms-ops .dms-op:hover { background: #e2e8f0; color: #1e293b; }
.dms-ops .dms-op.dms-op-danger { color: #dc2626; }
.dms-ops .dms-op.dms-op-danger:hover { background: #fee2e2; }

.dms-empty {
  padding: 48px 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  line-height: 2;
}
.dms-empty.hidden { display: none; }

/* ── 上传进度条 ── */
.dms-upload-bar {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 8px 16px;
  max-height: 140px;
  overflow-y: auto;
  font-size: 12px;
}
.dms-upload-bar.hidden { display: none; }
.dms-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
}
.dms-upload-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dms-upload-pct { color: #64748b; min-width: 38px; text-align: right; }
.dms-upload-row.done .dms-upload-pct { color: #059669; }
.dms-upload-row.failed .dms-upload-pct { color: #dc2626; }
.dms-upload-progress-outer {
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
}
.dms-upload-progress-inner {
  height: 100%;
  background: linear-gradient(135deg, #b8960f, #d4af37);
  transition: width 0.15s;
}
.dms-upload-row.failed .dms-upload-progress-inner { background: #dc2626; }
.dms-upload-row.done .dms-upload-progress-inner { background: #10b981; }

/* ── 移动 / 分享弹窗（深色 modal-box 基底） ── */
.dms-modal-box { width: 440px; max-width: 92vw; }
.dms-modal-box h2 { margin: 0 0 8px; padding: 0; border: none; color: #e2e8f0; font-size: 1.05rem; }
.dms-modal-tree {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px;
  margin: 10px 0;
  background: rgba(255,255,255,0.04);
}
.dms-modal-tree .dms-tree-node { color: #e2e8f0; }
.dms-modal-tree .dms-tree-node:hover { background: rgba(255,255,255,0.08); }
.dms-modal-tree .dms-tree-node.selected { background: rgba(201,168,76,0.25); }
.dms-modal-tree .dms-tree-node.disabled { opacity: 0.4; pointer-events: none; }
.dms-modal-hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.dms-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dms-share-members {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 10px 0;
  background: rgba(255,255,255,0.04);
}
.dms-share-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: #e2e8f0;
}
.dms-share-member-row:last-child { border-bottom: none; }
.dms-share-member-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dms-share-member-row label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
}
/* M10 安排弹窗：单选成员列表（复用 share 列表视觉） */
.dms-assign-members {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 10px 0;
  background: rgba(255,255,255,0.04);
}
.dms-assign-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: #e2e8f0;
  cursor: pointer;
}
.dms-assign-member-row:last-child { border-bottom: none; }
.dms-assign-member-row:hover { background: rgba(255,255,255,0.05); }
.dms-assign-member-row .dms-assign-current {
  font-size: 11px;
  color: #b45309;
}
.dms-share-grants { margin: 8px 0; font-size: 13px; color: #e2e8f0; }
.dms-share-grant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dms-share-grant-row:last-child { border-bottom: none; }
.dms-share-grant-perms { color: #94a3b8; font-size: 12px; flex: 1; }
.dms-share-revoke {
  border: none;
  background: none;
  color: #f87171;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 5px;
}
.dms-share-revoke:hover { background: rgba(239,68,68,0.15); }

/* ── 查看器弹层（深色 modal-box 基底，padding 交给内部区域） ── */
.dms-viewer-box { width: 860px; max-width: 94vw; padding: 0; display: flex; flex-direction: column; }
.dms-viewer-body {
  display: flex;
  overflow: auto;
  background: #0f172a;
  min-height: 200px;
  max-height: 76vh;
}
/* margin:auto 居中：放大超出容器后四边仍可滚动到达（flex 居中会裁掉左上） */
.dms-viewer-body img { display: block; margin: auto; }
.dms-image-toolbar { display: flex; align-items: center; gap: 6px; }
.dms-image-toolbar .btn { padding: 2px 10px; }
.dms-text-area {
  width: 100%;
  height: 56vh;
  border: none;
  outline: none;
  resize: none;
  padding: 14px 16px;
  font-family: "SF Mono", Menlo, Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #ffffff;
  color: #1e293b;
}
.dms-viewer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 16px;
}

/* ── 编辑器/查看器全屏视图（M3「点开即看」：LO iframe / PDF 页图共用） ── */
.dms-editor-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(241,245,249,0.15);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
  position: relative;
  z-index: 1;
}
.dms-editor-view.hidden { display: none; }
.dms-editor-brand {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 13px;
  color: #1e293b;
  flex-shrink: 0;
}
.dms-editor-brand img { width: 20px; height: 20px; object-fit: contain; }

/* ── 全屏编辑器模式（2026-09-22）：打开即占满浏览器 ─────────────────────
   editor-open：LO 编校工作区（router.js showWorkspace 按 isLoMode 切换）；
   viewer-open：DMS 只读/查看外壳（dms_editor_shell.js 开合）。
   两者都隐藏顶栏（LOGO/步骤条/上一步随之取消，「生成校对后
   文档」走 LO 菜单栏注入按钮），编辑器 chrome 条只留 返回文件列表+LOGO+
   文档名。 */
.app-layout.editor-open #header-bar,
.app-layout.viewer-open #header-bar { display: none; }
.app-layout.editor-open .main-content,
.app-layout.viewer-open .main-content { padding: 0; }
.app-layout.editor-open .workspace-container { padding: 0; }
.app-layout.editor-open .step-panel {
  border-radius: 0;
  border: none;
  margin-bottom: 0;
  padding: 12px 16px;
  box-shadow: none;
}
.app-layout.viewer-open .dms-editor-view {
  border-radius: 0;
  border: none;
  margin-bottom: 0;
  box-shadow: none;
}

#editor-chrome {
  display: none;
  align-items: center;
  gap: 14px;
  height: 44px;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.app-layout.editor-open #editor-chrome { display: flex; }
.editor-chrome-spacer { flex: 1; min-width: 0; }
#editor-chrome .btn { flex-shrink: 0; }
.editor-chrome-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
  color: #1e293b;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.editor-chrome-brand .header-logo { width: 24px; height: 24px; }
.editor-chrome-title {
  font-size: 13px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.dms-editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  flex-shrink: 0;
  padding: 0 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 16px 16px 0 0;
}
.dms-editor-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50%;
}
.dms-editor-badge {
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 7px;
  flex-shrink: 0;
}
.dms-editor-badge.hidden,
.dms-editor-pageinfo.hidden,
.dms-editor-topbar .btn.hidden { display: none; }
.dms-editor-spacer { flex: 1; }
.dms-editor-pageinfo { font-size: 12px; color: #64748b; flex-shrink: 0; }
.dms-editor-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
  background: #fff;
}

/* PDF 页图查看器：纵向滚动，页图居中，占位盒按页宽高比撑开防滚动跳动 */
.dms-pdf-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #525659;
  padding: 16px 0;
}
.dms-pdf-page {
  margin: 0 auto 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  position: relative;
}
.dms-pdf-page img { display: block; width: 100%; height: 100%; }
.dms-pdf-page .dms-pdf-page-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 12px;
}

/* ── 编校要求弹窗（M4b） ── */
.dms-instruction-box { width: 520px; }
.dms-instruction-list {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 10px 0;
  background: rgba(255,255,255,0.04);
}
.dms-instruction-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
}
.dms-instruction-row:last-child { border-bottom: none; }
.dms-instruction-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dms-instruction-meta { color: #94a3b8; font-size: 11px; flex-shrink: 0; }
.dms-instruction-area {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  color: #e2e8f0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
}
.dms-instruction-area:focus { outline: none; border-color: #c9a84c; }
.dms-instruction-actions { align-items: center; }
.dms-instruction-spacer { flex: 1; }

/* ── 多选（M6；批量编校走经典批量面板 batch_panel.js，向导弹窗已移除） ── */
.dms-col-check { width: 28px; text-align: center; }
.dms-col-check input[type="checkbox"] { margin: 0; cursor: pointer; }
.dms-sel-count { font-size: 12px; color: #64748b; white-space: nowrap; }
.dms-sel-count.hidden { display: none; }


/* ── 操作审计弹窗（M7） ── */
.dms-audit-box { width: min(760px, 92vw); }
.dms-audit-table-wrap { max-height: 60vh; overflow: auto; }
.dms-audit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dms-audit-table th, .dms-audit-table td { padding: 6px 10px; border-bottom: 1px solid rgba(127,127,127,.18); text-align: left; }
.dms-audit-table thead th { position: sticky; top: 0; background: inherit; }
.dms-audit-detail { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary, #999); }
