:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a8f99;
  --stamp: rgba(200, 30, 30, 0.85);
  --border: #e5e6eb;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; padding-bottom: 24px;
}

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--primary); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.topbar .title { font-size: 17px; font-weight: 600; }
/* 默认次级按钮：白字半透（用于深色 topbar 内的「返回列表/重新上传」） */
.topbar .btn-ghost {
  background: rgba(255,255,255,.18); color: #fff; border: none;
  padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
/* 卡片/弹窗内的次级按钮：深色文字 + 浅灰边（用于浅色背景，避免白字看不清） */
.btn-ghost {
  background: #f1f3f6; color: #333; border: 1px solid #d8dde3;
  padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: #e6e9ee; }

/* 上传区 */
.upload-area {
  margin: 24px 16px; padding: 40px 16px; border-radius: 12px;
  background: var(--card); border: 2px dashed var(--border); text-align: center;
}
.upload-area.drag { border-color: var(--primary); background: #eef4ff; }
.upload-icon { font-size: 44px; }
.upload-tip { font-size: 16px; font-weight: 600; margin: 12px 0 4px; }
.upload-sub { font-size: 12px; color: var(--muted); margin: 0 0 18px; }

/* 按钮 */
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 10px 22px; border-radius: 8px; font-size: 15px; cursor: pointer;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-block { display: block; width: 100%; padding: 10px; font-size: 15px; font-weight: 600; }

/* ---- 「新建会签任务」区域：所有按钮统一为淡绿色，区别于已有任务 ---- */
.admin-box .btn-primary,
.admin-box .btn-sm {
  background: #5cb85c; color: #fff;
  border: none;
}
.admin-box .btn-primary:hover,
.admin-box .btn-sm:hover { background: #4cae4c; }
.admin-box .btn-primary:active,
.admin-box .btn-sm:active { background: #398439; }
/* 手动输入按钮（btn-ghost）也加淡绿底，视觉一致 */
.admin-box .btn-ghost {
  background: #5cb85c; color: #fff; border: none;
}
.admin-box .btn-ghost:hover { background: #4cae4c; }

/* 工作区 */
.workspace { margin: 0 10px; }
.ws-hint {
  display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 12px 14px;
  background: #eef4ff; color: #1557b0; border-radius: 8px; font-size: 12px; margin-bottom: 12px;
}
.page-wrap { margin-bottom: 20px; }
.pages { overflow-x: auto; -webkit-overflow-scrolling: touch; }   /* 放大超过 100% 时支持横向滚动 */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: var(--card); border: 1px solid var(--border);
  border-bottom: none; border-radius: 8px 8px 0 0; font-weight: 600; font-size: 14px;
}
.btn-add {
  background: var(--primary); color: #fff; border: none;
  padding: 5px 12px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.page-stage {
  background: #fff; border: 1px solid var(--border); border-radius: 0 0 8px 8px;
  overflow: hidden;
  touch-action: manipulation;   /* 允许浏览器接管水平/垂直滚动；签名图通过 setPointerCapture 接管拖拽，不冲突 */
  width: 100%; margin: 0 auto;
}
.page-img { display: block; width: 100%; height: auto; pointer-events: none; }

/* 文档缩放工具条 */
.zoom-bar {
  position: sticky; top: 50px; z-index: 9;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 8px 12px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.zoom-label { font-size: 13px; color: var(--muted); }
.zb-btn {
  min-width: 32px; height: 30px; border: 1px solid var(--border); background: #f7f8fa;
  border-radius: 6px; font-size: 16px; line-height: 1; cursor: pointer; color: #333;
}
.zb-btn:active { background: #e8e8e8; }
.zb-btn.wide { font-size: 13px; padding: 0 10px; }
.zoom-val { font-size: 13px; min-width: 44px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }

/* 内联输入（备用） */
.name-input {
  display: flex; gap: 6px; align-items: center; padding: 8px 10px;
  background: #fafafa; border: 1px solid var(--border);
}
.name-input input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; outline: none;
}
.name-input input:focus { border-color: var(--primary); }
.btn-ok { background: var(--primary); color: #fff; border: none; padding: 7px 12px; border-radius: 6px; font-size: 13px; }
.btn-cancel { background: #eee; color: #555; border: none; padding: 7px 12px; border-radius: 6px; font-size: 13px; }

/* 手写签名图 */
.stamp {
  position: absolute; cursor: grab; user-select: none; touch-action: none;
  border: 1px dashed var(--primary); background: rgba(26,115,232,.04);
  padding: 2px; box-sizing: border-box;
}
.stamp.dragging { cursor: grabbing; box-shadow: 0 2px 10px rgba(0,0,0,.25); z-index: 20; }
.stamp img { display: block; width: 100%; height: auto; pointer-events: none; transform-origin: center center; }
.stamp-ctrl {
  position: absolute; top: -38px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; background: #fff; border: 1px solid var(--border);
  border-radius: 18px; padding: 3px 7px; box-shadow: 0 1px 5px rgba(0,0,0,.18);
}
.stamp-ctrl button {
  width: 28px; height: 28px; border: none; background: #f2f3f5; border-radius: 50%;
  font-size: 15px; line-height: 1; cursor: pointer; color: #333;
}
.stamp-ctrl button:active { background: #e0e0e0; }
/* 管理员模式：已签签名可调整 — stamp-ctrl 容器加橙色边框 + 「可调」角标 */
.stamp-admin-editable { outline: 2px dashed #f59e0b; outline-offset: 1px; }
.stamp-admin-editable .stamp-ctrl { border-color: #f59e0b; }
.admin-edit-tag {
  display: inline-block; padding: 0 6px; font-size: 11px; color: #fff;
  background: #f59e0b; border-radius: 8px; line-height: 18px; margin-left: 2px;
  cursor: help;
}
.stamp-del {
  position: absolute; top: -10px; right: -10px; width: 20px; height: 20px;
  background: #c81e1e; color: #fff; border-radius: 50%; font-size: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 6;
}
.stamp-name {
  font-size: 10px; color: #888; padding: 0 4px; white-space: nowrap;
}
.stamp-foot {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  flex-wrap: wrap;
  font-size: 10px; padding-top: 2px; white-space: nowrap;
}
.stamp-date {
  font-size: 10px; color: #555; padding: 0 4px; white-space: nowrap;
}
/* 滚轮缩放：缩放中在签名图右下角显示百分比 */
.stamp-zoom-tip {
  position: absolute; right: 3px; bottom: 3px; z-index: 7;
  background: rgba(17,24,39,.82); color: #fff;
  font-size: 11px; line-height: 16px; padding: 0 7px; border-radius: 9px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s;
}
.stamp.zooming { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.22); }
.stamp.zooming .stamp-zoom-tip { opacity: 1; }

.ws-actions { margin-top: 8px; padding: 0 4px 16px; }

/* 企微发送区域 */
.share-area {
  margin-top: 12px; padding: 14px; border-radius: 8px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
}
.share-hint {
  font-size: 13px; color: #166534; text-align: center;
  margin-bottom: 6px; font-weight: 500;
}

/* 加载遮罩 */
.loading {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; gap: 10px;
  color: #fff; font-size: 15px; z-index: 50;
}
/* 默认 hidden 属性隐藏；仅当 JS 移除 hidden 后才显示（修复 display:flex 覆盖 [hidden] 的 bug） */
.loading:not([hidden]) {
  display: flex;
}
.spinner {
  width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 手写签名画板 */
.sigpad-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.sigpad-overlay:not([hidden]) { display: flex; }
.sigpad {
  width: 100%; max-width: 420px; background: #fff; border-radius: 12px;
  overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.sigpad-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.sigpad-head-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sigpad-head-btns .sp-btn { padding: 6px 9px; font-size: 12px; }
.sigpad-canvas-wrap {
  position: relative; margin: 12px 16px; background: #fafafa;
  border: 1px dashed var(--border); border-radius: 8px; overflow: hidden;
}
.sig-canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.sig-canvas.crop-lock { pointer-events: none; }  /* 裁剪模式下禁止手写，避免冲突 */
/* 裁剪框 */
.sig-crop {
  position: absolute; left: 10%; top: 10%; width: 80%; height: 80%;
  border: 2px solid #1a73e8;
  box-sizing: border-box; cursor: move; z-index: 3;
}
.sig-crop-h {
  position: absolute; width: 18px; height: 18px; background: #1a73e8;
  border: 2px solid #fff; border-radius: 50%; box-sizing: border-box; z-index: 4;
}
.sig-crop-h[data-dir="nw"] { left: -9px; top: -9px; cursor: nwse-resize; }
.sig-crop-h[data-dir="ne"] { right: -9px; top: -9px; cursor: nesw-resize; }
.sig-crop-h[data-dir="sw"] { left: -9px; bottom: -9px; cursor: nesw-resize; }
.sig-crop-h[data-dir="se"] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.sigpad-baseline { position: absolute; left: 16px; right: 16px; bottom: 56px; border-top: 1px dashed #bbb; }
.sigpad-tip { margin: 0 16px 12px; font-size: 12px; color: var(--muted); text-align: center; }
.sigpad-save-opt {
  display: flex; align-items: center; gap: 6px;
  margin: 0 16px 10px; padding: 8px 10px;
  background: #f6f8fb; border: 1px solid #e2e6ec; border-radius: 6px;
  font-size: 12px; color: #444;
}
.sigpad-save-opt input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: #5cb85c;
}
.sigpad-actions { display: flex; gap: 10px; padding: 0 16px 16px; }
.sp-btn { flex: 1; padding: 11px; border-radius: 8px; font-size: 15px; border: none; cursor: pointer; }
.sp-btn.primary { background: var(--primary); color: #fff; font-weight: 600; }
.sp-btn.ghost { background: #eee; color: #555; }
.sp-btn:active { opacity: .85; }

/* 角色徽章 / 返回 */
.role-badge {
  background: rgba(255,255,255,.2); color: #fff; font-size: 12px;
  padding: 3px 10px; border-radius: 12px; margin-left: 8px;
}

/* 首页：任务列表 */
.home-view { margin: 16px 12px; }
.admin-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 18px;
}
.ab-title { margin: 0 0 12px; font-size: 15px; }
.txt-input, .txt-area {
  display: block; width: 100%; margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  outline: none; box-sizing: border-box; font-family: inherit;
}
.txt-input:focus, .txt-area:focus { border-color: var(--primary); }
.txt-area { min-height: 96px; resize: vertical; }
.err-tip { color: #c81e1e; font-size: 13px; margin: 8px 0 0; }

.task-list { display: flex; flex-direction: column; gap: 12px; }
.empty-tip { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }

/* 任务搜索栏 */
.task-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 0 10px; margin-bottom: 8px;
}
.task-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,115,232,.12); }
.ts-icon { flex: 0 0 auto; font-size: 14px; opacity: .65; }
.ts-input {
  flex: 1 1 auto; min-width: 0; width: 100%;
  border: none; outline: none; background: transparent;
  font-size: 14px; padding: 11px 0; font-family: inherit; color: var(--text);
}
.ts-clear {
  flex: 0 0 auto; border: none; background: #eef1f5; color: #6b7280;
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  font-size: 12px; line-height: 22px; cursor: pointer;
}
.ts-clear:active { background: #e2e6ec; }
.ts-count { font-size: 13px; color: var(--muted); margin: 0 0 8px 2px; }
.ts-count b { color: var(--primary); }
mark.hl { background: #fff2a8; color: inherit; padding: 0 1px; border-radius: 2px; }
/* 任务分组标题（待我签 / 我已签折叠组） */
.task-group-title {
  padding: 10px 12px; margin: 4px 0 2px;
  background: #f7f8fa; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #333;
  cursor: pointer; user-select: none;
}
.task-group-title.pending-title {
  background: #fff3e0; color: #b26a00; border-color: #ffd8a6;
}
.task-group-title.other-title {
  background: #eff6ff; color: #0369a1; border-color: #bfdbfe;
}
.task-group-title.collapsed { opacity: .9; }
.task-group-title:hover { filter: brightness(0.96); }
/* 企微 X5 内核会覆盖 [hidden] 的 display，必须显式强制隐藏 */
[hidden] { display: none !important; }
.task-group-body { display: flex; flex-direction: column; gap: 12px; }
.task-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.tc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tc-title { font-size: 15px; font-weight: 600; }
.tag.pending {
  background: #fff3e0; color: #b26a00; font-size: 12px;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.tc-meta { font-size: 12px; color: var(--muted); margin: 6px 0; }
.tc-signers { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px; }
.tc-signers .sg { font-size: 13px; color: #333; }

/* 签署人面板 */
.signer-panel {
  background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px;
}
.sg-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px; border-bottom: 1px dashed #d6e4ff;
}
.sg-row:last-child { border-bottom: none; }
.sg-name { font-size: 14px; font-weight: 500; }
.sg-status { font-size: 12px; color: var(--muted); flex: 1; text-align: center; }
.sg-done { font-size: 12px; color: #166534; }
.sg-highlight { background: rgba(22,119,255,0.06); border-radius: 6px; }
/* 管理员在签署人面板中的修改/删除小按钮 */
.sg-admin-btns { display: flex; gap: 6px; margin-right: 8px; }
.sg-btn-edit, .sg-btn-del { background: transparent; border: none; font-size: 12px; cursor: pointer; padding: 2px 4px; }
.sg-btn-edit { color: #1a73e8; }
.sg-btn-del { color: #c81e1e; }
.sg-add-row { justify-content: center; padding: 10px 4px; border-bottom: none; }
/* 签署人面板「📋 用我的签名」快捷按钮 — 黑字透明底（与任务卡片同款） */
.btn-mystamp {
  background: transparent !important; color: #000 !important;
  border: 1px solid #d8dde3 !important;
  margin-left: 6px;
  padding: 6px 10px !important;
}
.btn-mystamp:hover { background: #f1f3f6 !important; }
.btn-sm {
  background: var(--primary); color: #fff; border: none;
  padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-sm:active { background: var(--primary-dark); }

/* 任务卡片操作按钮（黑字 + 边框，浅色背景可见） */
.tc-export {
  font-size: 12px; color: #000; padding: 4px 10px;
  border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid #d8dde3;
}
.tc-export:hover { background: #f1f3f6; }
.tc-notify {
  font-size: 12px; color: #000; padding: 4px 10px;
  border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid #d8dde3;
}
.tc-notify:hover { background: #f1f3f6; }
.tc-del {
  font-size: 12px; color: #c81e1e; padding: 4px 8px;
  border: 1px solid #f5c2c7; border-radius: 4px; cursor: pointer;
  background: transparent; margin-left: auto;
}
.tc-del:hover { background: #fef0f1; }

/* 签署页面底部「导出已签PDF」按钮（黑字透明底） */
#exportBtn {
  color: #000; background: transparent;
  border: none;
}
#exportBtn:hover { color: #1a73e8; }

/* 复制下载链接（黑字透明底） */
#copyLinkBtn {
  color: #000; background: transparent;
  border: none;
}
#copyLinkBtn:hover { color: #1a73e8; }

/* 通讯录弹窗「同步任务成员」（次级，保持浅色） — 走 .btn-ghost 即可 */

/* OAuth 失败页「重新授权」（黑字透明底） */
.auth-fail-box .btn-ghost {
  color: #000; background: transparent;
  border: none;
}
.auth-fail-box .btn-ghost:hover { color: #1a73e8; }

/* 授权失败兜底提示 */
.auth-fail-box {
  text-align: center; padding: 32px 16px;
}
.auth-fail-box p {
  font-size: 15px; color: var(--text); margin: 0 0 8px;
}
.auth-fail-sub {
  font-size: 12px; color: var(--muted); margin-bottom: 20px;
}

/* ========== 签署人选择器（通讯录勾选）========== */
.signer-picker { margin-top: 10px; }
.sp-chips {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 42px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fafafa; align-items: center;
}
.sp-chips:empty::before,
.sp-placeholder { color: var(--muted); font-size: 13px; width: 100%; }
.sp-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  background: #eef4ff; color: #1557b0; border: 1px solid #cfe0ff;
  border-radius: 16px; font-size: 13px; cursor: default; user-select: none;
}
.sp-chip .sp-x {
  cursor: pointer; margin-left: 2px; color: #888; font-size: 14px;
  line-height: 1; padding: 0 2px; border-radius: 50%;
}
.sp-chip .sp-x:hover { background: rgba(0,0,0,.08); color: #c81e1e; }
.sp-actions { display: flex; gap: 8px; margin-top: 8px; margin-bottom: 14px; }

/* 「允许下载的人」选择器 — 视觉上与签署人选择器分隔，标签用橙色高亮 */
.exporter-picker { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #d8dde3; }
.exporter-picker .ep-label { font-size: 12px; color: #555; margin-bottom: 6px; }
.exporter-picker .ep-label b { color: #d2691e; }

/* 创建任务：文件操作区 + 附件列表 */
.file-actions { display: flex; gap: 10px; align-items: center; }
.task-file-info {
  margin: 8px 0 10px; padding: 8px 12px;
  background: #eef4ff; color: #1557b0; border: 1px solid #cfe0ff;
  border-radius: 8px; font-size: 13px; word-break: break-all;
}
.task-file-info:empty { display: none; }
.task-file-info .tfi-name { font-weight: 600; }
.task-file-info .tfi-size { color: #5a7eb8; margin-left: 8px; font-size: 12px; }
.attachment-list { margin: 8px 0 10px; }
.attachment-list .sp-chip { background: #f1f8f1; color: #2e7d32; border-color: #b7dfb7; }
.attachment-list .attachment-chip .att-icon { margin-right: 2px; }

/* 任务详情页附件面板 */
.attachment-panel {
  margin: 16px; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.ap-title { font-size: 14px; font-weight: 600; color: #334155; margin-bottom: 8px; }
.attachment-list-view { list-style: none; margin: 0; padding: 0; }
.attachment-list-view li { margin: 4px 0; }
.attachment-list-view .att-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 6px; cursor: pointer; font-size: 13px;
  transition: background .15s;
}
.attachment-list-view .att-item:hover { background: #eef4ff; }
.attachment-list-view .att-item .att-preview-hint {
  font-size: 11px; color: #3b82f6; white-space: nowrap; margin-left: 8px;
}
.attachment-list-view a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 6px; text-decoration: none; color: #1d4ed8; font-size: 13px;
}
.attachment-list-view a:hover { background: #eef4ff; }
.attachment-list-view .att-size { color: #888; font-size: 12px; white-space: nowrap; }

/* ===== 附件预览弹窗 ===== */
.apv-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
}
.apv-modal.apv-hidden { opacity: 0; pointer-events: none; transition: opacity .25s; }
.apv-modal:not(.apv-hidden) { opacity: 1; transition: opacity .25s; }
.apv-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
}
.apv-dialog {
  position: relative; z-index: 1;
  width: 92%; max-width: 860px; height: 82%; max-height: 85vh;
  background: #fff; border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.3);
}
.apv-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #e2e8f0;
  background: #f8fafc; flex-shrink: 0;
}
.apv-title { font-size: 14px; font-weight: 600; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 75%; }
.apv-close {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: #e2e8f0;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #64748b; flex-shrink: 0;
}
.apv-close:hover { background: #cbd5e1; color: #1e293b; }
.apv-body {
  flex: 1; overflow: auto; position: relative; background: #525659;
  display: flex; align-items: center; justify-content: center;
}
.apv-iframe {
  width: 100%; height: 100%; border: none; background: #fff;
}
.apv-img-wrap {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.apv-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.apv-nopreview {
  text-align: center; color: #64748b; padding: 40px 20px;
}
.apv-nopreview p { margin: 4px 0; font-size: 15px; }
.apv-sub { font-size: 13px !important; color: #94a3b8 !important; }
.apv-foot {
  padding: 8px 14px; border-top: 1px solid #e2e8f0;
  background: #f8fafc; flex-shrink: 0; text-align: right;
}

.contact-modal { position: fixed; inset: 0; z-index: 70; display: none; }
.contact-modal:not([hidden]) { display: block; }
.cm-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
}
.cm-dialog {
  position: absolute; inset: 12px 12px auto 12px; max-height: calc(100% - 24px);
  background: #fff; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.cm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cm-title { font-size: 16px; font-weight: 600; }
.cm-close {
  background: none; border: none; font-size: 20px; color: #999;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.cm-close:hover { background: #f0f0f0; color: #333; }
.cm-search {
  width: 100%; padding: 10px 14px; border: none; border-bottom: 1px solid var(--border);
  font-size: 14px; outline: none; box-sizing: border-box; flex-shrink: 0;
}
.cm-search::placeholder { color: #bbb; }
.cm-list {
  flex: 1; overflow-y: auto; padding: 6px 0; -webkit-overflow-scrolling: touch;
}
.cm-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  cursor: pointer; user-select: none; transition: background .15s;
}
.cm-item:hover { background: #f7f8fa; }
.cm-item.selected { background: #eef4ff; }
.cm-check {
  width: 20px; height: 20px; border: 2px solid #ccc; border-radius: 5px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.cm-item.selected .cm-check {
  background: var(--primary); border-color: var(--primary);
}
.cm-check::after {
  content: ""; display: none; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}
.cm-item.selected .cm-check::after { display: block; }
.cm-name { font-size: 14px; font-weight: 500; }
.cm-dept { font-size: 12px; color: var(--muted); margin-left: auto; }
.cm-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.cm-count { font-size: 13px; color: var(--muted); }
.cm-add {
  display: flex; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--border);
  background: #fafbfc; flex-shrink: 0;
}
.cm-add-input {
  flex: 1; min-width: 0; padding: 7px 10px; font-size: 13px; border: 1px solid var(--border);
  border-radius: 7px; outline: none;
}
.cm-add-input:focus { border-color: var(--primary); }
.cm-add-tip {
  margin: 0; padding: 8px 16px; font-size: 11px; color: var(--muted);
  background: #fafbfc; line-height: 1.5;
}

/* ============================================================
   浮动按钮「在本页签名」：翻到哪一页点一下，签名落在该页
   ============================================================ */
.float-sign-btn {
  position: fixed;
  right: 14px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex; align-items: center; gap: 6px;
  padding: 11px 16px;
  border: none; border-radius: 26px;
  background: linear-gradient(135deg, #1a73e8, #1557b0);
  color: #fff; font-size: 14px; font-weight: 600;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(21, 87, 176, 0.38);
  cursor: pointer;
  transition: transform .12s ease, background .2s ease;
}
.float-sign-btn:active { transform: scale(.95); }
.float-sign-btn .fsb-icon { font-size: 15px; line-height: 1; }
.float-sign-btn .fsb-badge {
  font-style: normal; font-size: 12px; font-weight: 700;
  background: #fff; color: var(--primary-dark);
  border-radius: 9px; padding: 1px 6px; min-width: 8px; text-align: center;
}
.float-sign-btn .fsb-badge:empty { display: none; }
/* 签署位用完 → 切换为橙色「追加签名」外观 */
.float-sign-btn.fsb-extra {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.38);
}
.float-sign-btn.fsb-extra .fsb-badge { color: #b45309; }

/* 落章后的浮动提示 */
.fsb-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  z-index: 61; max-width: 86vw;
  background: rgba(17, 24, 39, 0.92); color: #fff;
  font-size: 13px; line-height: 1.5; text-align: center;
  padding: 9px 14px; border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* 新落章闪烁提示（帮用户一眼看到签名落在哪） */
.stamp.stamp-flash { animation: stampFlash 1s ease-out; }
@keyframes stampFlash {
  0%   { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.75); }
  70%  { box-shadow: 0 0 0 10px rgba(26, 115, 232, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0); }
}

/* 签署人面板：追加签名的标签（同一人的多次追加已合并为一行，标签显示总数量） */
.sg-extra-tag {
  font-size: 11px; color: #b45309; background: #fef3c7;
  border: 1px solid #fde68a; border-radius: 4px;
  padding: 0 6px; margin-left: 6px; white-space: nowrap;
  font-weight: 600;
}
/* 合并后的「追加」行：浅橙底，与正式签署位区分，视觉上弱化 */
.sg-row-extra {
  background: #fffbf0;
  border-left: 3px solid #fcd34d;
  border-radius: 6px;
}
/* 首页任务卡片：追加签名折叠徽标 */
.tc-signers .sg-extra {
  color: #b45309; background: #fffbf0;
  border: 1px solid #fde68a; border-radius: 10px;
  padding: 1px 8px; font-size: 12px;
}
.tc-signers .sg-extra-done {
  color: #8a6d1a; background: #fffbeb;
  border: 1px solid #fde68a; border-radius: 10px;
  padding: 1px 8px; font-size: 12px;
}
.tc-signers .sg-extra-n {
  font-style: normal; font-size: 11px; opacity: 0.85;
}

/* ========== 网页端登录入口 ========== */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 30, 48, 0.55); padding: 16px;
}
.login-card {
  width: 100%; max-width: 340px; background: var(--card);
  border-radius: 14px; padding: 26px 22px 22px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.login-logo {
  font-size: 20px; font-weight: 700; color: var(--primary-dark);
  text-align: center; margin-bottom: 4px;
}
.login-sub {
  font-size: 13px; color: var(--muted); text-align: center;
  margin-bottom: 18px;
}
.login-label {
  display: block; font-size: 13px; color: var(--text);
  margin: 12px 0 6px;
}
.login-input {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fafbfc; color: var(--text); outline: none;
}
.login-input:focus { border-color: var(--primary); background: #fff; }
.login-err {
  margin-top: 12px; font-size: 13px; color: #c81e1e;
  background: #fdecec; border: 1px solid #f5c2c2;
  border-radius: 8px; padding: 8px 10px;
}
.login-tip {
  margin-top: 16px; font-size: 12px; color: var(--muted);
  text-align: center; line-height: 1.5;
}
.login-ok {
  margin-top: 12px; font-size: 13px; color: #1a7f37;
  background: #eafaf0; border: 1px solid #b7e4c7;
  border-radius: 8px; padding: 8px 10px;
}
.login-card .btn-block { margin-top: 18px; }

/* 用户管理（管理员重置密码入口） */
.um-section { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.um-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.um-tip { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
