* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #eef1f4;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
button, select, input, textarea { font: inherit; }
button {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { border-color: #9ca3af; }
button.primary { background: #0f766e; color: #fff; border-color: #0f766e; }
button.danger { color: #b91c1c; }
button.small { padding: 3px 8px; font-size: 13px; }
select, input[type="text"], input[type="password"] {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}
textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px;
  resize: vertical;
  background: #fff;
}
.muted { color: #6b7280; font-size: 13px; }
.sep { display: inline-block; width: 1px; height: 22px; background: #d1d5db; margin: 0 4px; vertical-align: middle; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #111827;
  color: #fff;
  flex-wrap: wrap;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.tools select { background: #fff; color: #1f2937; }

/* 主区 */
main { display: flex; gap: 20px; padding: 20px; align-items: flex-start; }
.editor { flex: 1; min-width: 320px; max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.preview-wrap { flex: 1; min-width: 0; overflow-x: auto; }
.preview-scale { transform-origin: top left; }
.preview-tip { color: #6b7280; font-size: 13px; text-align: center; }

/* 编辑器卡片 */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.card h4 { margin: 14px 0 8px; font-size: 14px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 4px; }
.field input[type="text"], .field input[type="password"] { width: 100%; }
.row { display: flex; gap: 10px; }
.row .field { flex: 1; }
.item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 12px; background: #f9fafb; }
.item-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.ai-note { font-size: 13px; color: #0f766e; }
.ai-error { font-size: 13px; color: #b91c1c; }
.suggestion {
  margin-top: 8px;
  border: 1px dashed #0f766e;
  border-radius: 8px;
  padding: 10px;
  background: #f0fdfa;
  font-size: 14px;
  white-space: pre-wrap;
}
.suggestion .sug-actions { display: flex; gap: 6px; margin-top: 8px; }

/* A4 预览 */
.sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 16mm 15mm;
  background: #fff;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
  font-size: 13.5px;
  line-height: 1.6;
  color: #1f2937;
  word-break: break-word;
}
.sheet h2 { margin: 0; }
.sheet .sec { margin-top: 14px; break-inside: avoid; }
.sheet .sec h3 { margin: 0 0 6px; font-size: 15px; }
.sheet .item-head { display: flex; justify-content: space-between; gap: 12px; }
.sheet .item-head b { font-size: 14px; }
.sheet .dates { color: #6b7280; white-space: nowrap; font-size: 12.5px; }
.sheet .desc { white-space: pre-wrap; margin: 2px 0 10px; }
.sheet .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet .tag { border: 1px solid #d1d5db; border-radius: 999px; padding: 1px 10px; font-size: 12.5px; }

/* 版式：经典单栏 */
.tpl-classic .pv-name { text-align: center; font-size: 26px; }
.tpl-classic .pv-title { text-align: center; color: #4b5563; margin-top: 2px; }
.tpl-classic .pv-contact { text-align: center; color: #6b7280; font-size: 12.5px; margin-top: 2px; }
.tpl-classic .sec h3 { border-bottom: 2px solid #1f2937; padding-bottom: 3px; }

/* 版式：极简单栏 */
.tpl-minimal .pv-name { font-size: 30px; font-weight: 300; letter-spacing: 2px; }
.tpl-minimal .pv-title { color: #6b7280; margin-top: 2px; }
.tpl-minimal .pv-contact { color: #9ca3af; font-size: 12.5px; margin-top: 2px; }
.tpl-minimal .sec h3 { color: #9ca3af; font-size: 12px; letter-spacing: 3px; border-bottom: 1px solid #e5e7eb; padding-bottom: 3px; }

/* 版式：左侧栏 */
.tpl-sidebar { display: grid; grid-template-columns: 58mm 1fr; padding: 0; }
.tpl-sidebar .pv-side { background: #1e293b; color: #e2e8f0; padding: 14mm 7mm; }
.tpl-sidebar .pv-side h3 { color: #fff; border-bottom: 1px solid #475569; padding-bottom: 4px; font-size: 13px; }
.tpl-sidebar .pv-side .tag { border-color: #475569; color: #e2e8f0; }
.tpl-sidebar .pv-main { padding: 14mm 10mm; }
.tpl-sidebar .pv-name { font-size: 26px; }
.tpl-sidebar .pv-title { color: #0f766e; font-weight: 700; }

/* 版式：现代商务 */
.tpl-modern .pv-head { border-left: 5px solid #0f766e; padding-left: 12px; }
.tpl-modern .pv-name { font-size: 28px; }
.tpl-modern .pv-title { color: #0f766e; font-weight: 700; }
.tpl-modern .pv-contact { color: #6b7280; font-size: 12.5px; }
.tpl-modern .sec h3 { color: #0f766e; }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 22px; width: 420px; max-width: 92vw; }
.modal-box h3 { margin-top: 0; }
.modal-box label { display: block; font-size: 13px; color: #4b5563; margin: 12px 0; }
.modal-box label input { width: 100%; margin-top: 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.foot { text-align: center; color: #9ca3af; font-size: 12px; padding: 16px; }

/* 打印：只印简历 */
@page { size: A4; margin: 0; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  main { display: block; padding: 0; }
  .preview-wrap { overflow: visible; }
  .preview-scale { transform: none !important; height: auto !important; }
  .sheet { box-shadow: none; margin: 0; }
}
