:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --primary: #2f6fed;
  --primary-dark: #1b4fc7;
  --danger: #e03131;
  --success: #2b8a3e;
  --warning: #f08c00;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ---- 顶部栏 ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #101827;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 38px; height: 38px;
  display: block;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.title { font-weight: 600; font-size: 16px; letter-spacing: .2px; }
.subtitle { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: .8px; }
.user {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
}
.user-name { font-weight: 500; }
.user-id { color: #9ca3af; font-size: 12px; }
.btn-logout {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,.1); }

/* ---- 变更通知铃铛（固定右下角） ---- */
.bell-wrap {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
}
.bell-btn {
  position: relative;
  background: #fff; border: 1px solid rgba(0,0,0,.1); cursor: pointer;
  font-size: 22px; line-height: 1; color: #374151;
  width: 52px; height: 52px; border-radius: 50%;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
}
.bell-btn:hover { background: #f3f4f6; }
.bell-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
  border-radius: 10px; box-shadow: 0 0 0 2px #fff;
}
.bell-panel {
  position: absolute; bottom: 62px; right: 0;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--card, #fff); color: var(--text, #1f2937);
  border: 1px solid rgba(0,0,0,.1); border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.35);
  z-index: 60;
}
.bell-head {
  position: sticky; top: 0; background: var(--card, #fff);
  padding: 12px 16px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.bell-list { padding: 6px; }
.bell-empty { padding: 22px 16px; text-align: center; color: #9ca3af; font-size: 13px; }
.bell-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.bell-item.unread { background: #fff7ed; }
.bell-item.unread:hover { background: #ffedd5; }
.bell-item .bell-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
}
.bell-item.unread .bell-dot { background: #f97316; box-shadow: 0 0 0 3px rgba(249,115,22,.18); }
.bell-item.read .bell-dot { background: #cbd5e1; }
.bell-item.read .bell-name { color: #9ca3af; }
.bell-pcn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; font-weight: 700; color: #b45309;
  background: #fffbeb; border: 1px solid #fde68a;
  padding: 1px 6px; border-radius: 6px; white-space: nowrap;
}
.bell-name {
  flex: 1; font-size: 13px; color: #374151;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bell-open { font-size: 12px; color: var(--primary, #174ea6); white-space: nowrap; }

/* ---- 相关变更提醒弹窗（普通用户） ---- */
.reminder-card { max-width: 460px; }
.reminder-body { padding: 18px 20px; }
.reminder-tip { margin: 0 0 14px; font-size: 14px; color: #374151; }
.reminder-tip b { color: #b45309; }
.reminder-list { display: flex; flex-direction: column; gap: 8px; }
.reminder-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid #fde68a; background: #fffbeb;
  border-radius: 10px; cursor: pointer;
}
.reminder-item:hover { background: #fef3c7; }
.reminder-item.done { cursor: default; background: #f3f4f6; border-color: #e5e7eb; }
.reminder-item.done:hover { background: #f3f4f6; }
.reminder-item.done .reminder-pcn { color: #059669; border-color: #a7f3d0; background: #ecfdf5; }
.reminder-item.done .reminder-name { color: #9ca3af; }
.reminder-item.done .reminder-view { color: #059669; }
.reminder-pcn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; font-weight: 700; color: #b45309;
  background: #fff; border: 1px solid #fde68a;
  padding: 1px 7px; border-radius: 6px; white-space: nowrap;
}
.reminder-name {
  flex: 1; font-size: 13px; color: #374151;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reminder-view { font-size: 13px; font-weight: 600; color: var(--primary, #174ea6); white-space: nowrap; }
.reminder-note { margin: 14px 0 0; font-size: 12px; color: #9ca3af; }
.reminder-foot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid rgba(0,0,0,.08); }

/* ---- 相关变更链式提醒过渡（普通用户） ---- */
.chain-card { max-width: 420px; }
.chain-body { padding: 26px 28px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.chain-msg {
  margin: 0; text-align: center; font-size: 15px; font-weight: 600; color: #1f2937; line-height: 1.6;
}
.chain-bar {
  height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden;
}
.chain-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary, #174ea6), #4f86f7);
  border-radius: 6px; transition: width .08s linear;
}
.chain-pct { text-align: center; font-size: 13px; color: #6b7280; }

/* ---- 主内容区 ---- */
main { max-width: none; margin: 0 auto; padding: 32px 32px 60px; }
.page-header { margin-bottom: 24px; }
.page-header h2 { margin: 0 0 4px; font-size: 22px; }
.page-desc { margin: 0; color: var(--text-secondary); font-size: 14px; }

/* ---- 登录卡片 ---- */
#login {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 68px);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 40px;
  width: 100%; max-width: 420px;
  text-align: center;
}
.login-icon {
  width: 84px; height: 84px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  border-radius: 24px;
  background: linear-gradient(135deg, #eef4ff, #e3edff);
  box-shadow: inset 0 0 0 1px #d8e5ff, 0 6px 16px -8px rgba(23, 78, 166, .25);
}
.login-card h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: .5px; }
.lead { margin: 0 0 28px; color: var(--text-secondary); font-size: 15px; }

/* 登录按钮组：垂直排列、统一间距、去掉链接下划线 */
#loginActions { display: flex; flex-direction: column; gap: 12px; }
#loginActions a { text-decoration: none; }
#loginActions .hint { margin: 6px 0 0; }

/* 次要登录按钮：白底描边，与主按钮形成层级 */
.login-btn-secondary {
  background: var(--card); color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 8px; padding: 12px 24px; font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s, transform .05s;
}
.login-btn-secondary:hover { background: #f0f6ff; }
.login-btn-secondary:active { transform: translateY(1px); }

/* 企业微信扫码二维码 */
.qr-frame-wrap {
  width: 280px; height: 320px; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: #fff; display: flex; align-items: center; justify-content: center;
}
.qr-frame { width: 100%; height: 100%; border: 0; }
.qr-unconfig { background: #f8fafc; }
.qr-unconfig-text { font-size: 56px; line-height: 320px; text-align: center; }

.btn-primary {
  background: var(--primary); color: #fff; border: none;
  border-radius: 8px; padding: 12px 24px; font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .2s, transform .05s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-large { padding: 14px 32px; font-size: 16px; width: 100%; justify-content: center; box-sizing: border-box; }

.security-notes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 28px 0 20px; text-align: left;
}
.note {
  background: #f0f7ff; color: #174ea6;
  padding: 10px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; line-height: 1.5;
  display: flex; align-items: flex-start; gap: 8px;
}
.note span { color: #16a34a; font-weight: 700; flex-shrink: 0; line-height: 1.5; }
.hint { margin: 0; color: var(--text-secondary); font-size: 13px; }

/* ---- 上传区 ---- */
.upload-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 36px 24px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .1s;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: #f5f9ff;
}
.upload-icon { font-size: 32px; }
.upload-text { font-size: 16px; color: var(--text); font-weight: 500; }
.upload-hint { font-size: 13px; color: var(--text-secondary); }

.status-msg {
  margin-top: 12px; font-size: 14px; min-height: 22px;
  color: var(--text-secondary);
}
.status-msg.success { color: var(--success); }
.status-msg.error { color: var(--danger); }
.status-msg.info { color: var(--primary); }

/* ---- 上传区 + 分类选择 ---- */
.upload-bar { margin-bottom: 8px; }
.upload-meta {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.cat-select, .model-input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text); background: #fff; outline: none;
}
.cat-select:focus, .model-input:focus { border-color: var(--primary); }
.model-input { flex: 1; min-width: 220px; }

/* ---- 分类筛选 ---- */
.filter-tabs {
  display: flex; gap: 8px; margin: 24px 0 12px; flex-wrap: wrap;
}
.filter-tab {
  background: #fff; color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 18px; cursor: pointer; font-size: 14px;
  transition: all .15s;
}
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- 分组 ---- */
.file-group { margin-bottom: 26px; }
.group-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 0 0 12px; padding-left: 10px;
  border-left: 3px solid var(--primary);
}

/* ---- 空状态 ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state p { margin: 0; font-size: 15px; }

/* ---- 文件列表 ---- */
.file-grid {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid; gap: 14px;
}
.file-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  transition: transform .1s, box-shadow .2s;
}
.file-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.file-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: #eef2ff; border-radius: 10px;
  font-size: 22px; flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-weight: 500; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.badge-processing { background: #fff9db; color: var(--warning); }
.badge-ready { background: #d3f9d8; color: var(--success); }
.badge-failed { background: #ffe3e3; color: var(--danger); }

.file-actions { display: flex; gap: 10px; }
.btn-ghost {
  background: #f3f4f6; color: var(--text); border: none;
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.btn-ghost:hover { background: #e5e7eb; }
.btn-danger {
  background: var(--danger); color: #fff; border: none;
  border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 14px;
}
.btn-danger:hover { background: #c92a2a; }

/* ---- 浏览区 ---- */
.viewer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .72);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.viewer-card {
  background: #111827;
  border-radius: var(--radius);
  width: 90vw; height: 90vh;   /* 默认 = 最大化的 90% */
  max-width: none; max-height: none;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  overflow: hidden;
  position: relative;
}
.viewer-card.maximized {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0;
  z-index: 101;
}
.viewer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: #1f2937; color: #fff;
  border-bottom: 1px solid #374151;
}
.viewer-title { display: flex; align-items: center; gap: 10px; font-weight: 500; min-width: 0; }
#viewerName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }
.viewer-controls { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; row-gap: 8px; flex-shrink: 0; }
.viewer-controls .btn-ghost,
.viewer-controls .btn-danger,
.viewer-controls .page-info { white-space: nowrap; flex-shrink: 0; }
.viewer-controls .btn-ghost, .viewer-controls .btn-danger { padding: 6px 12px; font-size: 13px; }
.ctrl-sep { width: 1px; height: 22px; background: #374151; margin: 0 2px; flex-shrink: 0; }
.page-info {
  background: #111827; color: #e5e7eb;
  padding: 6px 14px; border-radius: 6px;
  font-size: 13px; font-variant-numeric: tabular-nums;
  min-width: 64px; text-align: center;
}
.viewer-body {
  flex: 1;
  position: relative;
  background: #0b0f19;
  display: block;
  overflow: auto;
  padding: 24px;
  cursor: default;
}
.viewer-body.oversize { cursor: grab; }
.viewer-body.grabbing { cursor: grabbing; }
.viewer-stage {
  position: relative;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* 文档内查找：匹配高亮（不进文件，仅浏览时叠加） */
.find-hl {
  position: absolute;
  background: rgba(255, 214, 0, .55);
  border: 1px solid rgba(214, 158, 0, .9);
  border-radius: 3px;
  pointer-events: none;
  z-index: 6;
}
/* 文档内查找工具条 */
.find-bar {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 25;
  display: flex; align-items: center; gap: 6px;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.find-bar #findInput {
  width: 180px;
  background: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  outline: none;
}
.find-bar #findInput:focus { border-color: #3b82f6; }
.find-count { color: #9ca3af; font-size: 12px; min-width: 38px; text-align: center; }
.find-nav {
  background: #1f2937; color: #e5e7eb;
  border: 1px solid #374151; border-radius: 6px;
  padding: 5px 9px; font-size: 12px; cursor: pointer;
}
.find-nav:hover { background: #374151; }
.find-nav:disabled { opacity: .4; cursor: not-allowed; }
.find-close {
  background: transparent; color: #9ca3af;
  border: none; cursor: pointer; font-size: 14px; padding: 4px 6px;
}
.find-close:hover { color: #f87171; }
/* 结果列表面板 */
.find-list {
  position: absolute;
  top: 0; right: 0;
  width: 320px; max-width: 70%;
  height: 100%;
  z-index: 24;
  background: rgba(17, 24, 39, .96);
  border-left: 1px solid #374151;
  overflow-y: auto;
  padding: 12px;
  box-shadow: -8px 0 24px rgba(0,0,0,.4);
}
.find-list-title { color: #e5e7eb; font-size: 13px; font-weight: 600; margin: 2px 4px 10px; }
.find-li {
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 10px; margin-bottom: 8px;
  background: #1f2937; border: 1px solid #374151; border-radius: 8px;
  cursor: pointer;
}
.find-li:hover { border-color: #3b82f6; }
.find-li.active { border-color: #facc15; background: #2a2410; }
.find-li-page { color: #93c5fd; font-size: 12px; font-weight: 600; }
.find-li-snip { color: #cbd5e1; font-size: 12px; line-height: 1.5; word-break: break-word; }
.find-li-snip mark { background: #facc15; color: #111827; border-radius: 2px; padding: 0 1px; }
/* 悬浮上/下一条药丸 */
.find-nav-pill {
  position: absolute;
  bottom: 18px; right: 18px;
  z-index: 30;
  display: flex; align-items: center; gap: 8px;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.find-nav-pill button {
  background: #1f2937; color: #e5e7eb;
  border: 1px solid #374151; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.find-nav-pill button:hover { background: #374151; }
.find-nav-pill button:disabled { opacity: .4; cursor: not-allowed; }
.find-nav-pill #findNavInfo { color: #e5e7eb; font-size: 13px; min-width: 42px; text-align: center; }
.pdf-page {
  display: block;
  margin: 0 auto 16px;
  max-width: none;
  box-shadow: 0 4px 30px rgba(0,0,0,.5);
  user-select: none; -webkit-user-select: none;
  border-radius: 4px;
  background: #fff;
}
.viewer-resize {
  position: absolute;
  right: 4px; bottom: 4px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 16px; cursor: nwse-resize;
  background: rgba(31,41,55,.6); border-radius: 6px;
  z-index: 5;
}
.viewer-resize:hover { color: #e5e7eb; background: rgba(31,41,55,.9); }
.loading {
  position: absolute;
  color: #9ca3af; font-size: 14px;
  padding: 10px 18px; background: rgba(0,0,0,.6); border-radius: 8px;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}
/* 渐进渲染状态徽标：仅文本「已加载 X/Y 页」，非进度条；整篇加载完自动隐藏 */
.render-status {
  position: absolute; right: 10px; bottom: 10px; z-index: 20;
  background: rgba(0,0,0,.62); color: #e5e7eb; font-size: 12px;
  padding: 4px 11px; border-radius: 12px; pointer-events: none;
}
/* 全屏加载遮罩：旋转动图 + 文案，统一提示「正在加载」，避免用户以为卡住/重复点击。
   z-index 低于链式提醒过渡(#chainModal:200)，确保不会遮挡提醒进度；高于查看器(100)与弹窗(60)。 */
.loading-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(17, 24, 39, 0.45);
  display: flex; align-items: center; justify-content: center;
  /* 吞掉点击，防止遮罩期间重复点击底层按钮 */
  touch-action: none;
}
.loading-overlay .lo-card {
  background: #fff; border-radius: 16px;
  padding: 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2); min-width: 160px;
}
.loading-overlay .lo-spinner {
  width: 40px; height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: lo-spin 0.8s linear infinite;
}
@keyframes lo-spin {
  to { transform: rotate(360deg); }
}
.loading-overlay .lo-msg {
  font-size: 14px; color: #374151; font-weight: 500; text-align: center;
}
.viewer-footer {
  padding: 10px 18px;
  background: #1f2937;
  border-top: 1px solid #374151;
  text-align: center;
}
.warning { color: #fbbf24; font-size: 12px; }
/* 链式提醒中的「浏览完毕」按钮：悬浮小药丸，固定在浏览窗口右下角（读完所有页才可点击） */
#finishReadBtn.finish-float {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);   /* 默认顶部居中；拖动时由 JS 改为 left/top 定位 */
  z-index: 30;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  transition: background .15s, transform .15s;
  touch-action: none;            /* 指针拖动不被浏览器手势打断 */
  user-select: none; -webkit-user-select: none;
}
#finishReadBtn.finish-float:hover { background: #1d4ed8; transform: translateY(-1px); }
#finishReadBtn.finish-float:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 最小化悬浮条 */
.minimized-bar {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 120;
  background: #1f2937;
  color: #e5e7eb;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  border: 1px solid #374151;
  display: flex; align-items: center; gap: 12px;
}
.minimized-bar span {
  font-size: 13px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.minimized-bar button { padding: 5px 12px; font-size: 12px; }

/* ---- 文件视图单行工具栏：面包屑 + 搜索 + 上传 ---- */
.file-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px;
}
.file-toolbar .breadcrumb { margin: 0; flex-shrink: 0; white-space: nowrap; }
.file-toolbar .folder-search { flex: 1; min-width: 200px; margin: 0; }
.file-toolbar .upload-bar { margin: 0; flex-shrink: 0; }
.file-toolbar .upload-bar .btn-primary { padding: 10px 18px; font-size: 14px; }
.page-header.compact { display: none; }

/* ---- 文件夹内搜索 ---- */
.folder-search {
  position: relative;
  margin: 6px 0 6px;
  display: flex; align-items: center;
}
.fs-icon { position: absolute; left: 16px; font-size: 16px; opacity: .6; pointer-events: none; }
#searchInput {
  width: 100%;
  padding: 10px 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px; color: var(--text); background: #fff;
  outline: none; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
#searchInput:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.15); }
.fs-clear {
  position: absolute; right: 12px;
  border: none; background: #e5e7eb; color: #555;
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 13px;
}
.fs-clear:hover { background: #d1d5db; }
.search-results {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,.08);
  max-height: 520px; overflow-y: auto;
  margin-top: 10px;
  z-index: 40;
}
.si-head { padding: 12px 16px; font-size: 13px; color: var(--text-secondary); background: #f8fafc; border-bottom: 1px solid #f1f3f5; }
.search-empty { padding: 20px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.search-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid #f1f3f5;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f5f8ff; }
.si-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #eef2ff; border-radius: 10px; font-size: 20px;
}
.si-info { flex: 1; min-width: 0; }
.si-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.si-tag { font-size: 11px; padding: 1px 8px; border-radius: 10px; }
.si-tag.t-name { background: #dbeafe; color: #1e40af; }
.si-tag.t-content { background: #ede9fe; color: #5b21b6; }
.si-tag.t-meta { background: #dcfce7; color: #166534; }
.si-snippet { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.si-snippet mark, .si-name mark { background: #fff3bf; color: #92400e; border-radius: 2px; padding: 0 1px; }
.si-go { color: var(--primary); font-size: 13px; font-weight: 600; flex-shrink: 0; }

/* 搜索结果：页级匹配列表（页码+片段，点击跳页） */
.si-toggle {
  margin-top: 6px; padding: 2px 8px; font-size: 12px; color: var(--primary);
  background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.25);
  border-radius: 10px; cursor: pointer;
}
.si-toggle:hover { background: rgba(59,130,246,.15); }
.si-matches { margin-top: 6px; border-top: 1px dashed var(--border, #e5e7eb); padding-top: 4px; }
.si-match {
  display: flex; align-items: baseline; gap: 8px; padding: 5px 6px;
  border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1.5;
}
.si-match:hover { background: rgba(59,130,246,.07); }
.si-match-page { color: var(--primary); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.si-match-snip { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.si-match-snip mark { background: #fff3bf; color: #92400e; border-radius: 2px; padding: 0 1px; }


/* 遮盖层 .shield 已取消（2026-10-22） */

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: #1f2937; color: #fff;
  padding: 10px 22px; border-radius: 8px;
  font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.2);
  z-index: 10000;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ---- 软件升级提示条 ---- */
.update-banner {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: #fff; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  z-index: 10001;
}
.update-banner .ub-icon { font-size: 16px; }
.update-banner .ub-text { flex: 1; }
.update-banner .ub-btn {
  border: 0; border-radius: 6px; padding: 6px 14px;
  background: #fff; color: #1d4ed8; font-weight: 600; cursor: pointer; font-size: 13px;
}
.update-banner .ub-btn.ub-ghost { background: rgba(255,255,255,.18); color: #fff; }

/* ---- 角色徽章 ---- */
.role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
}
.role-admin { background: #fde68a; color: #92400e; }
.role-viewer { background: #dbeafe; color: #1e40af; }
.role-base { background: #dcfce7; color: #166534; }
.role-base-all { background: #e5e7eb; color: #374151; }

/* 文件夹卡片上的基地标签 */
.folder-base-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---- 文件夹视图 ---- */
.folder-toolbar {
  display: flex; justify-content: flex-end;
  margin-bottom: 18px;
}
.folder-toolbar.hidden { display: none; }

.folder-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.folder-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .1s, box-shadow .2s, border-color .2s;
  position: relative;
}
.folder-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
  transform: translateY(-2px);
}
.folder-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.folder-info {
  width: 100%;
}
.folder-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.folder-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ---- 面包屑 ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--text-secondary);
}
.breadcrumb-root {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.breadcrumb-root:hover { text-decoration: underline; }
.breadcrumb-sep { color: #cbd5e1; }
.breadcrumb-current {
  font-weight: 600;
  color: var(--text);
}

/* ---- 文件视图头部（计数并入工具栏） ---- */
.file-toolbar .file-count {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---- 文件列表（表格式） ---- */
.file-table-wrap { overflow-x: auto; }
.file-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 14px;
}
.file-table thead th {
  text-align: left;
  font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
  background: #f8fafc;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.file-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f5;
  vertical-align: middle;
  color: var(--text);
  font-size: 14px;
}
.file-table tbody tr:last-child td { border-bottom: none; }
.file-table tbody tr:hover { background: #f7faff; }

.file-table .col-name { min-width: 260px; }
.file-table .col-docno, .file-table .col-docver { white-space: nowrap; font-size: 14px; }
.file-table .col-docno { color: var(--text); font-weight: 700; }
.file-table .col-docver { color: var(--text-secondary); }
.file-table .col-date, .file-table .col-pages { white-space: nowrap; color: var(--text-secondary); font-size: 14px; }
.file-table .col-actions { text-align: right; white-space: nowrap; width: 190px; }
/* 文件选择列（仅工艺人员端显示复选框） */
.col-select { width: 46px; text-align: center; padding-left: 0; padding-right: 0; }
.file-table td.col-select, .change-table td.col-select { text-align: center; }
.file-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--danger); }

/* 变更通知文件夹列表：ID（系统唯一键值，PCNXXXX，黑体加粗放大）/ 文件名称 / 挂接工艺文件 */
.file-table td.col-id {
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  font-family: SimHei, "黑体", "Heiti SC", "Microsoft YaHei", sans-serif;
  font-size: 21.6px; /* 12px × 1.8 */
  font-weight: 700;
  color: var(--text-secondary, #6b7280);
}
.file-table .col-link { white-space: nowrap; }
.link-info { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.link-name {
  font-size: 13px; color: #16a34a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px;
}
.link-open { color: #2563eb; font-size: 13px; text-decoration: none; white-space: nowrap; }
.link-open:hover { text-decoration: underline; }
.link-del { color: #9ca3af; font-size: 13px; text-decoration: none; white-space: nowrap; padding: 0 2px; }
.link-del:hover { color: #dc2626; }

/* 变更通知列表专用列宽：ID 窄列 / 名称适中 / 操作居中窄列 / 关联工艺文件占余下全部宽度 */
.change-table { table-layout: fixed; }
.change-table .col-id { width: 130px; }
.change-table .col-name { width: 30%; min-width: 200px; }
.change-table .col-actions { width: 96px; text-align: center; }
.change-table .col-link { width: auto; white-space: normal; }
.change-table td.col-link { padding-top: 8px; padding-bottom: 8px; }
.change-table .link-info {
  gap: 12px; margin-bottom: 0; padding: 4px 0;
}
.change-table .link-info + .link-info { border-top: 1px dashed #f1f3f5; }
.change-table .link-name { flex: 1; max-width: none; font-size: 13.5px; }

.cell-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-icon-sm { font-size: 18px; flex-shrink: 0; }
.cell-name .file-name {
  font-weight: 500;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-err { color: #d93025; font-size: 12px; margin-top: 4px; }
.btn-sm { padding: 7px 16px; font-size: 13px; border-radius: 6px; }

/* ---- 响应式 ---- */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  main { padding: 20px 16px 40px; }
  .login-card { padding: 32px 24px; }
  .security-notes { grid-template-columns: 1fr; }
  .file-card { flex-direction: column; align-items: flex-start; gap: 12px; }
  .file-actions { width: 100%; }
  .file-toolbar { flex-wrap: wrap; }
  .file-toolbar .folder-search { min-width: 100%; order: 3; }
  .viewer-header { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ---- 上传/加签弹窗（与 PDF 加签工具风格一致） ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; z-index: 60;
  padding: 24px;
}
/* 链式提醒过渡弹窗：需盖住 z-index:100 的查看器，否则「下一份/跳工艺文件」的进度条会被查看器挡住 */
#chainModal { z-index: 200; }
.modal-card {
  background: var(--surface, #fff); border-radius: 14px; width: 100%;
  max-width: 880px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); border: 1px solid var(--border, #e5e7eb);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border, #e5e7eb);
  position: sticky; top: 0; background: var(--surface, #fff); z-index: 2;
}
.modal-head h3 { font-size: 17px; margin: 0; font-weight: 600; }
.modal-close {
  border: none; background: transparent; font-size: 20px; cursor: pointer;
  color: var(--text-secondary, #6b7280); line-height: 1; padding: 4px 8px; border-radius: 8px;
}
.modal-close:hover { background: #f1f5f9; }
.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; position: relative; }

/* 密码遮罩 */
.lock {
  position: absolute; inset: 0; background: rgba(24, 24, 27, .92);
  display: flex; align-items: center; justify-content: center; z-index: 5; border-radius: 0 0 14px 14px;
}
.lock-box {
  background: #fff; border-radius: 12px; padding: 32px; width: 320px; text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.lock-box h2 { font-size: 18px; margin-bottom: 6px; }
.lock-box p { font-size: 13px; color: #6b7280; margin-bottom: 18px; }
.lock-box input {
  width: 100%; padding: 10px; font-size: 16px; border: 1px solid #e5e7eb;
  border-radius: 8px; text-align: center; letter-spacing: 4px; margin-bottom: 12px;
}
.lock-box button {
  width: 100%; background: var(--seal, #c81e1e); color: #fff; border: none; padding: 11px;
  border-radius: 8px; font-size: 15px; cursor: pointer;
}
.lock-err { color: var(--seal, #c81e1e); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* 文件选择框 */
.filebox {
  border: 2px dashed var(--border, #e5e7eb); border-radius: 10px; padding: 20px;
  text-align: center; color: var(--text-secondary, #6b7280); font-size: 14px; cursor: pointer;
  transition: all .15s;
}
.filebox:hover, .filebox.drag { border-color: var(--seal, #c81e1e); color: var(--seal, #c81e1e); background: #fff7f7; }
.filebox.has { border-style: solid; color: var(--text, #1f2328); border-color: var(--seal, #c81e1e); background: #fff; }

.filelist {
  max-height: 140px; overflow-y: auto; border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.9;
}
.filelist .item { display: flex; justify-content: space-between; gap: 8px; }

.preview {
  width: 100%; aspect-ratio: 2400 / 1413; border-radius: 8px;
  background:
    linear-gradient(45deg, #e9e9e9 25%, transparent 25%, transparent 75%, #e9e9e9 75%),
    linear-gradient(45deg, #e9e9e9 25%, #fff 25%, #fff 75%, #e9e9e9 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.preview svg { width: 100%; height: auto; }

.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-secondary, #6b7280); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.status { font-size: 13px; color: var(--text-secondary, #6b7280); min-height: 20px; }
.status.ok { color: #16a34a; }
.status.err { color: var(--seal, #c81e1e); }
.hint { font-size: 12px; color: var(--text-secondary, #6b7280); line-height: 1.7; }

/* ---- 查阅旧版本弹窗 ---- */
.ver-card { width: 420px; max-width: 92vw; }
.ver-body { gap: 12px; }
.ver-docname {
  font-size: 14px; font-weight: 600; color: #111827;
  word-break: break-all; line-height: 1.5;
  padding: 10px 12px; background: #f8fafc; border-radius: 8px;
}
.ver-label { font-size: 12px; color: #6b7280; }
/* 专属链接身份横幅：让 ?role=admin 与 ?role=viewer 两个登录页一眼可辨 */
.role-banner {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; margin-bottom: 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 1.4;
}
.role-banner b { font-weight: 700; }
.role-banner.role-admin { background: #eef4ff; border: 1px solid #bcd2ff; color: #1d4ed8; }
.role-banner.role-viewer { background: #eafaf1; border: 1px solid #b6e8cd; color: #047857; }

/* 通用入口（无 ?role）的角色选择卡：引导进入对应专属登录页 */
.lead-sub { font-size: 14px; color: #374151; margin: 4px 0 12px; }
.role-choose { display: flex; gap: 12px; margin: 4px 0 6px; }
.role-card {
  flex: 1; cursor: pointer; text-align: center; padding: 16px 10px; border-radius: 12px;
  border: 1px solid #d1d5db; background: #fff; transition: .15s; color: #111827;
}
.role-card:hover { border-color: #2563eb; box-shadow: 0 4px 14px rgba(37,99,235,.12); transform: translateY(-1px); }
.rc-icon { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.rc-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.rc-desc { font-size: 12px; color: #6b7280; line-height: 1.4; }
.ver-select {
  width: 100%; padding: 10px 12px; font-size: 14px; color: #111827;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
  outline: none; cursor: pointer;
}
.ver-select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
/* 注册基地多选 */
.ver-checks {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
}
.ver-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: #111827; }
.ver-check input { width: 16px; height: 16px; accent-color: #2563eb; }
/* 多基地登录选择弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  width: 100%; max-width: 320px; background: #fff; border-radius: 14px;
  padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box .modal-title { font-size: 16px; font-weight: 600; color: #111827; margin-bottom: 14px; }
.modal-close {
  border: none; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: #9ca3af; padding: 0 4px; border-radius: 6px;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: #374151; background: #f1f5f9; }
.modal-box .modal-body { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.modal-box .modal-sub { font-size: 13px; color: #6b7280; margin: -6px 0 8px; line-height: 1.5; }
/* 工艺人员端：仅账号 + 密码登录 */
.admin-login { display: flex; flex-direction: column; gap: 4px; }
.admin-login .al-title { font-size: 16px; font-weight: 600; color: #111827; margin-bottom: 12px; text-align: center; }

/* 普通用户端：企微扫码 / 手机验证码 双 Tab */
.login-tabs { display: flex; gap: 6px; margin: 4px 0 14px; }
.login-tab {
  flex: 1; padding: 10px 8px; font-size: 14px; cursor: pointer;
  border: 1px solid #d1d5db; background: #f8fafc; color: #475569;
  border-radius: 10px; transition: all .15s;
}
.login-tab.active {
  border-color: #2563eb; background: #eef4ff; color: #1d4ed8; font-weight: 600;
}
.login-tabpane.hidden { display: none; }
/* 注册子面板：相对定位承载关闭图标 */
#pane-register { position: relative; }
.pane-close { position: absolute; top: -6px; right: -6px; z-index: 2; }
.login-remember-row { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 12px; font-size: 13px; }
.login-remember { display: flex; align-items: center; gap: 6px; color: #374151; cursor: pointer; user-select: none; }
.login-remember input { width: auto; margin: 0; }
.login-forgot { color: #2563eb; text-decoration: none; cursor: pointer; }
.login-forgot:hover { text-decoration: underline; }
.ver-input {
  width: 100%; padding: 11px 12px; font-size: 14px; color: #111827;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff; outline: none;
  box-sizing: border-box; margin-bottom: 10px;
}
.ver-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.sms-code-row { display: flex; gap: 8px; align-items: stretch; }
.sms-code-row .ver-input { flex: 1; margin-bottom: 0; }
.sms-code-row #smsSend { white-space: nowrap; }
#smsHint { min-height: 18px; margin: 8px 0 12px; font-size: 12px; }
.btn-secondary {
  padding: 11px 14px; font-size: 14px; cursor: pointer; border-radius: 8px;
  border: 1px solid #cbd5e1; background: #fff; color: #334155;
}
.btn-secondary:hover { background: #f1f5f9; }
.btn-secondary:disabled { opacity: .6; cursor: not-allowed; }
.btn-switch-base {
  margin-left: 6px; padding: 1px 8px; font-size: 12px; cursor: pointer;
  border: 1px solid #cbd5e1; background: #fff; color: #475569; border-radius: 999px;
}
.btn-switch-base:hover { background: #f1f5f9; }
/* 切换基地弹窗 */
.sb-opts { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.sb-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.ver-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.type-radios { display: flex; flex-direction: column; gap: 8px; }
.type-radio {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 13px; color: #374151; cursor: pointer; line-height: 1.4;
}
.type-radio:hover { border-color: #2563eb; background: #f8fafc; }
.type-radio input { margin-top: 2px; }
.ver-input {
  width: 100%; padding: 10px 12px; font-size: 14px; color: #111827;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff; outline: none;
}
.ver-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.ver-input:disabled { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
.ver-hint { font-size: 12px; color: #6b7280; margin-top: -4px; }
.file-table .btn-ver { margin-left: 8px; }
.link-none { color: var(--text-tertiary, #9ca3af); }

/* ---- 版本对比 ---- */
.cmp-selects { display: flex; flex-direction: column; gap: 12px; }
.cmp-diff-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

#cmpViewer { position: fixed; inset: 0; z-index: 60; }
.cmp-backdrop {
  position: absolute; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.cmp-card {
  width: min(1500px, 96vw); height: min(92vh, 940px);
  background: #fff; border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.cmp-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap;
}
.cmp-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #111827; }
.cmp-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp-body { flex: 1; display: flex; gap: 12px; padding: 14px; overflow: auto; background: #f8fafc; }
.cmp-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmp-col-diff { flex: 1; }
.cmp-col-head {
  font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px;
  padding: 4px 8px; background: #eef2f7; border-radius: 6px; text-align: center;
}
.cmp-stage {
  flex: 1; overflow: auto; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 8px; display: flex; align-items: flex-start; justify-content: center; padding: 8px;
}
.cmp-stage canvas { max-width: 100%; height: auto; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.cmp-footer { padding: 8px 16px; border-top: 1px solid #e5e7eb; }
.cmp-footer .warning { font-size: 12px; color: #b45309; }

/* ---- 文件夹属性 ---- */
.folder-type-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 600; line-height: 16px; color: #b45309;
  background: #fef3c7; border: 1px solid #fcd34d; border-radius: 999px;
  vertical-align: 1px; white-space: nowrap;
}

/* ---- 变更通知「培训记录」 ---- */
.col-train { width: 190px; }
.train-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.train-view { font-size: 12px; color: #2563eb; text-decoration: none; }
.train-none { font-size: 12px; color: #9ca3af; }
.train-view:hover { text-decoration: underline; }
/* 培训记录缩略小图标：照片缩略图 / PDF 瓦片 / +N 更多，点击打开弹窗浏览 */
.train-thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.train-thumb {
  width: 34px; height: 34px; border-radius: 5px; object-fit: cover;
  border: 1px solid #e5e7eb; background: #f9fafb; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.train-thumb:hover { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.train-thumb-pdf { font-size: 17px; color: #b91c1c; }
.train-thumb-more { font-size: 11px; color: #6b7280; font-weight: 600; }
/* 培训记录弹窗「确认」按钮：靠右，点击关闭弹窗并刷新列表缩略图 */
.train-toolbar .train-ok { margin-left: auto; padding: 6px 22px; }
.train-card { max-width: 860px; width: min(860px, 94vw); }
.train-toolbar { display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; }
.train-count { font-size: 13px; color: #6b7280; }
.train-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; max-height: 52vh; overflow: auto; padding: 2px;
}
.train-item {
  position: relative; border: 1px solid #e5e7eb; border-radius: 10px;
  overflow: hidden; background: #fff;
}
.train-item img {
  display: block; width: 100%; height: 130px; object-fit: cover; background: #f3f4f6; cursor: zoom-in;
}
.train-item img:hover { opacity: .9; }
.train-meta {
  font-size: 12px; color: #374151; padding: 6px 8px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.train-sub { font-size: 11px; color: #9ca3af; padding: 2px 8px 8px; }
.train-del {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  border: none; border-radius: 50%; background: rgba(17,24,39,.65); color: #fff;
  font-size: 12px; line-height: 22px; cursor: pointer;
}
.train-del:hover { background: #ef4444; }
.train-loading, .train-empty { color: #9ca3af; font-size: 13px; padding: 18px 0; text-align: center; }
/* PDF 记录瓦片（点击新标签打开） */
.train-pdf {
  height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: #fef2f2; cursor: pointer;
}
.train-pdf:hover { background: #fee2e2; }
.train-pdf-icon { font-size: 34px; line-height: 1; }
.train-pdf-label {
  font-size: 11px; font-weight: 600; color: #b91c1c;
  border: 1px solid #fca5a5; border-radius: 4px; padding: 1px 6px; letter-spacing: 1px;
}
/* 点击放大查看 */
.train-lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.78);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.train-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }

/* ===== 用户权限管理（顶栏按钮 + 密码弹窗 + 基地权限矩阵） ===== */
.perm-btn {
  align-self: center;
  margin-right: 14px;
  padding: 7px 14px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.perm-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.6); }

.perm-card { max-width: 720px; width: 92vw; }
.perm-matrix-wrap {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  overflow: auto;
  max-height: 55vh;
  margin-top: 8px;
}
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-matrix th, .perm-matrix td {
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding: 7px 10px;
  text-align: left;
  vertical-align: middle;
}
.perm-matrix thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f3f4f6; color: #374151;
  font-size: 12px; font-weight: 700;
}
.perm-matrix tbody tr:last-child td { border-bottom: none; }
.perm-matrix tbody tr:hover td { background: #f8fafc; }
.perm-matrix .pm-center { text-align: center; }
.perm-matrix .pm-name { font-weight: 600; color: #1f2937; }
.perm-matrix .pm-empty { color: #9ca3af; padding: 18px 0; }
.pm-perms { white-space: nowrap; }
.pm-check {
  display: inline-flex; align-items: center; gap: 4px;
  margin-right: 16px; cursor: pointer; user-select: none;
  font-size: 13px; color: #374151;
}
.pm-check input { width: 15px; height: 15px; accent-color: var(--primary, #2f6fed); cursor: pointer; }

/* ===== 权限矩阵横向布局（基地做列组 + 组头全选框） ===== */
.perm-card { max-width: 920px; }
.perm-matrix .pm-base {
  background: #eef2ff;
  border-left: 1px solid #e5e7eb;
  text-align: center;
  white-space: nowrap;
}
.perm-matrix .pm-base:first-of-type { border-left: none; }
.perm-matrix .pm-base-all {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: #1f2937;
  cursor: pointer; user-select: none;
}
.perm-matrix .pm-base-all input { width: 15px; height: 15px; accent-color: var(--primary, #2f6fed); cursor: pointer; }
.perm-matrix .pm-sub {
  background: #f8fafc; color: #4b5563;
  font-size: 12px; font-weight: 600;
  border-left: 1px solid #eef0f3;
  text-align: center;
}
.perm-matrix .pm-act { width: 44px; }
.perm-matrix .pm-boxcell input {
  width: 15px; height: 15px;
  accent-color: var(--primary, #2f6fed);
  cursor: pointer; vertical-align: middle;
}

/* ===== 顶栏按钮移入用户行 + 右下角版本信息 ===== */
.perm-btn {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 10px;
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.perm-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.6); }

.app-version {
  position: fixed;
  right: 12px;
  bottom: 8px;
  z-index: 9000;
  font-size: 12px;
  color: rgba(100,116,139,.75);
  pointer-events: none;
  user-select: none;
  letter-spacing: .3px;
}

/* ===== 两级目录：顶级分类父项 + 返回条 ===== */
.folder-card-cat { border: 1px solid #dbe3ff; background: linear-gradient(180deg,#f5f8ff,#eef3ff); }
.folder-card-cat .folder-name { font-weight: 700; color: #1e3a8a; }
.folder-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; margin-bottom: 12px;
  border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
  background: #fff; color: #475569; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.folder-back:hover { background: #f8fafc; border-color: #cbd5e1; }
.folder-back span:first-child { font-size: 15px; line-height: 1; }

/* ===== 权限矩阵：标题旁「添加基地」按钮 ===== */
.mh-left { display: flex; align-items: center; gap: 12px; }
.perm-add-base {
  padding: 4px 12px;
  border: 1px dashed var(--primary, #2f6fed);
  border-radius: 8px;
  background: #f0f6ff;
  color: var(--primary, #2f6fed);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.perm-add-base:hover { background: #e0efff; border-style: solid; }

/* ===== 路径导航统一：文件夹视图面包屑 ===== */
.folder-crumb { margin: 0 0 14px; }
.folder-crumb .file-count { margin-left: 10px; }

/* 添加基地 / 添加工艺人员（含重命名）弹窗：需盖住权限矩阵弹窗（.modal-backdrop:60，矩阵在 DOM 中靠后） */
#permBaseModal,
#permUserModal { z-index: 70; }

/* ===== 权限矩阵：工号列 + 操作列 ===== */
.perm-matrix .pm-empno { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; color: #334155; }
.perm-matrix .pm-ops { white-space: nowrap; }
.perm-matrix .pm-ops .btn-sm { margin: 0 3px; padding: 3px 9px; font-size: 12px; }

/* ===== 普通用户管理（与权限矩阵完全独立） ===== */
#userMgrModal { z-index: 60; }
#umAddModal,
#viewerSetPwdModal { z-index: 75; }
.user-mgr-card { max-width: 720px; }
.user-mgr-card .mh-left { display: flex; align-items: baseline; gap: 10px; }
.um-scope { font-size: 12px; font-weight: 400; color: #64748b; }
.um-toolbar { margin: 4px 0 10px; }
.um-table-wrap { max-height: 52vh; overflow: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.um-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.um-table th, .um-table td { padding: 8px 10px; border-bottom: 1px solid #eef2f7; text-align: left; }
.um-table thead th { background: #f1f5f9; color: #475569; font-weight: 600; position: sticky; top: 0; }
.um-table tbody tr:hover td { background: #f8fafc; }
.um-table .um-center { text-align: center; }
.um-table .um-name { font-weight: 600; color: #1f2937; }
.um-table .um-phone { font-family: ui-monospace, Menlo, Consolas, monospace; color: #334155; }
.um-table .um-empty { color: #9ca3af; padding: 18px 0; text-align: center; }
.um-table .um-ops { white-space: nowrap; }
.um-table .um-ops .btn-sm { margin: 0 3px; padding: 3px 9px; font-size: 12px; }
.um-status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.um-status.um-ok { background: #dcfce7; color: #166534; }
.um-status.um-pending { background: #fef3c7; color: #92400e; }
