/* ============ 屏幕：打印区不显示 ============ */
#printArea{display:none}

/* ============ 打印：A4 ============ */
@media print{
  @page{ size:A4 portrait; margin:10mm; }

  html,body{margin:0;padding:0;background:#fff;color:#000;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  body{font-size:9pt;font-family:"Songti SC","SimSun","PingFang SC","Microsoft YaHei",serif}
  body>*:not(#printArea){display:none !important}
  #printArea{display:block !important}

  .sheet{
    width:190mm; height:277mm;
    position:relative; overflow:hidden;
    page-break-after:always; break-after:page;
    page-break-inside:avoid; break-inside:avoid;
  }
  .sheet:last-child{page-break-after:auto;break-after:auto}

  /* 抬头 */
  .p-head{border-bottom:1.5pt solid #000;padding-bottom:2mm;margin-bottom:2mm;display:flex;align-items:flex-end;justify-content:space-between;gap:6mm}
  .p-company{font-size:15pt;font-weight:700;letter-spacing:1px}
  .p-company-info{font-size:8pt;color:#333;margin-top:1mm}
  .p-docname{font-size:16pt;font-weight:700;letter-spacing:4px;text-align:right}
  .p-restamp{font-size:8pt;color:#b00;text-align:right;margin-top:1mm;font-weight:700}
  .p-revise{font-size:8pt;color:#666;text-align:right;margin-top:0.6mm}

  /* 基本信息 */
  .p-meta{border:0.6pt solid #000;margin-bottom:2mm}
  .p-meta td{border:0.6pt solid #000;padding:1.4mm 2mm;font-size:9pt;vertical-align:middle}
  .p-meta .k{color:#555;width:16mm;white-space:nowrap;background:#f5f5f5}
  .p-meta .v{font-weight:600}

  /* 明细表 */
  table.p-items{width:100%;border-collapse:collapse;table-layout:fixed}
  table.p-items th,table.p-items td{
    border:0.6pt solid #000;padding:1mm 1.5mm;font-size:9pt;line-height:1.3;height:6.4mm;
    overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
  }
  table.p-items thead th{background:#f0f0f0;font-weight:700;text-align:center}
  table.p-items td.c{text-align:center}
  table.p-items td.r{text-align:right;font-variant-numeric:tabular-nums}
  table.p-items td.name{white-space:normal;line-height:1.25}
  table.p-items tfoot td{border:0;font-size:8.5pt;color:#444;padding:1mm 0}

  /* 合计区 */
  .p-sum{display:flex;justify-content:space-between;align-items:flex-start;gap:6mm;margin-top:2mm}
  .p-sum-note{flex:1;font-size:8.5pt;color:#333;line-height:1.6;border:0.6pt dashed #999;padding:1.5mm 2mm;min-height:16mm}
  .p-sum-box{width:78mm;border:0.6pt solid #000}
  .p-sum-box div{display:flex;justify-content:space-between;padding:1.2mm 2mm;border-bottom:0.6pt solid #000;font-size:9pt}
  .p-sum-box div:last-child{border-bottom:0}
  .p-sum-box .lb{color:#555}
  .p-sum-box .vl{font-weight:700;font-variant-numeric:tabular-nums}
  .p-sum-box .big{font-size:11pt}
  .p-upper{padding:1.2mm 2mm;font-size:9pt;border-bottom:0.6pt solid #000}
  .p-upper span{color:#555}
  .p-upper b{font-weight:700}

  /* 签收 */
  .p-sign{display:flex;justify-content:space-between;margin-top:3mm;font-size:9pt;color:#333}
  .p-sign div{flex:1}

  /* 页脚 */
  .p-pagefoot{position:absolute;left:0;right:0;bottom:0;border-top:0.6pt solid #999;padding-top:1mm;display:flex;justify-content:space-between;font-size:8pt;color:#666}

  /* 联次虚线 */
  .p-cut{margin:2mm 0;border-bottom:0.6pt dashed #999}
}
