/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.05);
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-doc: "SimSun", "Songti SC", serif;
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 17px;
  color: var(--primary);
  letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 2px 6px rgba(249,115,22,0.12);
}
.sidebar-brand .logo {
  height: 40px;         /* PNG 已裁掉留白（138×60，宽高比 2.3），40px 高时宽 92px，视觉放大 2.3 倍 */
  width: auto;
  max-width: calc(100% - 40px);   /* 防止超出侧边栏宽度（留 20px 左右 padding） */
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
}
.sidebar-menu { padding: 12px 10px; flex: 1; overflow-y: auto; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 2px;
}
.menu-item:hover { background: var(--primary-light); color: var(--primary); }
.menu-item.active { background: var(--primary); color: #fff; }
.menu-item .icon { font-size: 18px; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
}

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-developer {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.content { padding: 24px; flex: 1; }

/* ===== Views ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border-dark); }
.btn-secondary:hover { background: var(--bg); border-color: var(--text-tertiary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); }
.btn-danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #f87171; }
.btn-ghost { color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-draft { background: #f1f5f9; color: var(--text-secondary); }
.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-signed { background: var(--success-light); color: #15803d; }
.badge-expired { background: #fee2e2; color: #b91c1c; }
.badge-danger { background: var(--danger-light); color: #991b1b; }

/* ===== Dashboard ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-info .stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-info .stat-label { font-size: 13px; color: var(--text-secondary); }

.dash-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 20px;
}
.ov-item {
  background: var(--card);
  border: 1px solid var(--border-tertiary, #eef0f3);
  border-radius: var(--radius, 12px);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ov-val { font-size: 20px; font-weight: 700; color: var(--text-primary, #1f2937); }
.ov-lab { font-size: 12px; color: var(--text-secondary); }
.ov-warn .ov-val { color: #dc2626; }
@media (max-width: 768px) {
  .dash-overview { grid-template-columns: repeat(2, 1fr); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 700; }

/* ===== Tables ===== */
.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.contract-title-cell { font-weight: 600; color: var(--text); }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 15px; margin-bottom: 16px; }

/* ===== Templates Grid ===== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.template-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.template-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.template-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.template-name { font-size: 16px; font-weight: 700; }
.template-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.template-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.template-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--text-secondary);
}

/* ===== Editor ===== */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.editor-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-field label .req { color: var(--danger); margin-left: 2px; }
.form-field input,
.form-field select,
.form-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  background: #fff;
  color: var(--text);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-field textarea { resize: vertical; min-height: 60px; }
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== Document Preview ===== */
.doc-preview-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}
.doc-preview-panel .panel-header {
  font-size: 15px; font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.document {
  font-family: var(--font-doc);
  font-size: 14px;
  line-height: 2;
  color: #1a1a1a;
}
.document h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin: 12px 0 24px;
  letter-spacing: 4px;
}
.document h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 16px 0 8px;
}
.document p { margin-bottom: 6px; text-indent: 2em; }
.document .no-indent { text-indent: 0; }
.document .signature-block {
  display: flex;
  justify-content: space-around;
  margin-top: 48px;
  padding-top: 24px;
}
.document .sig-party { text-align: center; }
.document .sig-line {
  border-bottom: 1px solid #333;
  width: 220px;
  height: 160px;
  margin: 8px auto 4px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.document .sig-line img { max-width: 200px; max-height: 155px; object-fit: contain; }
.document .sig-label { font-size: 13px; color: #555; }

/* ===== Full Document (preview/sign/signed views) ===== */
.doc-full {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  padding: 48px 56px;
  min-height: 600px;
}
.doc-full.standalone { box-shadow: var(--shadow-lg); }

.doc-toolbar {
  max-width: 800px;
  margin: 0 auto 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.doc-toolbar-right { display: inline-flex; gap: 8px; align-items: center; }

/* ===== Signature Pad ===== */
.sign-layout {
  max-width: 800px;
  margin: 0 auto;
}
.sign-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}
.sign-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.sign-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sign-summary-item .label { font-size: 12px; color: var(--text-tertiary); }
.sign-summary-item .value { font-size: 14px; font-weight: 600; }

.signature-section {
  margin-top: 24px;
}
.signature-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}
.signature-pad-wrapper {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  background: #fafbfc;
  position: relative;
  overflow: hidden;
}
#signature-pad {
  display: block;
  width: 100%;
  height: 220px;
  cursor: crosshair;
  touch-action: none;
}
.signature-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-tertiary);
  font-size: 15px;
  pointer-events: none;
  text-align: center;
}
.signature-hint.hidden { display: none; }
.signature-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.seal-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  background: #fafbfc;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all .2s;
}
.seal-zone:hover {
  background: #fff7ed;
  border-color: var(--primary);
}
.seal-zone.sealed {
  border-style: solid;
  border-color: #fecaca;
  background: #fff;
  cursor: default;
}
.seal-hint {
  color: var(--text-tertiary);
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  pointer-events: none;
}
.seal-hint-icon { font-size: 32px; }
.seal-preview {
  width: 190px;
  height: 190px;
  object-fit: contain;
  animation: seal-in .38s cubic-bezier(.34,1.56,.64,1);
}
@keyframes seal-in {
  0% { transform: scale(1.5) rotate(-12deg); opacity: 0; }
  100% { transform: scale(1) rotate(-2deg); opacity: 1; }
}
.agreement-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 20px 0;
}
.agreement-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.sign-bottom-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* ===== Signed View ===== */
.signed-banner {
  max-width: 800px;
  margin: 0 auto 20px;
  background: var(--success-light);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.signed-banner .icon { font-size: 28px; }
.signed-banner .text { font-size: 14px; color: #15803d; }
.signed-banner .text strong { font-size: 16px; display: block; margin-bottom: 2px; }

.signed-meta {
  max-width: 800px;
  margin: 0 auto 16px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}
.signed-meta span { display: flex; align-items: center; gap: 4px; }

.doc-watermark {
  position: relative;
}
.doc-watermark::after {
  content: '已签署';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 72px;
  font-weight: 700;
  color: rgba(22, 163, 74, .08);
  letter-spacing: 12px;
  pointer-events: none;
  z-index: 0;
}
.doc-watermark .document { position: relative; z-index: 1; }

/* ===== Archive ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-chip {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-dark);
  background: #fff;
  color: var(--text-secondary);
  transition: all .15s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.archive-search-row { margin-bottom: 12px; }
.archive-search-input {
  width: 100%;
  max-width: 420px;
  padding: 8px 14px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
}
.archive-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.archive-toolbar,
.trash-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.archive-select-label,
.trash-select-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.archive-selected-count,
.trash-selected-count {
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: auto;
}
.archive-row-checkbox,
.trash-row-checkbox,
#archive-select-all,
#archive-select-all-header,
#trash-select-all,
#trash-select-all-header {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Sign Flow (签署中心) ===== */
.sign-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.sign-flow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 6px 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--border);
}
.sign-flow-step .dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  background: #e2e8f0;
  color: var(--text-secondary);
}
.sign-flow-step.done { color: var(--success); border-color: #bbf7d0; background: #f0fdf4; }
.sign-flow-step.done .dot { background: var(--success); color: #fff; }
.sign-flow-step.active { color: var(--primary); border-color: var(--primary); }
.sign-flow-step.active .dot { background: var(--primary); color: #fff; }
.sign-flow-arrow { color: var(--text-tertiary); font-size: 14px; }

.sign-tip {
  font-size: 13px;
  color: var(--text-secondary);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 10px 0 14px;
  line-height: 1.7;
}
.sign-tip b { color: var(--primary); }

.sign-demo-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.demo-point {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.demo-point span {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.signed-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--success-light);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 14px 18px;
  color: #15803d;
  font-size: 14px;
  font-weight: 600;
}
.signed-inline img {
  max-height: 80px;
  max-width: 160px;
  object-fit: contain;
}

/* ===== Student Sign (微信端模拟) ===== */
.student-page { max-width: 900px; margin: 0 auto; }
.student-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.student-header-info { display: flex; align-items: center; gap: 16px; }
.student-header-text { display: flex; flex-direction: column; }
.student-header-text strong { font-size: 16px; }
.student-header-text span { font-size: 12px; color: var(--text-tertiary); }

.student-step-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}
.student-step {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  white-space: nowrap;
  transition: all .2s;
}
.student-step.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.student-step.done { color: var(--success); border-color: #bbf7d0; }
.student-step-line { width: 14px; height: 2px; background: var(--border-dark); }

/* ===== Phone Mockup ===== */
.phone-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 0 40px;
}
.phone {
  width: 380px;
  height: 740px;
  background: #ededed;
  border-radius: 46px;
  border: 10px solid #1e293b;
  box-shadow: 0 24px 48px rgba(0,0,0,.18), 0 8px 16px rgba(0,0,0,.1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.phone-notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 150px; height: 30px;
  background: #1e293b;
  border-radius: 0 0 20px 20px;
  z-index: 20;
}
.phone-step { display: none; flex: 1; flex-direction: column; min-height: 0; }
.phone-step.active { display: flex; }

/* 微信基础元素 */
.wx-header {
  background: #ededed;
  color: #111;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 38px 16px 10px;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.wx-back { font-size: 18px; cursor: pointer; color: #111; }
.wx-nav {
  background: #ededed;
  padding: 38px 12px 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
}
.wx-nav .wx-back { position: absolute; left: 14px; top: 40px; }

.wx-chat-list { background: #ededed; flex: 1; overflow-y: auto; padding-top: 4px; }
.wx-msg-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background .15s;
}
.wx-msg-item:hover { background: #f7f7f7; }
.wx-msg-avatar {
  width: 46px; height: 46px;
  border-radius: 8px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  flex-shrink: 0;
}
.wx-msg-body { flex: 1; min-width: 0; }
.wx-msg-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.wx-msg-preview {
  font-size: 13px; color: #999;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wx-msg-time { font-size: 12px; color: #bbb; flex-shrink: 0; align-self: flex-start; margin-top: 4px; }

/* 微信内容页 */
.wx-content {
  flex: 1;
  overflow-y: auto;
  background: #ededed;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wx-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.wx-card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wx-summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px dashed #f0f0f0;
}
.wx-summary-item:last-child { border-bottom: none; }
.wx-summary-item .k { color: #888; flex-shrink: 0; }
.wx-summary-item .v { font-weight: 600; text-align: right; }

.wx-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.wx-btn-green { background: #07c160; color: #fff; }
.wx-btn-green:hover { filter: brightness(.94); }
.wx-btn-green:disabled { opacity: .5; cursor: not-allowed; }
.wx-btn-outline { background: #fff; color: #07c160; border: 1px solid #07c160; }
.wx-btn-white { background: #fff; color: #576b95; }
.wx-btn:disabled { opacity: .5; cursor: not-allowed; }
.wx-btn-wrap { display: flex; flex-direction: column; gap: 10px; }

/* 人脸识别 */
.face-scan {
  width: 210px;
  height: 230px;
  margin: 8px auto;
  position: relative;
}
.face-scan-line {
  animation: faceScanMove 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes faceScanMove {
  0% { transform: translateY(0); opacity: 1; }
  45% { transform: translateY(150px); opacity: .9; }
  55% { transform: translateY(150px); opacity: .9; }
  100% { transform: translateY(0); opacity: 1; }
}
.face-scan.success .face-scan-line { animation: none; opacity: 0; }
.face-scan.success ellipse { stroke: #07c160; }
.face-scan.success path { stroke: #07c160; }
.face-status {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  margin-bottom: 10px;
}
.face-result {
  background: var(--success-light);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: #15803d;
  line-height: 1.8;
}
.face-result .r-label { color: #6b7280; font-size: 12px; }
.face-result.hidden { display: none; }

/* 短信验证码 */
.hidden { display: none !important; }
.sms-tip { font-size: 13px; color: #6b7280; text-align: center; margin-bottom: 6px; }
.sms-phone { font-size: 16px; font-weight: 700; color: #111827; text-align: center; margin-bottom: 12px; letter-spacing: .5px; }
.sms-input-row { display: flex; gap: 7px; justify-content: center; margin: 14px 0 12px; }
.sms-input {
  width: 40px; height: 46px; text-align: center; font-size: 22px; font-weight: 700;
  border: 1.5px solid #d1d5db; border-radius: 8px; outline: none;
  background: #f9fafb; color: #111827; caret-color: #07c160;
}
.sms-input:focus { border-color: #07c160; background: #fff; box-shadow: 0 0 0 2px rgba(7,193,96,.15); }
.sms-input:disabled { background: #f3f4f6; color: #9ca3af; }
.sms-send-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.sms-send-btn {
  border: none; background: none; color: #07c160; font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 2px 4px;
}
.sms-send-btn:disabled { color: #9ca3af; cursor: not-allowed; }
.sms-result {
  text-align: center; color: #15803d; font-size: 14px; font-weight: 600;
  padding: 8px 0 2px;
}
.sms-result.hidden { display: none; }

/* 学员签名 */
.student-sig-wrap {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafbfc;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
#student-sig-pad {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: none;
}
.student-sig-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-tertiary);
  font-size: 14px;
  pointer-events: none;
  text-align: center;
}
.student-sig-hint.hidden { display: none; }
.student-agree {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #555;
  margin-bottom: 12px;
}
.student-agree input { width: 16px; height: 16px; accent-color: #07c160; }

/* 完成页 */
.done-page { align-items: center; justify-content: center; }
.done-check {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: #07c160;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  margin: 30px auto 16px;
  animation: popIn .4s ease;
}
@keyframes popIn {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.done-title { text-align: center; font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.done-sub { text-align: center; font-size: 13px; color: #888; margin-bottom: 18px; }
.cert-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  width: 100%;
}
.cert-card-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cert-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #f0f0f0;
}
.cert-item:last-child { border-bottom: none; }
.cert-item .k { color: #888; }
.cert-item .v { font-weight: 600; text-align: right; }
.cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #07c160;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 600;
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}
.modal-close {
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-actions { display: inline-flex; align-items: center; gap: 12px; }
.modal-close:hover { color: var(--text); }
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  background: #fafbfc;
}

/* ===== 回收站 ===== */
#view-trash .table-card { margin-top: 0; }

/* ===== 确认弹窗 ===== */
.confirm-modal { max-width: 420px; }
.confirm-modal .modal-header { background: #fff; }
.confirm-message {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  padding: 8px 0;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .editor-layout { grid-template-columns: 1fr; }
  .templates-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .doc-full { padding: 24px; }
}
@media print {
  .sidebar, .topbar, .doc-toolbar, .signed-banner, .signed-meta { display: none !important; }
  .content { padding: 0; }
  .doc-full { box-shadow: none; max-width: 100%; }
}

/* ===== Settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.settings-wide { grid-column: 1 / -1; }
.settings-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.settings-info { display: flex; flex-direction: column; gap: 10px; }
.settings-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}
.settings-row b { color: var(--text); font-weight: 600; }
.settings-status {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.settings-status.bound { color: var(--success); background: var(--success-light); }
.settings-card .form-row { margin-bottom: 12px; }
.settings-card .form-row label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.settings-card .code-row { display: flex; gap: 10px; align-items: flex-end; }
.settings-card .code-row input { flex: 1; }
.settings-card .code-row button { flex-shrink: 0; white-space: nowrap; }
.settings-card .btn { margin-top: 4px; }
#settings-audit-body td { font-size: 13px; padding: 10px 12px; }
#settings-audit-body .empty-td { text-align: center; color: var(--text-tertiary); padding: 24px; }
@media (max-width: 768px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-wide { grid-column: auto; }
  .settings-card .code-row { flex-direction: column; align-items: stretch; }
}

/* ===== 发起签署表单 ===== */
.send-invite-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.send-invite-form .form-row { margin-bottom: 0; }
#invite-phone {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  letter-spacing: 1px;
}
#invite-phone:focus { border-color: var(--primary); }

/* ===== 签署邀请已发送 ===== */
.sent-page { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.sent-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  text-align: center;
}
.sent-icon { font-size: 52px; margin-bottom: 10px; }
.sent-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.sent-sub { color: var(--text-secondary); font-size: 14px; margin-top: 6px; }
.sent-contract-info {
  margin: 24px auto 18px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 8px 18px;
  max-width: 480px;
  text-align: left;
}
.sent-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
  gap: 12px;
}
.sent-info-row:last-child { border-bottom: none; }
.sent-info-row span { color: var(--text-secondary); }
.sent-info-row b { color: var(--text-primary); word-break: break-all; text-align: right; }
.sent-sms-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  text-align: left;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.sent-sms-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}
.sent-sms-body {
  font-size: 13px;
  color: #78350f;
  line-height: 1.8;
  word-break: break-all;
}
.sent-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 480px;
  margin: 0 auto 20px;
  text-align: left;
}
.sent-link-label { font-size: 13px; color: var(--text-secondary); flex-shrink: 0; }
.sent-link-input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  background: #f8fafc;
  font-family: monospace;
  outline: none;
}
.sent-actions { max-width: 480px; margin: 0 auto; }
.sent-actions .btn { margin-bottom: 10px; }
.sent-tip {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.8;
  margin-top: 18px;
  text-align: center;
}
.sent-base-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 480px;
  margin: 0 auto 12px;
  text-align: left;
}
.sent-base-row .sent-link-input { background: #fff; color: var(--text-primary); }

/* 管理端登录锁定层 */
.admin-lock {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
}
.admin-lock.active { display: flex; }
.admin-lock-box {
  width: 340px;
  max-width: 92vw;
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.admin-lock-icon { font-size: 34px; margin-bottom: 10px; }
.admin-lock-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.admin-lock-logo {
  height: 56px;       /* 横排版放大 */
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.10));
}
.admin-lock-brand span { font-size: 17px; font-weight: 700; color: var(--text-primary); letter-spacing: 1px; }
.admin-lock-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.admin-lock-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.admin-lock-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: 2px;
}
.admin-lock-input:focus { border-color: var(--primary, #2563eb); }
.admin-lock-box .btn { width: 100%; }
.admin-lock-err { font-size: 12px; color: #dc2626; margin-top: 10px; min-height: 16px; }
.admin-lock-tip { font-size: 11px; color: var(--text-tertiary); margin-top: 12px; }

/* ============================================================
   课程选择页（按课程分类创建合同）
   ============================================================ */
.course-selector-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  min-height: 540px;
}
.course-categories {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: flex-start;
}
.course-category-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all .15s;
}
.course-category-item:hover { color: var(--primary); background: #fff7ed; }
.course-category-item.active {
  color: var(--primary);
  background: #fff7ed;
  border-left-color: var(--primary);
  font-weight: 600;
}
.course-category-icon { font-size: 18px; }
.course-category-name { flex: 1; }
.course-category-count { font-size: 11px; color: var(--text-tertiary); }
.course-category-item.active .course-category-count { color: var(--primary); }

.course-list-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-height: 540px;
}
.course-list-header {
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.course-list-header .course-count {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: normal;
}
.course-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.course-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
}
.course-item:hover {
  background: #fff7ed;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.12);
}
.course-item-name { flex: 1; font-size: 14px; color: var(--text-primary); }
.course-item-arrow { color: var(--text-tertiary); font-size: 14px; transition: transform .15s; }
.course-item:hover .course-item-arrow { color: var(--primary); transform: translateX(2px); }

.course-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.course-badge.ready   { background: #dcfce7; color: #16a34a; }
.course-badge.pending { background: #fff7ed; color: #c2410c; }

.course-item.course-item-pending { opacity: 0.85; }
.course-item.course-item-pending:hover { opacity: 1; }

/* ============================================================
   合同模板待上传页
   ============================================================ */
.pending-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 540px;
}
.pending-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(249, 115, 22, 0.10);
  padding: 36px 40px;
  max-width: 640px;
  width: 100%;
  text-align: center;
  border-top: 6px solid #f97316;
}
.pending-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  color: #c2410c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  animation: pending-pulse 2.4s ease-in-out infinite;
}
@keyframes pending-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.30); }
  50%      { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(249, 115, 22, 0); }
}
.pending-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 22px;
  letter-spacing: 1px;
}
.pending-course-row, .pending-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.pending-status-row { border-bottom: none; }
.pending-label { color: var(--text-tertiary); font-size: 13px; }
.pending-value { color: var(--text-primary); font-weight: 600; }
.pending-course-name { color: #c2410c; font-size: 16px; font-weight: 700; }

.pending-tip {
  text-align: left;
  margin: 24px 0 18px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 16px 18px;
}
.pending-tip-title { font-size: 14px; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.pending-tip-body { font-size: 13px; color: #78350f; line-height: 1.8; }
.pending-tip-body ol { margin: 8px 0 8px 18px; padding: 0; }
.pending-tip-body li { margin: 4px 0; }
.pending-tip-body b { color: #451a03; }

.pending-note {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
  min-height: 18px;
  font-style: italic;
}
.pending-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 小屏响应 */
@media (max-width: 768px) {
  .course-selector-layout { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .pending-card { padding: 26px 22px; }
}

/* ===== 待上传页 · 直接上传合同 ===== */
.pending-card-wide { max-width: 760px; }
.pending-upload {
  margin: 26px 0 10px;
  text-align: left;
  background: #fffdf7;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.pending-upload-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.pu-tab {
  flex: 1;
  padding: 10px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.pu-tab:hover { border-color: #fdba74; color: #c2410c; }
.pu-tab.active {
  background: linear-gradient(135deg, #f97316, #fb923c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, .25);
}
.pu-dropzone {
  border: 2px dashed #fdba74;
  border-radius: 12px;
  background: #fff7ed;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.pu-dropzone:hover { border-color: #f97316; background: #ffedd5; }
.pu-dz-icon { font-size: 34px; margin-bottom: 6px; }
.pu-dz-text { font-size: 15px; font-weight: 600; color: #9a3412; }
.pu-dz-sub { font-size: 12px; color: #b45309; margin-top: 4px; }
.pu-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.pu-preview img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.pu-file-name {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 6px 0 0;
  text-align: center;
  word-break: break-all;
}
.pu-submit {
  width: 100%;
  margin-top: 14px;
}
.pu-text-tip {
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  line-height: 1.7;
}
.pu-text-tip code {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
}
.pu-text-input {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.9;
  font-family: inherit;
  resize: vertical;
  background: var(--card);
  color: var(--text-primary);
}
.pu-text-input:focus { outline: none; border-color: #f97316; box-shadow: 0 0 0 3px rgba(249,115,22,.12); }
.pu-status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 18px;
}
.pu-status.ok { color: #16a34a; font-weight: 600; }
.pu-status.err { color: #dc2626; font-weight: 600; }

/* ===== PDF 上传 ===== */
.pu-pdf-loading {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  background: #fff7ed;
  border: 1px dashed #fdba74;
  border-radius: 12px;
}
.pu-pdf-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.pu-pdf-page {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.pu-pdf-page img {
  width: 100%;
  height: auto;
  display: block;
}
.pu-pdf-page-no {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(249,115,22,.92);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pu-pdf-reset-row { margin-top: 10px; text-align: center; }

/* ===== 图片合同正文 ===== */
.document .doc-image-contract { width: 100%; }
.document .doc-image-wrap {
  width: 100%;
  text-align: center;
  margin: 0 0 6px;
}
/* 多页 PDF 合同：页与页之间留出分页间距 */
.document .doc-image-contract .doc-image-wrap + .doc-image-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #e2e8f0;
}
.document .doc-image-full {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
.document .doc-text-contract { line-height: 1.9; }
.document .doc-text-contract .indent { text-indent: 2em; }
.document .doc-text-contract p { margin: 6px 0; }

@media print {
  .document .doc-image-wrap { break-inside: avoid; }
  .document .doc-image-full { max-width: 100%; }
}
/* ===== 自定义合同模板板块 ===== */
.custom-tpl-desc {
  background: #f5f3ff;
  border: 1px solid #ede9fe;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #6d28d9;
  margin-bottom: 16px;
  line-height: 1.7;
}
.cu-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.cu-name-row label {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}
.cu-name-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.cu-name-row input:focus { border-color: var(--primary); }
.custom-tpl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.custom-tpl-header b { color: var(--primary); font-size: 16px; }
.custom-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.custom-tpl-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .15s;
}
.custom-tpl-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(99,102,241,.1);
  transform: translateY(-1px);
}
.custom-tpl-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.custom-tpl-body { flex: 1; min-width: 0; }
.custom-tpl-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-tpl-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 3px;
}
.custom-tpl-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .custom-tpl-card { flex-wrap: wrap; }
  .custom-tpl-actions { width: 100%; justify-content: flex-end; }
}

/* ===== 橙就专属合同（文本型模板库） ===== */
.ex-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid #d97706;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.ex-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.ex-card-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}
.ex-card-main { flex: 1; min-width: 0; }
.ex-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.ex-card-course { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.ex-card-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.6; }
.ex-card-tags { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ex-card-tag {
  font-size: 12px; padding: 2px 10px; border-radius: 999px;
  background: #fef3c7; color: #b45309;
}
.ex-card-tag.gray { background: #f1f5f9; color: #64748b; }
.ex-card-actions { flex-shrink: 0; }

.ex-create-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.ex-form-panel, .ex-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ex-panel-head {
  padding: 14px 20px; font-size: 15px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #fefce8, #fffbeb);
}
.ex-panel-head .ex-hint { font-size: 12px; font-weight: 400; color: var(--text-tertiary); margin-left: 8px; }
.ex-panel-body { padding: 18px 20px; }
.ex-form-actions { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: #fafafa; }
.ex-preview-sticky { position: sticky; top: 16px; }

.ex-preview-doc {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 22px 20px; font-family: var(--font-doc); font-size: 13px; line-height: 2; color: #1a1a1a;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.02);
}
.ex-preview-doc h3 { text-align: center; font-size: 16px; font-weight: 700; margin: 6px 0 14px; letter-spacing: 2px; }
.ex-preview-doc .ex-doc-tip { font-size: 11px; color: #64748b; text-align: center; margin-bottom: 10px; }

/* 报名表表格（预览 & 合同正文共用）：4 个独立分段，避免 mobile 窄屏挤压乱码 */
.doc-ex-cover { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.doc-ex-table { width: 100%; min-width: 580px; border-collapse: collapse; table-layout: fixed; margin-bottom: 8px; font-size: 13px; }
.doc-ex-table td {
  border: 1px solid #94a3b8; padding: 6px 8px; font-size: 13px;
  vertical-align: middle; overflow-wrap: anywhere; word-break: keep-all;
}
.doc-ex-table td.ex-lab { width: 9%; background: #f8fafc; text-align: center; font-weight: 600; color: #334155; }
.doc-ex-table td.ex-fill { color: #0f172a; }
.doc-ex-table td.ex-lab-vert {
  width: 5%; min-width: 32px; background: #f8fafc; text-align: center;
  font-weight: 600; color: #334155;
  /* 字符正立显示，避免 mobile 窄屏被截断变形 */
  writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 4px;
}
.doc-ex-table td.ex-sec-title { background: #fef9c3; text-align: center; font-weight: 700; color: #92400e; font-size: 13px; }
/* 教材领取 / 备注 分段内容样式 */
.doc-ex-table .ex-book-line, .doc-ex-table .ex-note-line { padding: 1px 0; line-height: 1.6; }
.doc-ex-table .ex-books-prefix, .doc-ex-table .ex-notes-header { font-weight: 600; margin-bottom: 4px; }

/* ========== Mobile (≤600px) form 视图：彻底避免横滑，PDF 字段顺序保持 ========== */
@media (max-width: 600px) {
  .doc-ex-cover { overflow-x: visible; }
  .doc-ex-table,
  .doc-ex-table tbody,
  .doc-ex-table tr,
  .doc-ex-table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  .doc-ex-table { min-width: 0; border: 0; }
  /* 行之间留空，做卡片分隔 */
  .doc-ex-table tr { border: 1px solid #cbd5e1; border-radius: 6px; margin-bottom: 6px; padding: 0; background: #fff; }
  /* 学员填写 / 班主任填写 / 教材领取 / 备注 — 当成小节标题 */
  .doc-ex-table td.ex-lab-vert {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    letter-spacing: normal !important;
    background: #475569 !important;
    color: #fff !important;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 10px !important;
    border-radius: 6px 6px 0 0;
  }
  /* 黄底标题行（"以下部分由班主任老师填写..."） */
  .doc-ex-table td.ex-sec-title {
    background: #fef9c3 !important;
    color: #92400e !important;
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 10px;
    border-left: 0; border-right: 0; border-top: 0;
  }
  /* 字段 label 单元格：浅灰底，居中 */
  .doc-ex-table td.ex-lab {
    background: #f1f5f9 !important;
    width: 32% !important;
    text-align: center;
    font-weight: 600;
    color: #475569;
    padding: 6px 8px;
    border-left: 0; border-right: 0; border-top: 0;
    display: inline-block !important;
  }
  /* 字段 value 单元格：靠左 */
  .doc-ex-table td.ex-fill {
    width: 66% !important;
    text-align: left;
    padding: 6px 8px;
    border-left: 0; border-right: 0; border-top: 0;
    display: inline-block !important;
  }
  /* 教材领取 / 备注 里的多行内容 */
  .doc-ex-table .ex-book-line, .doc-ex-table .ex-note-line { padding: 2px 0; line-height: 1.7; }
}

/* 封面：报名表 = 第一页，12 大条款 = 第二页起（浏览器打印；html2canvas→jsPDF 走 A4 切图同样有效） */
.document .doc-ex-cover,
.ex-preview-doc .doc-ex-cover { page-break-after: always; page-break-inside: avoid; break-after: page; break-inside: avoid; }
.document .doc-ex-table { page-break-after: always; page-break-inside: avoid; break-after: page; break-inside: avoid; }

/* 合同正文条款 */
.doc-ex-clauses { margin-top: 22px; }
.doc-ex-clauses h3 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; text-indent: 0; }
.doc-ex-clauses p { text-indent: 2em; margin-bottom: 4px; }
.doc-ex-account-note { font-size: 12px; color: #475569; margin-top: 14px; }
.doc-ex-sign-row { margin-top: 40px; display: flex; justify-content: space-between; font-weight: 700; }

@media (max-width: 900px) {
  .ex-create-layout { grid-template-columns: 1fr; }
  .ex-preview-sticky { position: static; }
}

/* ===== 微信分享签字弹窗 ===== */
.share-body { display: flex; flex-direction: column; align-items: center; padding: 24px 20px; }
.share-qr-wrap {
  width: 240px; height: 240px; padding: 10px; border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center;
}
.share-qr-wrap img, .share-qr-wrap canvas { max-width: 100%; max-height: 100%; }
.share-tip { font-size: 13px; color: var(--text-secondary, #6b7280); margin: 14px 0 18px; text-align: center; }
.share-body .form-row { width: 100%; max-width: 420px; }
.share-body .form-input { font-size: 13px; }
.share-actions { margin: 12px 0 4px; width: 100%; max-width: 420px; }
.share-actions .btn { width: 100%; }
.share-wx-tip { font-size: 12px; color: #9ca3af; margin-top: 10px; text-align: center; line-height: 1.6; }

/* ===== Settings 描述文字 ===== */
.settings-desc { font-size: 13px; color: var(--text-secondary, #6b7280); line-height: 1.6; margin-bottom: 12px; }

/* ===== 恢复备份手机验证弹窗 ===== */
.restore-modal { max-width: 440px; }
.restore-modal .modal-body { padding: 22px 22px 8px; }
.restore-warn { font-size: 13px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 12px 14px; line-height: 1.7; margin-bottom: 18px; }
.restore-warn strong { color: #92400e; }
.restore-modal .form-row { display: block; margin-bottom: 16px; }
.restore-modal .form-row label { display: block; font-size: 13px; color: var(--text-secondary, #6b7280); margin-bottom: 6px; }
.restore-modal .form-input { width: 100%; box-sizing: border-box; }
.restore-modal .code-row { display: flex; gap: 10px; align-items: flex-end; }
.restore-modal .code-row input { flex: 1; }
.restore-modal .code-row button { flex-shrink: 0; white-space: nowrap; }
.restore-msg { font-size: 13px; min-height: 18px; margin: 2px 0 10px; line-height: 1.5; }
.restore-msg.error { color: #ef4444; }
.restore-msg.success { color: #16a34a; }


/* ICP 备案号（工信部要求网站底部展示，并链接至备案系统） */
.admin-lock-icp {
  margin-top: 14px;
  text-align: center;
  font-size: 11.5px;
  color: #9ca3af;
  line-height: 1.6;
}
.admin-lock-icp a { color: #9ca3af; text-decoration: none; }
.admin-lock-icp a:hover { color: #6b7280; text-decoration: underline; }

/* 官网首页底部：客服联系方式（投诉举报渠道公示，公安备案要求） */
.admin-lock-contact {
  margin-top: 6px;
  text-align: center;
  font-size: 11.5px;
  color: #9ca3af;
  line-height: 1.6;
}
.admin-lock-contact a { color: #9ca3af; text-decoration: none; }
.admin-lock-contact a:hover { color: #6b7280; text-decoration: underline; }
.admin-lock-contact .c-dot { margin: 0 6px; color: #d1d5db; }

/* 管理端侧边栏底部：备案号 + 客服渠道（工信部/公安部要求公示） */
.sidebar-icp {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  line-height: 1.75;
  color: var(--text-tertiary);
}
.sidebar-icp a { color: inherit; text-decoration: none; }
.sidebar-icp a:hover { text-decoration: underline; }
