/* ============================================================
   统一单据制式（A4 单据纸张）
   屏幕「单据详情」与浏览器打印共用这一份样式，保证三处一致：
   界面 / 打印 / Excel 导出
   ============================================================ */
.paper {
  position: relative;
  background: #fff;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 18px 20px 14px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .05);
  max-width: 880px;
}
.paper .pos { color: #dc2626; }
.paper .neg { color: #16a34a; }
/* 盘点盈亏：盘亏红、盘盈绿（与涨跌红绿无关） */
.paper .p-loss { color: #dc2626; font-weight: 600; }
.paper .p-gain { color: #16a34a; font-weight: 600; }
.paper .strong, .paper b { font-weight: 700; }
.paper .muted { color: #9ca3af; }

/* ---- 抬头：公司 + 单据标题 ---- */
.p-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 8px; border-bottom: 2px solid #111827; }
.p-brand { min-width: 0; }
.p-co { font-size: 19px; font-weight: 700; letter-spacing: 1.5px; color: #111827; }
.p-cometa { font-size: 11px; color: #6b7280; margin-top: 3px; }
.p-titlebox { text-align: right; flex-shrink: 0; }
.p-title { font-size: 25px; font-weight: 700; letter-spacing: 6px; line-height: 1.2; }
.p-en { font-size: 9.5px; color: #9ca3af; letter-spacing: 1px; margin-top: 1px; }

/* ---- 单号条 ---- */
.p-nobar { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: #4b5563; padding: 5px 2px 6px; }
.p-nobar .p-ref { color: #1f2937; }

/* ---- 表头信息网格：6 格，标签 + 值 ---- */
.p-head { width: 100%; border-collapse: collapse; table-layout: fixed; margin-bottom: 0; }
.p-head td {
  border: 1px solid #c8d2de; padding: 6px 10px; font-size: 12px; background: #fff;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-head .k { color: #6b7280; font-size: 11.5px; margin-right: 3px; }
.p-head .k::after { content: "："; }
.p-head b { font-weight: 700; color: #111827; }

/* ---- 明细表 ---- */
.p-items { width: 100%; border-collapse: collapse; margin-top: -1px; table-layout: fixed; }
.p-items thead th {
  background: #eef2f7; border: 1px solid #c8d2de; padding: 6px 5px;
  font-size: 11.5px; font-weight: 600; color: #334155; text-align: center; white-space: nowrap;
}
.p-items tbody td {
  border: 1px solid #c8d2de; padding: 5px 7px; font-size: 12px; vertical-align: middle;
  word-break: break-word;
}
.p-items tbody td.num { white-space: nowrap; }
.p-items tbody tr:nth-child(even) td { background: #fcfdff; }
.p-items tfoot td { border: 1px solid #c8d2de; padding: 6px 6px; font-size: 12.5px; background: #f6f8fb; }
.p-items .num { text-align: right; font-variant-numeric: tabular-nums; }
.p-items .ctr { text-align: center; }
.p-items .left { text-align: left; }

/* ---- 大写 ---- */
.p-upper { margin-top: 6px; font-size: 12px; }
.p-upper b { letter-spacing: 1px; }

/* ---- 随单费用 ---- */
.p-sub { margin-top: 10px; }
.p-sub-h { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.p-fee { width: 100%; border-collapse: collapse; }
.p-fee th, .p-fee td { border: 1px solid #c8d2de; padding: 4px 8px; font-size: 11.5px; }
.p-fee th { background: #f6f8fb; text-align: center; font-weight: 500; color: #4b5563; }
.p-fee .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- 备注 / 收付 / 签章 ---- */
.p-note { margin-top: 6px; font-size: 11.5px; color: #4b5563; line-height: 1.7; }
.p-note.p-tax { color: #6b7280; }
.p-sign { display: flex; justify-content: flex-end; margin-top: 28px; }
.p-sign-cell { font-size: 12px; color: #374151; }
.p-sign-cell span { display: inline-block; width: 130px; border-bottom: 1px solid #6b7280; }
.p-foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding-top: 6px; border-top: 1px dashed #d5dce5;
  font-size: 10.5px; color: #9ca3af;
}

/* ---- 作废水印 ---- */
.p-void {
  position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-22deg);
  font-size: 78px; font-weight: 800; color: rgba(220, 38, 38, .13);
  letter-spacing: 16px; pointer-events: none; user-select: none; white-space: nowrap;
}

@media print {
  .paper { border: none; box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .p-items tbody tr:nth-child(even) td { background: #fff; }
  .p-sign { page-break-inside: avoid; }
}
