/* 扩展功能样式：表格签字 / 活动签到 / 员工自助 */

/* ---------- 顶部导航 tab ---------- */
.nav-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.nav-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-tab:hover { background: var(--accent-soft); color: var(--accent); }
.nav-tab.active { background: var(--accent); color: #fff; }

.page-view { display: none; }
.page-view.active { display: block; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input[type=text],
.field input[type=password],
.field input[type=date],
.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 180px; }

.dynamic-fields .df-row { display: flex; gap: 8px; margin-bottom: 8px; }
.dynamic-fields .df-row input { flex: 1; }
.dynamic-fields .df-row button { flex: 0 0 auto; }

/* ---------- 任务卡片 ---------- */
.task-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
}
.task-card .task-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.task-card .title { font-weight: 700; font-size: 16px; }
.task-card .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.task-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.progress-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #16a34a); border-radius: 99px; transition: width .3s; }

.people-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.people-table th, .people-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.people-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.people-table td.link-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }

.empty { color: var(--muted); text-align: center; padding: 24px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef2ff; color: #4338ca; margin-left: 6px; vertical-align: middle; }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.badge.partial { background: var(--accent-soft); color: var(--accent); }
.badge.completed, .badge.signed { background: var(--green-soft); color: var(--green); }
.badge.closed { background: #f1f5f9; color: var(--muted); }
.badge.open { background: var(--green-soft); color: var(--green); }

/* ---------- 手机端通用 ---------- */
.m-wrap { max-width: 520px; margin: 0 auto; padding: 18px; }
.m-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.m-title { font-size: 20px; font-weight: 700; color: var(--text); }
.m-sub { color: var(--muted); font-size: 13px; }

/* 明细核对表 */
.detail-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.detail-table th, .detail-table td { border: 1px solid var(--line); padding: 10px 12px; font-size: 14px; }
.detail-table th { background: #f8fafc; color: var(--muted); font-weight: 600; width: 38%; text-align: left; }
.detail-table td { word-break: break-all; }

/* 米字格签名画布容器 */
.mzi {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.mzi.grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, transparent calc(50% - .5px), #e2e8f0 calc(50% - .5px), #e2e8f0 calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), #e2e8f0 calc(50% - .5px), #e2e8f0 calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(45deg, transparent calc(50% - .5px), #eef2f7 calc(50% - .5px), #eef2f7 calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(-45deg, transparent calc(50% - .5px), #eef2f7 calc(50% - .5px), #eef2f7 calc(50% + .5px), transparent calc(50% + .5px));
  pointer-events: none;
}
.mzi .trace-name {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "KaiTi", "STKaiti", "楷体", serif;
  font-size: clamp(48px, 18vw, 96px);
  color: rgba(148, 163, 184, 0.28);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
.mzi canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.pad-tip { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #94a3b8; font-size: 14px; pointer-events: none; }

.sig-toolbar { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* 强制预览滚动提示 */
.scroll-gate {
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 10px;
}
.scroll-gate.ok { border-color: var(--green); background: var(--green-soft); color: var(--green); }

.btn-block { width: 100%; }

/* 自助页 */
.self-task {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
}
.self-task .info .t { font-weight: 600; }
.self-task .info .s { font-size: 12px; color: var(--muted); }

/* ---------- 签字完成页 ---------- */
.done-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; }
.done-hero { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.done-check {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
  background: var(--green-soft); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.done-heading { min-width: 0; }
.done-title { font-size: 20px; font-weight: 700; color: var(--green); }
.done-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.done-section { margin-top: 18px; }
.done-section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  letter-spacing: .02em; margin-bottom: 8px; padding-left: 9px;
  border-left: 3px solid var(--accent);
}
.info-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px;
}
.info-row:last-child { border-bottom: 0; }
.info-label { color: var(--muted); flex: 0 0 auto; }
.info-value { color: var(--text); font-weight: 600; text-align: right; word-break: break-all; }
.info-row.highlight { background: var(--green-soft); border-radius: 8px; padding: 10px 12px; border-bottom: 0; margin-top: 4px; }
.info-row.highlight .info-label,
.info-row.highlight .info-value { color: var(--green); }
.done-detail .info-row { padding: 7px 0; }
.signed-sig-box { text-align: center; padding: 12px; background: #f8fafc; border-radius: 10px; }
.signed-sig-box img { max-width: 220px; max-height: 96px; }
.exit-btn { margin-top: 22px; }

/* ---------- 员工通讯录 ---------- */
.contact-toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.contact-toolbar input {
  flex: 1 1 260px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-family: inherit;
}
.contact-summary { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.table-scroll { width: 100%; overflow-x: auto; }
.contact-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.contact-table th, .contact-table td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; }
.contact-table th { white-space: nowrap; }
.contact-table td:nth-child(2) { min-width: 130px; max-width: 170px; }
.contact-table td:nth-child(4) { min-width: 150px; max-width: 190px; }
.contact-table td:nth-child(7) { min-width: 160px; max-width: 200px; }
.contact-table .contact-tag { margin: 1px 2px 1px 0; }
.contact-table th { color: var(--muted); font-size: 12px; font-weight: 600; background: #f8fafc; }
.contact-table tbody tr:hover { background: #f8fafc; }
.contact-tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; background: #eef2ff; color: #4338ca; white-space: nowrap; }
.contact-table .badge { white-space: nowrap; }
.contact-table td { white-space: normal; }
.contact-table td:nth-child(3) { white-space: nowrap; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.contact-table .sub { font-size: 11px; color: var(--muted); }
.contact-table .muted, .muted { color: var(--muted); font-size: 13px; }
.link-name { color: var(--accent); text-decoration: none; cursor: pointer; }
.link-name:hover { text-decoration: underline; }

/* 多级部门树 */
.dept-tree { font-size: 14px; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.tree-row:hover { background: #f1f5f9; }
.tree-row.selected, .active-all.selected { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.active-all { font-weight: 600; }
.tree-toggle { width: 18px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 12px; padding: 0; }
.tree-leaf { width: 18px; text-align: center; color: #cbd5e1; }
.tree-label { flex: 1; }
.tree-count { font-size: 11px; color: var(--muted); background: #f1f5f9; border-radius: 99px; padding: 1px 7px; }

/* 通讯录弹窗（宽版） */
.modal-card.wide { max-width: 560px; text-align: left; max-height: 88vh; overflow: auto; }
.detail-grid { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.detail-avatar { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, #a78bfa, #7c3aed); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: 0 0 auto; }
.detail-name { font-size: 18px; font-weight: 700; }
.perm-list { display: flex; flex-direction: column; gap: 8px; }
.perm-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.perm-item:hover { border-color: var(--accent); background: #fafbff; }
.perm-item b { display: block; font-size: 14px; }
.perm-item small, .perm-item span { display: block; font-size: 12px; color: var(--muted); }
.perm-item.enabled { border-color: var(--green); background: var(--green-soft); }
.modal-actions-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }


/* ---------- 表格任务：分页 / 选人 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.cp-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.cp-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.cp-row:last-child { border-bottom: 0; }
.cp-row:hover { background: #f8fafc; }
.cp-row b { font-weight: 600; }
.cp-row small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.cp-row .muted { margin-left: auto; font-size: 12px; }


/* 批量操作条 */
.batch-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.batch-bar label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.batch-bar span { color: var(--muted); }
.batch-bar .btn { margin-left: auto; }
.batch-bar .btn + .btn { margin-left: 0; }
.contact-table th:first-child, .contact-table td:first-child { text-align: center; }


/* ---------- 邮箱 ---------- */
.mail-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.mail-folders { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 12px; }
.mail-folder-title { font-weight: 700; font-size: 14px; padding: 4px 10px 12px; }
.mail-folder { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-size: 14px; text-align: left; color: #475569; }
.mail-folder:hover { background: #f1f5f9; }
.mail-folder.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mail-folder span { margin-left: auto; font-size: 11px; background: #fee2e2; color: #dc2626; border-radius: 99px; padding: 1px 7px; }
.mail-layout .mail-main { min-width: 0; }
.mail-list { display: flex; flex-direction: column; }
.mail-item { display: flex; align-items: flex-start; gap: 10px; padding: 14px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail-item:hover { background: #f8fafc; }
.mail-item.unread { background: #f0f7ff; }
.mail-star { border: 0; background: none; font-size: 18px; color: #cbd5e1; cursor: pointer; padding: 2px; }
.mail-star.on { color: #f59e0b; }
.mail-item-main { flex: 1; min-width: 0; }
.mail-item-top { display: flex; justify-content: space-between; gap: 10px; }
.mail-item-top b { font-size: 14px; }
.mail-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mail-item-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mail-item-preview { font-size: 12px; color: #94a3b8; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item-actions { flex: 0 0 auto; }
.mail-body-content { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 16px; font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 860px) { .mail-layout { grid-template-columns: 1fr; } }


/* 通讯录企业微信风格 */
.wx-tip { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 9px 14px; font-size: 13px; margin-bottom: 12px; }
.wx-tip a { color: #2563eb; text-decoration: none; margin-left: 6px; }
.wx-tip a:hover { text-decoration: underline; }
.dept-cell { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

.hidden { display: none !important; }
