* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Microsoft YaHei", sans-serif;
  background: #f4f6f9; color: #222; font-size: 14px;
}
.header { background: #fff; padding: 18px 28px; border-bottom: 1px solid #e5e9f0; }
.header h1 { font-size: 21px; color: #1a1a1a; }
.header p { color: #888; margin-top: 5px; font-size: 13px; }
.layout { display: flex; gap: 20px; padding: 20px 28px; align-items: flex-start; }
.left { width: 360px; flex-shrink: 0; }
.card { background: #fff; border: 1px solid #e5e9f0; border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.num { background: #eef2ff; color: #4f46e5; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.hint { color: #8a94a6; font-size: 12px; line-height: 1.7; margin-top: 8px; }
input[type=file] { width: 100%; padding: 8px; border: 1px dashed #c9d2e0; border-radius: 6px; background: #fafbfc; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; text-decoration: none; }
.btn.gray { background: #eef1f6; color: #444; }
.btn.gray:hover { background: #e2e7f0; }
.btn.primary { background: #4f46e5; color: #fff; }
.btn.primary:hover { background: #4338ca; }
.btn.ok { background: #16a34a; color: #fff; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; font-weight: 600; margin-top: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.file-label { position: relative; overflow: hidden; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 6px; }
.grid2 label { font-size: 12px; color: #555; margin-top: 6px; }
.grid2 label span { color: #4f46e5; font-weight: 600; }
input[type=range] { width: 100%; }
select { padding: 7px; border: 1px solid #d5dce8; border-radius: 6px; background: #fff; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0; }
.radio-item { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #333; cursor: pointer; }
.radio-item input { accent-color: #4f46e5; }
.one-page-row { display: flex; align-items: center; gap: 7px; background: #f7f8fc; border: 1px solid #e5e9f0; border-radius: 6px; padding: 7px 9px; font-size: 12px; color: #555; }
.one-page-row input[type=number] { width: 62px; padding: 5px 6px; border: 1px solid #d5dce8; border-radius: 5px; }
.one-page-row .btn { margin-left: auto; padding: 5px 9px; font-size: 12px; }
.extract-row { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #eef1f6; font-size: 12px; color: #555; }
.extract-row input[type=number] { width: 58px; padding: 5px 6px; border: 1px solid #d5dce8; border-radius: 5px; }
.extract-row .btn { margin-left: auto; padding: 5px 9px; font-size: 12px; }
.perf-toggle { margin-bottom: 10px; }
#sealPreviewBox { width: 84px; height: 84px; flex-shrink: 0; }
.seal-empty { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; border: 1px dashed #c9d2e0; border-radius: 8px; color: #aab2c0; font-size: 11px; text-align: center; padding: 6px; background: #fafbfc; }
.hint.warn { background: #fff8e6; color: #a16207; border: 1px solid #fde68a; border-radius: 6px; padding: 7px 9px; margin: 0 0 10px; }
.seal-row { display: flex; gap: 14px; align-items: center; }
.seal-row img { width: 84px; height: 84px; object-fit: contain; border: 1px solid #eee; border-radius: 8px; background: #fff; }
#msg { margin: 10px 0; }
.msg { padding: 9px 12px; border-radius: 6px; font-size: 13px; }
.msg.ok { background: #e8f7ee; color: #15803d; }
.msg.err { background: #fdeaea; color: #b91c1c; }
.msg.info { background: #eef2ff; color: #4338ca; }
.hidden { display: none !important; }

.pdf-preview-wrap { flex: 1; background: #fff; border: 1px solid #e5e9f0; border-radius: 10px; overflow: hidden; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #eef1f6; background: #fafbfc; }
#previewPlaceholder { height: 560px; display: flex; align-items: center; justify-content: center; color: #bbb; }
#previewStage { position: relative; display: inline-block; padding: 16px; }
#previewImg { max-width: 100%; display: block; }
.drag-seal {
  position: absolute; width: 90px; height: 90px; border: 2px dashed #4f46e5;
  cursor: move; background: rgba(79,70,229,.06); border-radius: 4px;
}
.drag-seal img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.drag-label { position: absolute; top: -22px; left: 0; background: #4f46e5; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.resize-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #4f46e5; border-radius: 50%; cursor: nwse-resize; }
@media (max-width: 900px) { .layout { flex-direction: column; } .left { width: 100%; } }
