/* ============================================================================
   送货单打印
   ----------------------------------------------------------------------------
   只按 A4 竖版设计过。三份一页，每份 91mm，剪开就是三联。

   屏幕上是按真实尺寸（210mm 宽）预览的，窄屏要左右滑——不缩，
   缩了就看不出打印出来是什么样，到打印机上才发现字挤出格。
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 8mm 10mm;
}

.print-doc {
  overflow-x: auto;            /* 手机上看 A4 只能横着滑，但至少是真实比例 */
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-md);
}

/* 只在窄屏出现的提示条。桌面上整张纸看得全，多一句话是噪音。 */
.print-tip { display: none; margin-bottom: var(--sp-md); }
@media (max-width: 860px) { .print-tip { display: block; } }

.print-sheet {
  background: #fff;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-md);
  width: 210mm;
  min-height: 281mm;
  margin: 0 auto var(--sp-lg);
  padding: 8mm 10mm;
}

.print-copy {
  height: 88mm;
  padding: 2mm 0;
  border-bottom: 1px dashed #b9c0cc;
  display: flex;
  flex-direction: column;
  font-size: 8.6pt;
  line-height: 1.35;
  color: #000;
  page-break-inside: avoid;
  break-inside: avoid;
}
.print-copy:last-child { border-bottom: none; }

/* ---------- 抬头 ---------- */
.pc-head {
  display: flex;
  align-items: flex-start;
  gap: 4mm;
  padding-bottom: 1.2mm;
  border-bottom: 1.2pt solid #000;
}
.pc-co {
  font-size: 10pt;
  font-weight: 700;
  line-height: 1.25;
  max-width: 62mm;
}
.pc-co__sub {
  font-size: 6.6pt;
  font-weight: 400;
  color: #333;
  margin-top: .6mm;
  line-height: 1.3;
}
.pc-title {
  flex: 1;
  text-align: center;
  font-size: 14pt;
  font-weight: 700;
  letter-spacing: 5px;
  padding-top: .6mm;
}
.pc-no {
  text-align: right;
  font-size: 7.6pt;
  line-height: 1.4;
  max-width: 46mm;
}
.pc-date { font-variant-numeric: tabular-nums; }

/* ---------- 客户信息 ---------- */
.pc-meta {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: .4mm 4mm;
  padding: 1.4mm 0;
  font-size: 7.6pt;
}
.pc-meta__cell--wide { grid-column: 1 / -1; }
.pc-meta b { font-weight: 600; }

/* ---------- 明细 ---------- */
.pc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 7.6pt;
}
.pc-table th,
.pc-table td {
  border: .4pt solid #444;
  padding: .5mm 1mm;
  height: 5.4mm;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-table th {
  background: #f0f2f5;
  font-weight: 600;
  text-align: center;
}
.pc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pc-blank td { height: 5.4mm; }
.pc-spec { color: #333; }

/* ---------- 合计 ---------- */
.pc-sum {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4mm;
  padding: 1.2mm 0 .8mm;
  font-size: 7.8pt;
}
.pc-cn { flex: 1; }
.pc-cn b { font-weight: 600; letter-spacing: .3px; }
.pc-amount {
  font-size: 9.6pt;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pc-note {
  font-size: 7.4pt;
  color: #222;
  min-height: 4mm;
  padding-bottom: .6mm;
}

/* ---------- 签字 ---------- */
.pc-sign {
  display: flex;
  gap: 6mm;
  align-items: flex-end;
  margin-top: auto;
  font-size: 7.8pt;
  padding-top: 1mm;
}
.pc-sign span { white-space: nowrap; }
.pc-copy-tag {
  margin-left: auto;
  border: .5pt solid #555;
  border-radius: 1mm;
  padding: .3mm 2mm;
  font-size: 6.8pt;
  color: #333;
  white-space: nowrap;
}

/* ---------- 打印 ---------- */
@media print {
  html, body { background: #fff !important; }
  .side-nav,
  .bottom-nav,
  .no-print,
  .toast-wrap,
  .action-bar,
  .action-bar-spacer,
  .modal-mask { display: none !important; }

  .app-shell { display: block !important; }
  .app-main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .print-doc { overflow: visible; padding: 0; }
  .print-sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }
  .print-sheet:last-child { page-break-after: auto; break-after: auto; }

  /* 批量打印：每张单之间强制分页。
     最后一页的 .print-sheet 是 :last-child，上面那条规则会把分页取消，
     所以要按"这张单不是最后一张单"再压回来，否则两张单挤在一张 A4 上。 */
  .print-batch .batch-sheet:not(:last-child)
    > .print-doc > .print-sheet:last-child {
    page-break-after: always;
    break-after: page;
  }
}

/* ============================================================================
   报价单
   ----------------------------------------------------------------------------
   一张 A4 一份，不切三联。行距放大一点：报价单是给客户看的文件，
   不是仓库内部流转的凭据，密不透风反而显得不正规。
   ========================================================================== */

.qp-doc {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-md);
}

.qp-sheet {
  width: 210mm;
  min-height: 281mm;
  margin: 0 auto;
  padding: 14mm 16mm;
  background: #fff;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-md);
  color: #000;
  font-size: 10pt;
  line-height: 1.5;
}

.qp-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6mm;
  padding-bottom: 3mm;
  border-bottom: 1.6pt solid #000;
}
.qp-co { font-size: 13pt; font-weight: 700; line-height: 1.3; }
.qp-co__sub { margin-top: 1mm; font-size: 8pt; font-weight: 400; color: #444; }
.qp-title { font-size: 20pt; font-weight: 700; letter-spacing: 4pt; white-space: nowrap; }

.qp-meta { margin: 4mm 0 3mm; font-size: 9.5pt; }
.qp-meta__row {
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  padding: 1mm 0;
}
.qp-meta__row > span:first-child { min-width: 0; }

.qp-table { width: 100%; border-collapse: collapse; }
.qp-table th,
.qp-table td {
  border: .6pt solid #333;
  padding: 1.8mm 2mm;
  vertical-align: top;
}
.qp-table th {
  background: #f2f4f8;
  font-weight: 600;
  font-size: 9pt;
  text-align: left;
}
.qp-table td.num,
.qp-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.qp-spec { color: #333; }
.qp-remark { margin-top: .6mm; font-size: 8pt; color: #555; }

.qp-sum {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6mm;
  margin-top: 3mm;
  padding: 2.5mm 3mm;
  border: .6pt solid #333;
  background: #fafbfd;
}
.qp-cn { font-size: 9.5pt; }
.qp-amount { font-size: 14pt; font-weight: 700; white-space: nowrap; }

.qp-note {
  margin-top: 3mm;
  font-size: 9pt;
  line-height: 1.6;
  color: #222;
}

.qp-sign {
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  margin-top: 16mm;
  font-size: 9.5pt;
}
.qp-sign span { flex: 1; }

@media print {
  .qp-doc { overflow: visible; padding: 0; }
  .qp-sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
  }
  .qp-table th { background: #f2f4f8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
