/* 接单底稿 · 合同文件视觉
   仿宋正文、双线边框、条款编号、印章徽标、签字线、骑缝线 */

:root {
  --paper: #F6F2E8;
  --paper-deep: #EBE3D2;
  --sheet: #FFFDF6;
  --ink: #25211C;
  --ink-soft: #6E6558;
  --line: #BEB3A0;
  --seal: #9E2B25;
  --contract: "FangSong", "仿宋", "STFangsong", "FangSong_GB2312", "SimSun", serif;
  --title: "STSong", "SimSun", "Songti SC", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--contract);
  font-size: 15px;
  line-height: 1.9;
  background:
    repeating-linear-gradient(0deg, transparent 0 33px, rgba(37, 33, 28, 0.035) 33px 34px),
    var(--paper);
}

main { max-width: 680px; margin: 0 auto; padding: 0 20px 100px; position: relative; }

/* 页眉：编号 + 印章 */
.doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 26px 0 12px;
  border-bottom: 3px double var(--ink);
  color: var(--ink-soft);
}
.docket { font: 11px/1.6 var(--mono); letter-spacing: 0.16em; }
.seal-mini { color: var(--seal); display: inline-flex; opacity: 0.9; }

.intro { padding: 34px 0 4px; }
.eyebrow { font: 10px/1 var(--mono); letter-spacing: 0.3em; color: var(--seal); margin: 0 0 14px; }
h1 {
  font-family: var(--title);
  font-size: clamp(38px, 7vw, 54px);
  line-height: 1.14;
  letter-spacing: 0.16em;
  margin: 0 0 16px;
  font-weight: 700;
}
h1::after {
  content: '';
  display: block;
  width: 96px;
  height: 3px;
  margin-top: 18px;
  border-top: 3px double var(--seal);
}
.lede { color: var(--ink-soft); margin: 0; max-width: 640px; }

/* 双线文件纸 */
.doc {
  margin-top: 30px;
  border: 2px solid var(--ink);
  background: var(--sheet);
  padding: 26px 28px 30px 46px;
  position: relative;
}
.doc::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--ink);
  pointer-events: none;
}
.stitch {
  position: absolute;
  left: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: repeating-linear-gradient(180deg, var(--seal) 0 4px, transparent 4px 13px);
  opacity: 0.55;
}
.stitch-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font: 10px/1 var(--contract);
  letter-spacing: 0.55em;
  color: var(--ink-soft);
}

/* 条款块 */
.clause { padding: 14px 0 18px; border-bottom: 1px dashed var(--line); }
.clause:last-of-type { border-bottom: none; }
.clause-no {
  margin: 0 0 12px;
  font-family: var(--title);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.clause-no span {
  display: inline-block;
  border-bottom: 2px solid var(--seal);
  padding-bottom: 1px;
  margin-right: 2px;
}
.hint { margin: -4px 0 12px; font-size: 12px; color: var(--ink-soft); }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; }
.line { display: flex; align-items: baseline; gap: 10px; position: relative; }
.line.full { grid-column: 1 / -1; }
.line > span { flex: none; font-size: 14px; color: var(--ink-soft); min-width: 5.2em; letter-spacing: 0.08em; }
.line input, .line textarea {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  padding: 5px 2px;
  font: 15px/1.75 var(--contract);
  color: var(--ink);
  outline: none;
  border-radius: 0;
  resize: vertical;
}
.line input:focus, .line textarea:focus { border-bottom-color: var(--seal); background: rgba(158, 43, 37, 0.04); }
.line input::placeholder, .line textarea::placeholder { color: #A79E8C; }
.line em { font-style: normal; font-size: 11px; color: var(--ink-soft); flex: none; }
.line.block { display: block; }
.line.block textarea { width: 100%; border: 1px solid var(--line); padding: 8px 10px; }

/* 按钮 */
.actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
button, a.ghost { font-family: var(--contract); cursor: pointer; }
.solid {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 11px 26px;
  font-size: 14px;
  letter-spacing: 0.12em;
}
.solid:hover { background: var(--seal); border-color: var(--seal); }
.solid:disabled { opacity: 0.5; cursor: wait; }
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 11px 22px;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-decoration: none;
  display: inline-block;
}
.ghost:hover { border-color: var(--seal); color: var(--seal); }
.note { font-size: 12px; color: var(--ink-soft); margin-top: 24px; }

/* 预览 */
.section-head { margin-top: 46px; }
.section-head.tight { margin-top: 40px; }
.section-head h2 { font-family: var(--title); font-size: 22px; letter-spacing: 0.08em; margin: 0 0 6px; }
.section-head .eyebrow { margin-bottom: 10px; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--ink);
}
.stat { background: var(--sheet); padding: 14px 8px 10px; text-align: center; }
.stat b { display: block; font: 700 20px/1.25 var(--title); margin: 4px 0 2px; overflow-wrap: anywhere; }
.stat small { font: 11px/1 var(--mono); color: var(--ink-soft); margin-left: 2px; }
.stat span { font-size: 11px; color: var(--ink-soft); }

.grade-row { display: flex; gap: 24px; align-items: flex-start; margin-top: 24px; }
.grade-seal {
  flex: none;
  width: 92px;
  height: 92px;
  border: 3px double var(--seal);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(158, 43, 37, 0.05);
  transform: rotate(-6deg);
}
.grade-seal span { font: 700 36px/1 var(--title); color: var(--seal); }
.grade-seal em { font-style: normal; font-size: 10px; color: var(--ink-soft); letter-spacing: 0.2em; }
.notes { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-soft); }
.notes li { padding-left: 18px; position: relative; margin-bottom: 7px; }
.notes li::before { content: '·'; position: absolute; left: 3px; top: 0; color: var(--seal); font-weight: 700; }

