/* ============================================================
 * contract-doc.css —— 合同单据 A4 版式（预览与打印共用）
 * 参照 汽车销售合同套表260923.xlsm 各表打印区域的版式
 * ==================================== */

/* ---------- A4 页面 ---------- */
.doc-page {
  width: 210mm;
  min-height: 297mm;
  padding: 10mm 12mm 14mm;
  box-sizing: border-box;
  background: #fff;
  color: #000;
  font-family: "SimSun", "宋体", "Songti SC", serif;
  font-size: 10pt;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
  margin: 0 auto 8mm;
  overflow: hidden;
}
.doc-page.dense { font-size: 9pt; line-height: 1.45; }
.doc-page.dense2 { font-size: 8.4pt; line-height: 1.4; }

/* 超长单据专用：整页等比收紧，保证一页装得下且仍可辨读 */
.doc-page.dense3 { font-size: 8.2pt; line-height: 1.35; padding: 8mm 11mm 12mm; }
.doc-page.dense3 .doc-title { font-size: 14pt; margin: 0 0 6px; }
.doc-page.dense3 .doc-title.small { font-size: 12pt; }
.doc-page.dense3 .doc-meta { font-size: 9pt; margin: 0 0 4px; }
.doc-page.dense3 .t td, .doc-page.dense3 .t th { font-size: 8.2pt; padding: 1px 3px; line-height: 1.3; }
.doc-page.dense3 .t .lbl2 { font-size: 8pt; }
.doc-page.dense3 .c-p { margin: 3px 0; }
.doc-page.dense3 .c-line { margin: 2px 0; }
.doc-page.dense3 .c-h { margin: 6px 0 2px; font-size: 9.4pt; }
.doc-page.dense3 .h2 { margin: 5px 0 2px; }
.doc-page.dense3 .c-note { font-size: 8pt; }
.doc-page.dense3 .c-intro { margin: 5px 0 4px; }
.doc-page.dense3 .notice-t td { font-size: 7.6pt; padding: 1px 2px; }
.doc-page.dense3 .small-t td, .doc-page.dense3 .small-t th { font-size: 7.4pt; padding: 0 2px; line-height: 1.25; }
.doc-page.dense3 .cut { margin: 3mm 0; font-size: 7.5pt; }
.doc-page.dense3 .fill { min-width: 40px; line-height: 1.2; }
.doc-page.dense3 .sign-t { margin-top: 5px; }

.doc-title {
  text-align: center;
  font-family: "SimHei", "黑体", "Heiti SC", sans-serif;
  font-size: 16pt;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 0 0 10px;
}
.doc-title.small { font-size: 13pt; letter-spacing: 2px; }

.doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10pt;
  margin: 0 0 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid #000;
}
.doc-meta .doc-no { font-weight: 700; letter-spacing: .5px; font-family: "SimHei", "黑体", sans-serif; }

