:root {
  --brand: #1e3a8a;
  --brand-dark: #172554;
  --brand-light: #eff4ff;
  --accent: #2563eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f5f7fb;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.site-header {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 28px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.site-header h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: 0.5px; }
.site-header p { margin: 0; opacity: 0.85; font-size: 14px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2::before {
  content: "";
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}

/* 协议正文 —— 参考原 WORD 排版：
   标题居中·黑体；正文宋体·两端对齐·首行缩进2字符·约1.5倍行距 */
.agreement-body {
  max-height: 380px;
  overflow-y: auto;
  padding: 22px 22px 26px;
  background: #fff;
  border: 1px solid #dbe4ff;
  border-radius: 10px;
  scrollbar-width: thin;
}

/* 协议 PDF 嵌入（原样展示管理后台上传的 PDF） */
.agreement-body-pdf {
  padding: 0;
  background: #f5f7fb;
  border: 1px solid #dbe4ff;
  border-radius: 10px;
  overflow: hidden;
}
.agreement-body-pdf .pdf-embed {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
}
.agreement-body-pdf .pdf-fallback {
  display: none;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.agreement-empty {
  padding: 40px 20px;
  text-align: center;
}
.agreement-title {
  margin: 0 0 18px;
  text-align: center;
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", sans-serif; /* 黑体 */
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #1a1a1a;
  line-height: 1.4;
}
.agreement-body p {
  margin: 0 0 12px;
  font-family: "SimSun", "Songti SC", "STSong", serif; /* 宋体 */
  font-size: 15px;
  line-height: 1.8;                       /* 约 1.5 倍行距 */
  text-align: justify;
  text-justify: inter-ideograph;
  text-indent: 2em;                       /* 首行缩进 2 字符 */
  color: #1f2937;
}
.agreement-body p:last-child { margin-bottom: 0; }
.agreement-subhead {
  font-weight: 700 !important;
  color: #111827 !important;
}
.agreement-sign-line {
  margin-top: 20px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 15px;
  color: #1f2937;
}
.agreement-sign-line .sign-label { white-space: nowrap; }
.agreement-sign-line .sign-underline {
  flex: 1;
  min-width: 120px;
  height: 24px;
  border-bottom: 1.5px solid #1f2937;
}

/* 表单 */
.form-row { margin-bottom: 18px; }
.form-row label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-row .hint { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-left: 6px; }
input[type="text"], input[type="password"], input[type="date"] {
  width: 100%;
  padding: 11px 13px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.signature-wrap {
  position: relative;
  border: 2px dashed #b9c6e8;
  border-radius: 10px;
  background: #fafbff;
  overflow: hidden;
}
#signaturePad {
  display: block;
  width: 100%;
  height: 200px;
  touch-action: none;
  cursor: crosshair;
}
.signature-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab4cf;
  font-size: 14px;
  pointer-events: none;
  user-select: none;
}
.signature-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }

/* 按钮 */
.btn {
  appearance: none;
  border: none;
  border-radius: 9px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #eef2ff; color: var(--brand); }
.btn-secondary:hover { background: #e0e7ff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f9fafb; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* 提示条 */
.alert {
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* 成功面板 */
.success-panel { text-align: center; padding: 12px 4px; }
.success-panel .check {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--success); color: #fff; font-size: 30px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}

/* 表格（管理列表） */
.table-wrap { overflow-x: auto; }
table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 680px;
}
table.list th, table.list td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.list th {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
  white-space: nowrap;
}
table.list tbody tr:hover { background: #f9fbff; }
.tag-date { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--text-muted); padding: 32px 0; }

/* 登录 */
.login-card { max-width: 380px; margin: 40px auto; }
.login-card .logo { text-align: center; margin-bottom: 18px; }
.login-card .logo .mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-dark), var(--accent));
  color: #fff; font-size: 26px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.toolbar .who { font-size: 13px; color: var(--text-muted); }
.stat { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.tag-id { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-muted); word-break: break-all; }

/* 批量导出卡片 */
.export-card .export-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.export-card .exp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.export-card .exp-field input[type="date"] { width: 170px; }
#exportMsg { margin-top: 14px; }
#exportMsg:empty { margin-top: 0; }

/* 协议 PDF 版本管理卡片 */
.pdf-card .hint-block {
  font-size: 13px;
  color: var(--text-muted);
  margin: -4px 0 14px;
  line-height: 1.6;
}
.pdf-card .agreement-meta {
  padding: 12px 14px;
  background: var(--brand-light);
  border-radius: 9px;
  margin-bottom: 14px;
  border: 1px solid #dbe4ff;
}
.pdf-card .agreement-meta .hint-block { margin: 0; font-size: 13.5px; color: var(--brand-dark); }
.pdf-card .upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.pdf-card input[type="file"] {
  font-size: 14px;
  color: var(--text);
  padding: 6px 0;
  flex: 1 1 280px;
  min-width: 200px;
}
.editor-msg { font-size: 13.5px; margin-top: 12px; }
.tag-msg {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 7px;
  font-weight: 500;
}
.tag-msg-success { background: #ecfdf5; color: #065f46; }
.tag-msg-error { background: #fef2f2; color: #991b1b; }

/* 签订页：协议内容加载占位 */
.agreement-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
  font-size: 14px;
}

/* 顶部模块：标题 + 登录态 / 改密 / 退出 */
.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.who-top { color: rgba(255, 255, 255, 0.9); font-size: 14px; }
.top-actions .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  background: transparent;
}
.top-actions .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* 批量操作工具条 */
.batch-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.select-all { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.col-check { width: 36px; text-align: center; }
.col-check input { width: 16px; height: 16px; cursor: pointer; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pg {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.pg:hover:not(:disabled) { background: #eff4ff; border-color: var(--accent); }
.pg:disabled { opacity: 0.45; cursor: not-allowed; }
.pg-cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.pg-cur:hover { background: var(--accent); }
.pg-info { margin-left: 8px; font-size: 13px; color: var(--text-muted); }

/* 修改密码弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
  padding: 24px;
}
.modal h3 { margin: 0 0 14px; font-size: 17px; color: var(--brand-dark); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

@media (max-width: 600px) {
  .page { padding: 16px 12px 48px; }
  .site-header { padding: 22px 16px; }
  .site-header h1 { font-size: 19px; }
  .card { padding: 18px; }
  .agreement-body { max-height: 280px; }
  .agreement-body-pdf .pdf-embed { height: 460px; }
  .btn { padding: 11px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
