/* 打印视图样式（配合 admin/print.js）
 *
 * 分两半看：
 *  - 屏幕上：#printView 是一层浮层，顶部一条工具栏（纸张切换 / 打印 / 关闭），
 *    下面是「纸」。票和单据用 mm 做单位，屏幕上看到的比例就是打印出来的比例。
 *  - @media print：把后台外壳（导航、面板、弹层）整块藏掉，只留 #printView，
 *    并按纸张控制分页。@page 的 size 由 print.js 动态写在 <style id="pvPageStyle"> 里。
 */

/* ---------------- 浮层与工具栏（只在屏幕上） ---------------- */
#printView { position: fixed; inset: 0; z-index: 200; background: #eceef1; overflow: auto; }
.pv-bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  background: #fff; padding: 12px 16px; border-bottom: 1px solid #e8eaed; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.pv-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #5c6269; }
.pv-sheet { margin: 16px auto; }

/* ---------------- 纸张模式 ---------------- */
/* 标签模式：一票一页，屏幕上竖着排，便于逐张核对 */
.pv-sheet-label { width: max-content; }
.pv-sheet-label .pv-cell { display: block; margin: 0 auto 6mm; }
/* A4 一页多张：纸宽固定 210mm，票按行排下去 */
.pv-sheet-a4 { width: 210mm; background: #fff; padding: 8mm; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.pv-sheet-a4 .pv-cell { display: inline-block; vertical-align: top; margin: 0 2mm 2mm 0; }
/* A4 单据：一张纸一份 */
.pv-sheet-doc { width: 210mm; background: #fff; padding: 12mm; box-shadow: 0 2px 10px rgba(0,0,0,.12); }

/* ---------------- 菲票 ---------------- */
.pv-ticket { box-sizing: border-box; background: #fff; overflow: hidden; padding: 1.6mm 2mm;
  border: 1px dashed #b9bfc7; display: flex; flex-direction: column; justify-content: space-between;
  font-family: "Microsoft YaHei", sans-serif; color: #000; }
.pv-size-60x40 .pv-ticket, .pv-sheet-a4 .pv-ticket { width: 60mm; height: 40mm; font-size: 2.9mm; }
.pv-size-70x50 .pv-ticket { width: 70mm; height: 50mm; font-size: 3.3mm; }
.pv-t-top { display: flex; justify-content: space-between; align-items: baseline; }
.pv-t-factory { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.pv-t-qty { font-weight: 700; }
.pv-t-style { font-size: 1.35em; font-weight: 700; line-height: 1.1; }
.pv-t-line { display: flex; justify-content: space-between; gap: 1mm; }
.pv-t-code { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
/* 条码位图按 3 倍模块宽出图（见 barcode.js），这里只管把它铺满票宽 */
.pv-bc { display: block; width: 100%; height: 9mm; }
.pv-size-70x50 .pv-bc { height: 12mm; }
.pv-bc-err { color: #c00; font-size: .85em; line-height: 1.2; }
/* 票号文字：条码磨花时车间照着这一行手输补录，所以要足够大、等宽、不换行 */
.pv-t-no { font-family: Consolas, Menlo, monospace; font-size: 1.05em; font-weight: 700;
  letter-spacing: .2px; text-align: center; white-space: nowrap; }

/* ---------------- 工资条 ---------------- */
.pv-payslip { box-sizing: border-box; width: 92mm; background: #fff; padding: 3mm;
  border: 1px dashed #b9bfc7; font-size: 3mm; color: #000; }
.pv-p-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 1.5mm; }
.pv-p-line { margin: 1mm 0; }
.pv-p-name { font-size: 1.5em; font-weight: 700; margin: 1mm 0; }

/* ---------------- 单据（派工条 / 订单 / 出货单） ---------------- */
.pv-doc { color: #000; font-size: 3.2mm; }
.pv-d-title { font-size: 6mm; font-weight: 700; text-align: center; }
.pv-d-sub { font-size: 4.4mm; text-align: center; margin: 1mm 0 4mm; letter-spacing: 2px; }
.pv-d-total { margin-top: 2mm; font-weight: 700; text-align: right; }
.pv-kv { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
.pv-kv th, .pv-kv td { border: 1px solid #333; padding: 1.6mm 2mm; text-align: left; }
.pv-kv th { width: 18mm; background: #f2f3f5; font-weight: 500; white-space: nowrap; }
.pv-tbl { width: 100%; border-collapse: collapse; }
.pv-tbl th, .pv-tbl td { border: 1px solid #333; padding: 1.4mm 2mm; text-align: left; }
.pv-tbl thead th, .pv-tbl tfoot th { background: #f2f3f5; font-weight: 500; }
.pv-r { text-align: right; }
.pv-c { text-align: center; color: #666; }
/* 工资条里的小表格不要外框太重，省墨也省地方 */
.pv-payslip .pv-tbl th, .pv-payslip .pv-tbl td { padding: 1mm 1.5mm; }
.pv-sign { display: flex; flex-wrap: wrap; gap: 6mm; margin-top: 4mm; }
.pv-sign-wide { margin-top: 12mm; }

/* ---------------- 车间告示：入职邀请码 ----------------
 * 贴在墙上的纸，看的人站在两米开外，所以码要大到一眼能认全。
 * 不用 mm 字号的小单位堆细节：这张纸上只有「码」和「四步」两件事要读得清。
 */
.pv-notice { font-size: 4mm; line-height: 1.7; }
.pv-n-label { margin-top: 6mm; text-align: center; font-size: 5mm; letter-spacing: 4px; color: #333; }
/* 等宽 + 大字距：8 位码逐位分开，抄的人不会把 M 和 N 挤成一团 */
.pv-n-code { font-family: Consolas, Menlo, monospace; font-size: 26mm; font-weight: 700;
  letter-spacing: 6mm; text-align: center; line-height: 1.1; margin: 2mm 0 0 6mm; word-break: break-all; }
.pv-n-meta { text-align: center; font-size: 3.6mm; color: #333; margin-bottom: 8mm; }
.pv-n-body { display: flex; gap: 8mm; align-items: flex-start; }
.pv-n-steps { flex: 1; min-width: 0; }
.pv-n-step { margin-bottom: 3mm; }
.pv-n-step b:first-child { display: inline-block; width: 7mm; height: 7mm; line-height: 7mm;
  margin-right: 2mm; border-radius: 50%; background: #333; color: #fff; text-align: center; font-size: 3.6mm; }
/* 小程序码得去微信后台生成，系统里没有，所以留一个实框让老板把印出来的码剪下来贴上 */
.pv-n-qr-box { flex-shrink: 0; width: 34mm; height: 34mm; border: 1px dashed #999;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 3.2mm; color: #888; line-height: 1.5; }
.pv-n-note { margin-top: 8mm; padding-top: 3mm; border-top: 1px solid #ccc;
  font-size: 3.4mm; color: #333; }


/* ---------------- 打印 ---------------- */
@media print {
  /* 只在打印视图打开时才藏后台外壳：否则用户在普通页面按 Ctrl+P 会打出一张空白纸 */
  body.pv-open > *:not(#printView) { display: none !important; }
  body.pv-open { background: #fff; }
  body.pv-open #printView { position: static; background: #fff; overflow: visible; }
  /* 工具栏、以及任何标了 data-print-hide 的东西都不上纸 */
  .pv-bar, [data-print-hide] { display: none !important; }

  .pv-sheet { margin: 0; }
  .pv-sheet-a4, .pv-sheet-doc { width: auto; padding: 0; box-shadow: none; }
  .pv-sheet-label { width: auto; }

  /* 票/条的虚线边框是屏幕上用来看边界的，不上纸——不干胶本身就是一张票 */
  .pv-ticket, .pv-payslip { border: none; }
  /* 一张票绝不能被切成两页 */
  .pv-cell, .pv-doc, .pv-payslip, .pv-ticket { page-break-inside: avoid; break-inside: avoid; }

  /* 标签模式：一票一页 */
  .pv-sheet-label .pv-cell { margin: 0; page-break-after: always; break-after: page; }
  .pv-sheet-label .pv-cell:last-child { page-break-after: auto; break-after: auto; }

  /* A4 一页多张：剪开要用，虚线保留一条细实线做裁切参考 */
  .pv-sheet-a4 .pv-cell { border: 1px solid #ccc; margin: 0 1mm 1mm 0; }
}