/* ---------- 表格 ---------- */
.t { width: 100%; border-collapse: collapse; table-layout: fixed; }
.t td, .t th {
  border: 1px solid #000;
  padding: 2px 4px;
  font-size: 9.5pt;
  line-height: 1.45;
  vertical-align: middle;
  word-break: break-all;
}
.t th { background: #f2f2f2; font-weight: 700; text-align: center; font-family: "SimHei", "黑体", sans-serif; }
.t .lbl { background: #f7f7f7; text-align: center; white-space: nowrap; }
.t .vl { text-align: left; }
.t .grp { background: #f7f7f7; text-align: center; vertical-align: middle; font-weight: 700; white-space: nowrap; }
.t .lbl2 { background: #fafafa; text-align: center; white-space: nowrap; font-size: 9pt; }
.t .vl2 { text-align: center; }
.t .strong { font-weight: 700; }
.notice-t td { font-size: 8.6pt; padding: 2px 3px; }
.small-t td, .small-t th { font-size: 8.2pt; padding: 1px 3px; line-height: 1.35; }

/* 合同正文抬头买卖双方的轻量表格：与套表一致，弱化边框 */
.head-t td, .head-t th { border: none; border-bottom: 1px solid #000; padding: 3px 4px; }
.head-t .lbl { background: transparent; text-align: left; font-weight: 400; }
.head-t .vl { text-align: left; }
.head-t tr:last-child td { border-bottom: none; }

/* ---------- 文本块 ---------- */
.c-p { margin: 5px 0; text-align: justify; text-indent: 0; }
.c-line { margin: 3px 0; }
.c-h { font-weight: 700; font-family: "SimHei", "黑体", sans-serif; margin: 10px 0 4px; font-size: 10.5pt; }
.h2 { font-weight: 700; font-family: "SimHei", "黑体", sans-serif; margin: 9px 0 3px; }
.c-note { font-size: 9pt; margin: 2px 0; color: #111; }
.c-intro { margin: 8px 0 6px; }

/* 填空下划线 */
.fill {
  display: inline-block;
  border-bottom: 1px solid #000;
  min-width: 50px;
  padding: 0 3px;
  text-align: center;
  line-height: 1.35;
}

/* 已填值：去掉下划线 */
.val {
  display: inline-block;
  border-bottom: none;
  padding: 0 3px;
  text-align: center;
  line-height: 1.35;
}

/* 年月日小方框 */
.datebox {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  border-bottom: 1px solid #000;
  padding: 0 2px;
}

/* ---------- 双栏（合同正文） ---------- */
.two-col { display: flex; gap: 7mm; align-items: flex-start; }
.two-col > .col { flex: 1 1 0; min-width: 0; }

/* ---------- 签字行 ---------- */
.sign-t { display: flex; justify-content: space-between; gap: 10mm; margin-top: 8px; }
.sign-t > div { flex: 1 1 0; }

/* ---------- 同页多联 ---------- */
.half { }
/* 同页两联之间的裁切虚线（标签居中压在虚线上） */
.cut {
  height: 0;
  border-top: 1px dashed #b9b9b9;
  margin: 6mm 0 7mm;
  position: relative;
  font-size: 7.5pt;
  color: #999;
  letter-spacing: .5px;
}
.cut > span {
  position: absolute;
  left: 50%;
  top: -1.15em;
  transform: translateX(-50%);
  background: #fff;
  padding: 0 8px;
  white-space: nowrap;
}

/* ---------- 页脚防伪标记（防阴阳合同：每页同号） ---------- */
.doc-foot {
  position: absolute;
  left: 13mm; right: 13mm; bottom: 6mm;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 7.5pt;
  color: #555;
  border-top: 1px dotted #aaa;
  padding-top: 2px;
  font-family: "SimSun", "宋体", serif;
}
.doc-foot .fn { font-weight: 700; letter-spacing: .3px; }

/* ---------- 自适应压缩层（内容略超 A4 时整页等比缩到一页内） ---------- */
.doc-page > .doc-fit { width: 100%; box-sizing: border-box; }

/* ---------- 预览容器（工作台内缩放展示） ---------- */
.pv-shell { overflow: hidden; position: relative; }
.pv-scale { transform-origin: top left; }
.pv-placeholder { color: #98a2b3; text-align: center; padding: 40px 10px; font-size: 13px; }

/* ============================================================
 *  存档目录专用样式
 * ============================================================ */
.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sh-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c8102e;
}
.sh-logo .sh-icon {
  width: 32px; height: 32px;
  border: 2px solid #c8102e;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #c8102e;
}
.sh-logo div { display: flex; flex-direction: column; line-height: 1.1; }
.sh-logo div b { font-size: 13pt; letter-spacing: 1px; }
.sh-logo div span { font-size: 7.5pt; color: #c8102e; }
.archive-title {
  flex: 1;
  text-align: center;
  font-family: "SimHei", "黑体", sans-serif;
  font-size: 15pt;
  font-weight: 700;
  letter-spacing: 3px;
}
.archive-info { margin-bottom: 6px; }
.archive-info td, .archive-info th { padding: 5px 6px; }
.archive-list { margin-bottom: 10px; }
.archive-list td, .archive-list th { padding: 4px 6px; text-align: center; }
.archive-list td:nth-child(2) { text-align: left; }
.archive-note { margin: 8px 0 12px; font-size: 9.5pt; }
.archive-note div { margin: 2px 0; }
.archive-sign { margin-bottom: 6px; }
.archive-sign td { padding: 5px 6px; }
.archive-date { text-align: center; }
.archive-foot { margin-top: 10px; }
.archive-foot td { padding: 5px 6px; }
.archive-foot td:first-child { font-weight: 700; }

/* ============================================================
 *  收款通知书专用样式
 * ============================================================ */
.receipt-title { margin-bottom: 8px; }
.receipt-t { margin-bottom: 0; }
.receipt-t td, .receipt-t th { padding: 3px 4px; font-size: 8.8pt; text-align: center; line-height: 1.35; }
.receipt-t .grp { font-size: 8.8pt; font-weight: 700; }
.receipt-t .lbl2 { font-size: 8.4pt; }
.receipt-bottom { margin-top: 0; border-top: none; }
.receipt-bottom td { padding: 3px 5px; font-size: 9pt; }
.receipt-bottom tr:first-child td { border-top: none; }

/* ============================================================
 *  交款确认单专用样式
 * ============================================================ */
.pay-line {
  margin: 6px 0;
  font-size: 10.5pt;
  line-height: 1.9;
}
.pay-line span { display: inline-block; margin: 0 2px; }
.pay-line .fill, .pay-line .val { margin: 0 3px; }
.pay-dx {
  font-size: 11pt;
  font-weight: 700;
  letter-spacing: 1px;
}
.pay-checkbox {
  display: inline-block;
  min-width: 60px;
  margin-right: 20px !important;
}
.pay-sign { margin-top: 24px; }
.pay-sign td { padding: 5px 4px; }
.pay-warm { margin-top: 14px; font-size: 10pt; }
.pay-warm-item { margin: 3px 0 3px 24px; font-size: 10pt; }

/* ============================================================
 *  交车确认单专用样式
 * ============================================================ */
.car-title { color: #c8102e; margin-bottom: 6px; }
.car-p { margin: 4px 0; font-size: 9pt; line-height: 1.45; }
.car-section-title {
  background: #e0e0e0;
  font-family: "SimHei", "黑体", sans-serif;
  font-weight: 700;
  font-size: 9.5pt;
  padding: 3px 8px;
  margin: 6px 0 3px;
}
.car-t td, .car-t th { padding: 3px 5px; }
.car-maint { margin-top: 3px; }
.car-maint td, .car-maint th { padding: 2px 4px; font-size: 7.8pt; line-height: 1.28; }
.car-jp { margin-top: 3px; }
.car-jp td, .car-jp th { padding: 2px 4px; font-size: 8pt; line-height: 1.3; }
.car-tip {
  color: #c8102e;
  font-size: 8.5pt;
  margin: 6px 0 10px;
  line-height: 1.35;
}
.car-sign { margin-top: 8px; }
.car-sign td { padding: 5px 4px; }

/* ============================================================
 *  精品单专用样式
 * ============================================================ */
.jp-head-t { margin-bottom: 4px; }
.jp-head-t td { border: none; padding: 2px 0; }
.jp-line { margin: 3px 0; font-size: 10pt; }
.jp-t { margin-top: 4px; }
.jp-t td, .jp-t th { padding: 2px 3px; font-size: 9pt; text-align: center; }
.jp-t td:nth-child(2) { text-align: left; }
.jp-date { margin-top: 4px; border-top: none; }
.jp-date td { border-top: none; padding: 4px 6px; }
.jp-note { margin-top: 4px; font-size: 9pt; }

/* ---------- 打印 ---------- */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .doc-page {
    width: 210mm !important;
    min-height: 295mm;              /* 略小于 A4，避免 297mm 舍入把内容顶到第二页 */
    height: auto;
    overflow: visible;              /* 内容多时允许自然分页，绝不裁切 */
    margin: 0 !important;
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
  }
  /* 被fitPages压缩过的页：高度由脚本锁定为「缩放后真实高度」，保证恰好占一页且不裁切 */
  .doc-page.fitted { min-height: 0 !important; overflow: hidden; }
  .doc-page:last-child { page-break-after: auto; break-after: auto; }
  .no-print { display: none !important; }
  .pv-shell, .pv-scale { transform: none !important; overflow: visible !important; }
}
