/* 单证版式：A4 文档，屏幕预览与打印共用 */

.doc-page {
  --doc-theme: #1e3a8a;
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 15mm;
  background: #fff;
  color: #1f2937;
  font-family: Arial, "Helvetica Neue", Helvetica, "Microsoft YaHei", sans-serif;
  font-size: 10pt;
  line-height: 1.5;
  box-sizing: border-box;
  position: relative;
}

.doc-page * { box-sizing: border-box; }

/* ---------- 页眉 ---------- */
.doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10mm;
}

.doc-brand { flex: 1 1 auto; min-width: 0; }

.doc-logo {
  display: block;
  max-height: 14mm;
  max-width: 62mm;
  margin-bottom: 3mm;
}

.doc-logo-text {
  font-size: 21pt;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #374151;
  margin-bottom: 2.5mm;
  line-height: 1;
}
.doc-logo-text em { font-style: normal; color: #ef4444; }
.doc-logo-text sup { font-size: 7pt; color: #6b7280; }

.doc-company {
  font-size: 15pt;
  font-weight: 700;
  color: var(--doc-theme);
  margin: 0 0 1.6mm;
  line-height: 1.2;
}

.doc-addr, .doc-contact {
  margin: 0;
  font-size: 8.2pt;
  color: #6b7280;
  line-height: 1.6;
}

.doc-titlewrap { flex: 0 0 auto; text-align: right; padding-top: 1mm; }

.doc-title {
  font-size: 23pt;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--doc-theme);
  margin: 0 0 4mm;
  line-height: 1.05;
  white-space: nowrap;
}

.doc-meta { font-size: 8.5pt; color: #4b5563; line-height: 1.85; }
.doc-meta div { white-space: nowrap; }

.doc-rule {
  border-top: 2.6px solid var(--doc-theme);
  margin: 4mm 0 5mm;
}

/* ---------- 信息块 ---------- */
.d-box {
  background: #f7f8fa;
  border-radius: 2px;
  padding: 4mm 5mm;
}

.d-label {
  font-size: 7.6pt;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--doc-theme);
  margin-bottom: 2mm;
}

.d-name { font-size: 10pt; font-weight: 700; color: #111827; margin-bottom: 0.8mm; }
.d-addr { font-size: 8.6pt; color: #4b5563; line-height: 1.6; }

.d-split { display: flex; gap: 0; }
.d-split > .d-box { flex: 1 1 50%; background: #f7f8fa; }
.d-split > .d-box:first-child { border-right: 1px solid #e5e7eb; }

.d-strip {
  margin-top: 5mm;
  background: #f7f8fa;
  border-radius: 2px;
  padding: 3mm 5mm;
  font-size: 8.4pt;
  color: #4b5563;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.d-strip span { padding: 0 5mm; border-left: 1px solid #d1d5db; }
.d-strip span:first-child { padding-left: 0; border-left: 0; }
.d-strip b { color: #374151; font-weight: 700; }

/* ---------- 明细表 ---------- */
.d-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 5mm;
  table-layout: fixed;
}

.d-table thead th {
  background: var(--doc-theme);
  color: #fff;
  font-size: 7.2pt;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 3.2mm 2mm;
  vertical-align: middle;
  line-height: 1.25;
}
.d-table thead th.c { text-align: center; }
.d-table thead th.r { text-align: right; }

.d-table tbody td {
  border-bottom: 1px solid #e5e7eb;
  padding: 2.6mm 2mm;
  font-size: 8.4pt;
  color: #374151;
  vertical-align: middle;
}
.d-table tbody td.c { text-align: center; }
.d-table tbody td.r { text-align: right; }
.d-table tbody td.b { font-weight: 700; color: #111827; }

.d-table .idx { color: #6b7280; }
.d-table .photo img { width: 12mm; height: 12mm; object-fit: contain; display: block; }

.d-table tfoot td {
  border-top: 1.6px solid var(--doc-theme);
  padding: 3.6mm 2mm 0;
  font-size: 9.8pt;
  font-weight: 700;
  color: #111827;
  vertical-align: baseline;
}
.d-table tfoot td.label {
  color: var(--doc-theme);
  font-size: 10.5pt;
  letter-spacing: 0.06em;
  text-align: right;
}
.d-table tfoot td.c { text-align: center; }
.d-table tfoot td.r { text-align: right; }

/* ---------- 合计 ---------- */
.d-totalrow {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 8mm;
  border-top: 1.6px solid var(--doc-theme);
  margin-top: 0;
  padding: 3.5mm 2mm 0;
}
.d-totalrow .t-label {
  font-size: 11pt;
  font-weight: 700;
  color: var(--doc-theme);
  letter-spacing: 0.06em;
}
.d-totalrow .t-qty { font-size: 10.5pt; font-weight: 700; color: #111827; min-width: 14mm; text-align: right; }
.d-totalrow .t-amt { font-size: 11pt; font-weight: 700; color: #111827; min-width: 28mm; text-align: right; }
.d-totalrow .t-mini { font-size: 8.4pt; color: #6b7280; min-width: 12mm; text-align: right; }

/* ---------- 条款 ---------- */
.d-section-title {
  font-size: 8.6pt;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--doc-theme);
  margin: 7mm 0 2.5mm;
}

.d-bullets { margin: 0; padding: 0 0 0 4mm; }
.d-bullets li {
  font-size: 8.6pt;
  color: #4b5563;
  line-height: 1.85;
  margin-bottom: 0.6mm;
}

.d-bank {
  background: #f7f8fa;
  border-radius: 2px;
  padding: 4mm 5mm;
  font-size: 8.6pt;
  color: #4b5563;
  line-height: 1.85;
  margin-top: 2.5mm;
}

.d-saytotal {
  margin-top: 3.5mm;
  font-size: 8.8pt;
  color: #111827;
  line-height: 1.6;
}
.d-saytotal b { color: var(--doc-theme); letter-spacing: 0.05em; }

/* ---------- 双语模式紧凑排版（保证五证仍为 A4 单页） ---------- */
.doc-page.lang-bi .d-table thead th {
  padding: 2mm 1.3mm;
  line-height: 1.12;
  letter-spacing: 0.01em;
  font-size: 6.9pt;
}
.doc-page.lang-bi .d-section-title { margin: 4.2mm 0 1.6mm; }
.doc-page.lang-bi .d-bullets li { font-size: 8.2pt; line-height: 1.55; }
.doc-page.lang-bi .d-bank { padding: 3mm 4mm; line-height: 1.62; }
.doc-page.lang-bi .d-saytotal { margin-top: 2.2mm; }
.doc-page.lang-bi .d-sign-col { padding-top: 9mm; }

/* ---------- 签章 ---------- */
.d-sign {
  display: flex;
  gap: 12mm;
  margin-top: 10mm;
  padding-top: 2mm;
  border-top: 1px solid #e5e7eb;
}
.d-sign-col { flex: 1 1 0; position: relative; padding-top: 12mm; }
.d-sign-col .line { border-top: 1px solid #9ca3af; }
.d-sign-col .cap { font-size: 8.2pt; color: #6b7280; margin-top: 1.6mm; }
.d-stamp {
  position: absolute;
  left: 2mm;
  top: -4mm;
  width: 30mm;
  opacity: 0.92;
  pointer-events: none;
}

/* ---------- 合同 ---------- */
.ct-notice {
  background: #fdf8e7;
  border: 1px solid #f0dfa8;
  border-radius: 3px;
  padding: 3mm 4mm;
  font-size: 8.8pt;
  color: #4b5563;
  margin: 5mm 0 4mm;
}
.ct-notice b { color: #111827; }

.ct-article { margin-top: 5mm; break-inside: avoid; }
.ct-article h4 {
  font-size: 8.8pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doc-theme);
  margin: 0 0 2mm;
  padding-bottom: 1.6mm;
  border-bottom: 1px solid #e5e7eb;
}
.ct-article p { margin: 0 0 1.2mm; font-size: 8.8pt; color: #4b5563; line-height: 1.7; }
.ct-article p b { color: #111827; }

.ct-sign-title {
  font-size: 8.8pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doc-theme);
  margin: 8mm 0 0;
  padding-top: 3mm;
  border-top: 1px solid #e5e7eb;
}
.ct-sign-title .stamp-inline {
  width: 26mm;
  vertical-align: middle;
  margin-right: 3mm;
}

/* 打印 */
#print-root { display: none; }

@media print {
  @page { size: A4; margin: 14mm 15mm; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .doc-page {
    width: auto;
    min-height: 0;
    padding: 0;
    box-shadow: none;
    margin: 0;
  }
  #print-root .doc-page + .doc-page { break-before: page; page-break-before: always; }
  #print-root .d-table thead { display: table-header-group; }
  #print-root .d-table tr { break-inside: avoid; page-break-inside: avoid; }
  #print-root .d-sign { break-inside: avoid; }
  #print-root .doc-rule { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-root .d-table thead th,
  #print-root .d-box,
  #print-root .d-strip,
  #print-root .ct-notice { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
