/* ============================================================
   print.css —— 打印引擎样式（纸型 / 预览容器 / 套打 / 针式 / 标签）
   ------------------------------------------------------------
   核心：不再对整页 window.print()
     打印时只放行 body 顶层的 #print-root，其余（含 .mask 遮罩）全部隐藏
     —— 修复「详情弹窗打印出来是整页缩略 + 半透明遮罩」的 P0 缺陷（D02）
   ============================================================ */

/* -------------------------------------------------- 屏幕：预览容器 */
.print-bar {
  padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel-2, #f8fafc);
}
.print-scroll {
  max-height: 62vh; overflow: auto; padding: 14px;
  background: #e5e7eb; border-radius: 6px;
}
.print-preview {
  background: #fff; margin: 0 auto;
  box-shadow: 0 2px 14px rgba(15, 23, 42, .18);
  padding: 10mm; box-sizing: border-box;
  color: #0f172a; font-size: 12px; line-height: 1.6;
}
.print-preview[data-paper="A4"] { width: 210mm; min-height: 297mm; }
.print-preview[data-paper="A5"] { width: 148mm; min-height: 210mm; }
.print-preview[data-paper="A4H"] { width: 297mm; min-height: 210mm; }
.print-preview[data-paper="TRI"] { width: 241mm; min-height: 140mm; }
.print-preview[data-paper="LAB100"] { width: 100mm; min-height: 80mm; padding: 4mm; }
.print-preview[data-paper="LAB60"] { width: 60mm; min-height: 40mm; padding: 3mm; font-size: 10px; }

/* -------------------------------------------------- 单据版式 */
.pt-doc { font-size: 12px; color: #0f172a; }
.pt-hd { position: relative; border-bottom: 2px solid #0f172a; padding-bottom: 8px; margin-bottom: 10px; }
.pt-co { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.pt-co-sub { font-size: 11px; font-weight: 400; color: #475569; margin-top: 2px; }
.pt-title {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  font-size: 20px; font-weight: 700; letter-spacing: 3px;
}
.pt-lian { font-size: 12px; font-weight: 400; letter-spacing: 0; color: #475569; }
.pt-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; font-size: 11px; color: #334155; }
.pt-meta b { font-weight: 600; }
.pt-bc-wrap { margin-top: 6px; }
.pt-bc { display: block; }

.pt-fields {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 16px; margin-bottom: 10px; border: 1px solid #cbd5e1; padding: 8px 10px;
}
.pt-fi { display: flex; gap: 8px; font-size: 11.5px; padding: 2px 0; border-bottom: 1px dashed #e2e8f0; }
.pt-fi.wide { grid-column: 1 / -1; }
.pt-fk { color: #64748b; min-width: 88px; }
.pt-fv { font-weight: 600; word-break: break-all; }

.pt-sec-hd {
  font-size: 12.5px; font-weight: 700; margin: 12px 0 5px; padding-left: 7px;
  border-left: 3px solid #2563eb;
}
.pt-cnt { font-weight: 400; font-size: 11px; color: #64748b; margin-left: 8px; }

.pt-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.pt-table th, .pt-table td {
  border: 1px solid #94a3b8; padding: 4px 6px; text-align: left; word-break: break-all;
}
.pt-table th { background: #f1f5f9; font-weight: 600; }
.pt-table td.num, .pt-table th.num { text-align: right; font-family: Consolas, "Courier New", monospace; }
.pt-table tfoot td { background: #f8fafc; font-weight: 700; }
.pt-table .ctr { text-align: center; }

.pt-total {
  display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; padding: 8px 10px;
  border: 1px solid #cbd5e1; background: #f8fafc; font-size: 12px;
}
.pt-upper { color: #b91c1c; font-weight: 600; }

.pt-note { font-size: 11.5px; color: #334155; border: 1px dashed #cbd5e1; padding: 8px 10px; min-height: 40px; }

.pt-sign { display: flex; gap: 26px; margin-top: 26px; font-size: 11.5px; color: #475569; }
.pt-sg { flex: 1; }
.pt-line { border-bottom: 1px solid #64748b; min-height: 26px; padding: 2px 4px; color: #0f172a; font-weight: 600; }

/* -------------------------------------------------- 标签模板 */
.pt-label { padding: 2mm 0; }
.pt-lb-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; word-break: break-all; }
.pt-lb-row { display: flex; gap: 8px; font-size: 11px; line-height: 1.5; }
.pt-lb-row span { color: #64748b; min-width: 32px; }
.pt-lb-bc { margin-top: 5px; }

/* -------------------------------------------------- 套打：只留字符，去边框/底色 */
#print-root.pt-overlay .pt-fields,
#print-root.pt-overlay .pt-note,
#print-root.pt-overlay .pt-total,
#print-root.pt-overlay .pt-hd { border: 0 !important; background: transparent !important; }
#print-root.pt-overlay .pt-table th,
#print-root.pt-overlay .pt-table td { border: 0 !important; background: transparent !important; }
#print-root.pt-overlay .pt-table th { font-weight: 400; }
#print-root.pt-overlay .pt-sign .pt-line { border-bottom: 0 !important; }

/* 针式：等宽 + 纯黑 */
#print-root.pt-dot, #print-root.pt-dot * {
  font-family: Consolas, "Courier New", monospace !important;
  color: #000 !important;
}
#print-root.pt-dot .pt-table th { background: transparent !important; }
#print-root.pt-dot .pt-total { background: transparent !important; }

/* -------------------------------------------------- 打印：只放行 #print-root */
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; position: static !important; }
  #print-root .pt-copy { page-break-after: always; break-after: page; }
  #print-root .pt-copy:last-child { page-break-after: auto; break-after: auto; }
  #print-root .no-print { display: none !important; }
  #print-root, #print-root * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* 兜底：彻底屏蔽弹窗遮罩与侧栏（避免个别浏览器对 body>*:not() 支持差异） */
  .mask, .sidebar, .topbar, .toolbar, .modal-ft, #toasts { display: none !important; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
}

/* -------------------------------------------------- 权限授权树 */
.perm-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2, #f8fafc);
}
.perm-tree { max-height: 54vh; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.pt-g { border-bottom: 1px solid var(--border-2, #e2e8f0); }
.pt-gh {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  background: var(--panel-2, #f8fafc); cursor: pointer; user-select: none;
}
.pt-gt, .pt-mt, .pt-a { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.pt-gt { font-weight: 700; font-size: 13px; }
.pt-sum { margin-left: auto; }
.pt-ms { display: none; padding: 4px 10px 10px 26px; }
.pt-g.open .pt-ms { display: block; }
.pt-m { padding: 5px 0; border-bottom: 1px dashed var(--border-2, #e2e8f0); }
.pt-m:last-child { border-bottom: 0; }
.pt-mh { display: flex; align-items: center; }
.pt-mt { font-weight: 600; min-width: 150px; }
.pt-acts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-left: 8px; }
.pt-a { font-size: 12px; color: var(--text-2, #475569); }
/* 隐藏成员（已并入多页签页的模块）：授权界面内标注「页签」，区别于独立菜单项 */
.pt-m-tab .pt-mh { opacity: .92; }
.pt-badge {
  margin-left: 6px; padding: 1px 6px; border-radius: 8px; font-size: 11px; font-weight: 500;
  color: var(--primary, #2563eb); background: var(--primary-weak, #eff6ff);
  border: 1px solid var(--border-2, #e2e8f0);
}