.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font: 12px/1.5 var(--contract);
  letter-spacing: 0.12em;
  color: var(--ink);
  border-top: 3px double var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 8px 10px;
  white-space: nowrap;
  background: var(--paper-deep);
}
td { border-bottom: 1px dashed var(--line); padding: 8px 10px; vertical-align: top; }
td.id { font: 11px/1.8 var(--mono); color: var(--seal); white-space: nowrap; }
td.num { font-family: var(--mono); white-space: nowrap; }

/* 案子 */
.case-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-top: 30px;
  padding-bottom: 10px;
  border-bottom: 3px double var(--ink);
  flex-wrap: wrap;
}
.code { font: 12px/1.6 var(--mono); color: var(--ink-soft); }
.state { font: 12px/1 var(--contract); letter-spacing: 0.16em; padding: 4px 10px; border: 1px solid var(--ink); }
.state.paid { border-color: var(--seal); color: var(--seal); }

.report-head { margin-top: 30px; position: relative; }
.report-head h2 { font-family: var(--title); font-size: 27px; letter-spacing: 0.1em; margin: 0 0 8px; }
.report-head .stamp {
  position: absolute;
  right: 0;
  top: -6px;
  color: var(--seal);
  opacity: 0.82;
  transform: rotate(9deg);
}
.report-meta { display: flex; gap: 14px; flex-wrap: wrap; font: 11px/1.8 var(--mono); color: var(--ink-soft); margin-top: 12px; }

.chapter { margin-top: 32px; }
.chapter h3 {
  margin: 0 0 10px;
  font-family: var(--title);
  font-size: 17px;
  letter-spacing: 0.08em;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--ink);
}
.chapter h3 small { font: 12px/1 var(--contract); color: var(--seal); margin-right: 10px; letter-spacing: 0.1em; }
.chapter p { margin: 0; max-width: 640px; }
.fact-refs { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.fact-refs span { font: 10px/1 var(--mono); letter-spacing: 0.08em; border: 1px solid var(--line); padding: 3px 7px; color: var(--seal); background: var(--paper-deep); }

.block-title {
  margin: 38px 0 14px;
  font-family: var(--title);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.block-title::before { content: ''; width: 10px; height: 10px; border: 2px solid var(--seal); flex: none; }
.block-title::after { content: ''; flex: 1; height: 0; border-top: 1px dashed var(--line); }

.qa { margin: 0 0 16px; border-left: 3px solid var(--seal); padding: 2px 0 2px 14px; }
.qa .ask { margin: 0; font-weight: 700; font-size: 14px; }
.qa .exposure { margin: 3px 0 6px; font-size: 12px; color: var(--seal); }
.qa .answer { margin: 0; font-size: 13px; color: var(--ink-soft); max-width: 640px; }

.flow { list-style: none; margin: 0; padding: 0; }
.flow li { display: flex; gap: 14px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.flow .when { flex: none; font-weight: 700; color: var(--seal); min-width: 5.5em; font-size: 13px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 8px 24px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  position: relative;
}
.checklist li::before { content: ''; position: absolute; left: 2px; top: 0.9em; width: 11px; height: 11px; border: 1.5px solid var(--seal); }
.checklist li span { font-size: 12px; color: var(--ink-soft); flex: none; }

/* 签字栏 */
.signoff {
  margin-top: 44px;
  border: 2px solid var(--ink);
  padding: 20px 22px 16px;
  position: relative;
  background: var(--sheet);
}
.signoff::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--ink); pointer-events: none; }
.signoff h4 { margin: 0 0 18px; font-family: var(--title); font-size: 15px; letter-spacing: 0.14em; text-align: center; }
.sign-line { display: flex; gap: 26px; flex-wrap: wrap; }
.sign-line div { flex: 1 1 200px; font-size: 13px; }
.sign-line .blank { display: block; border-bottom: 1px solid var(--ink); height: 30px; margin-top: 6px; }
.sign-date { margin-top: 18px; font-size: 13px; }
.sign-date .blank { display: inline-block; width: 130px; border-bottom: 1px solid var(--ink); }

.paywall { border: 2px solid var(--ink); background: var(--sheet); padding: 22px 24px; margin-top: 26px; position: relative; }
.paywall::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--ink); pointer-events: none; }
.paywall h3 { margin: 0 0 6px; font-family: var(--title); letter-spacing: 0.12em; }
.paywall p { font-size: 13px; color: var(--ink-soft); }
.price-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}
.price-line b { font: 700 20px/1 var(--title); }
.price-line small { font: 12px/1 var(--mono); color: var(--ink-soft); }
.price-line div { display: flex; align-items: center; gap: 16px; }
.pay-links { margin-top: 36px; }
.pay-links a { color: var(--seal); font-size: 13px; }

.order-box, .result-box { margin-top: 30px; border-top: 3px double var(--ink); padding-top: 16px; font-size: 13px; color: var(--ink-soft); }
.order-box b { font-family: var(--mono); color: var(--ink); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 22px;
  font-size: 13px;
  max-width: min(86vw, 520px);
  z-index: 9;
}

@media (max-width: 640px) {
  .fields { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grade-row { flex-direction: column; }
  .doc { padding: 24px 18px 26px 38px; }
  .stitch { left: 21px; }
  .stitch-label { left: 7px; }
}
