/* ============================================================
   工牌：预览 / 打印
   尺寸：胸前别针牌 70 × 45 mm（横）｜挂绳工牌 54 × 86 mm（竖）
   ============================================================ */

/* ---------- 档案页「工牌」页签 ---------- */
.bdg-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bdg-preview { background: #fff; border: 1px solid var(--border, #e5e9f0); border-radius: 10px; padding: 14px; }
.bdg-sizebar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bdg-stage {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: #f7f9fc; border: 1px solid var(--border, #e5e9f0); border-radius: 10px; padding: 22px 12px 14px;
}
.bdg-paper {
  width: var(--w, 70mm); height: var(--h, 45mm);
  background: #fff; border-radius: 5px; overflow: hidden;
  box-shadow: 0 3px 14px rgba(15, 23, 42, .16);
}
.bdg-note { font-size: 11.5px; color: var(--text-3, #6b7280); text-align: center; }
.bdg-ops { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.bdg-link { margin-top: 10px; font-size: 11.5px; word-break: break-all; }
.bdg-link code { background: #f2f5fa; padding: 2px 6px; border-radius: 4px; }

.bdg-side { display: flex; flex-direction: column; gap: 12px; }
.bdg-box { background: #fff; border: 1px solid var(--border, #e5e9f0); border-radius: 10px; padding: 12px 14px; }
.bdg-box-t { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.bdg-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.bdg-chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 20px;
  background: #f2f5fa; color: var(--text-3, #6b7280); border: 1px solid transparent;
}
.bdg-chip.on { background: #eaf1ff; color: var(--primary); border-color: rgba(37, 99, 235, .25); font-weight: 600; }
.bdg-chip i { font-style: normal; color: #e5484d; margin-left: 2px; }

/* ---------- 牌面 ---------- */
.bdg {
  width: 100%; height: 100%; box-sizing: border-box; display: flex; flex-direction: column;
  background: #fff; color: #111827; font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  overflow: hidden;
}
.bdg-bar {
  display: flex; align-items: center; gap: 5px; padding: 4px 7px; flex: none;
  background: linear-gradient(135deg, #56A8FF, #1673E6 60%, #0B51BE); color: #fff;
}
.bdg-logo { width: 15px; height: 15px; border-radius: 3px; object-fit: contain; flex: none; background: #fff; }
.bdg-co { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.bdg-co b { font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdg-co small { font-size: 6.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdg-foot {
  flex: none; text-align: center; font-size: 6px; color: #9aa3b2; padding: 2px 4px; letter-spacing: .2px;
}
.bdg-photo {
  flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: #f2f5fa; color: #9aa3b2;
}
.bdg-photo img { width: 100%; height: 100%; object-fit: cover; }
.bdg-photo span { font-size: 26px; font-weight: 700; color: #8fa0b8; }

/* 横版 · 胸前别针牌 */
.bdg.pin .bdg-bar { height: 15px; }
.bdg.pin .bdg-main { flex: 1; display: flex; align-items: stretch; gap: 6px; padding: 5px 7px; min-height: 0; }
.bdg.pin .bdg-photo { width: 46px; height: 100%; border-radius: 4px; }
.bdg.pin .bdg-photo span { font-size: 20px; }
.bdg.pin .bdg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.bdg.pin .bdg-name { font-size: 17px; font-weight: 700; line-height: 1.05; letter-spacing: .5px; }
.bdg.pin .bdg-line { font-size: 7.5px; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdg.pin .bdg-no { font-size: 7px; color: #6b7280; font-family: Consolas, monospace; }
.bdg.pin .bdg-qr { width: 52px; flex: none; display: flex; align-items: center; justify-content: center; }
.bdg.pin .bdg-qr canvas, .bdg.pin .bdg-qr img, .bdg.pin .bdg-qr table { width: 50px !important; height: 50px !important; }

/* 竖版 · 挂绳工牌 */
.bdg.lanyard .bdg-bar { height: 20px; }
.bdg.lanyard .bdg-photo { height: 96px; margin: 7px auto 5px; width: 74px; border-radius: 6px; }
.bdg.lanyard .bdg-name {
  text-align: center; font-size: 19px; font-weight: 700; letter-spacing: 1px; line-height: 1.1; margin-top: 2px;
}
.bdg.lanyard .bdg-meta { padding: 5px 8px; display: flex; flex-direction: column; gap: 2px; }
.bdg.lanyard .bdg-meta div { display: flex; align-items: baseline; gap: 4px; font-size: 8px; }
.bdg.lanyard .bdg-meta span { color: #9aa3b2; width: 26px; flex: none; }
.bdg.lanyard .bdg-meta b { font-weight: 600; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bdg.lanyard .bdg-qr { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 2px; }
.bdg.lanyard .bdg-qr canvas, .bdg.lanyard .bdg-qr img, .bdg.lanyard .bdg-qr table { width: 84px !important; height: 84px !important; }
.bdg-qr-fail { font-size: 6px; color: #c0c6d0; text-align: center; }

/* ============================================================
   打印页 badge-print.html
   ============================================================ */
.bp-wrap { padding: 16px 18px 40px; }
.bp-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e5e9f0; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px;
}
.bp-bar .sp { flex: 1; }
.bp-sheet {
  width: 210mm; min-height: 297mm; background: #fff; margin: 0 auto; padding: 10mm;
  box-shadow: 0 2px 14px rgba(15, 23, 42, .12); box-sizing: border-box;
}
.bp-grid { display: flex; flex-wrap: wrap; gap: 5mm; align-content: flex-start; }
.bp-cell { position: relative; }
.bp-cell .bdg-paper {
  width: var(--w, 70mm); height: var(--h, 45mm);
  border: 1px dashed #c9d2e0; border-radius: 4px; box-shadow: none;
}
.bp-cell::after {
  content: attr(data-no); position: absolute; right: -1px; bottom: -9px;
  font-size: 7px; color: #b6bfcd; font-family: Consolas, monospace;
}
.bp-empty { padding: 40px; text-align: center; color: #6b7280; }
.bp-tip { font-size: 12px; color: #6b7280; line-height: 1.8; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  body { background: #fff; }
  .bp-bar { display: none !important; }
  .bp-wrap { padding: 0; }
  .bp-sheet { box-shadow: none; margin: 0; width: 210mm; min-height: 0; padding: 10mm; page-break-after: always; }
  .bp-sheet:last-child { page-break-after: auto; }
  .bp-cell .bdg-paper { border-color: #d8dee8; }
}

/* ============================================================
   扫码公开页 badge.html
   ============================================================ */
.pub-wrap { max-width: 420px; margin: 0 auto; padding: 22px 16px 40px; }
.pub-card {
  background: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(15, 23, 42, .1);
  overflow: hidden; border: 1px solid #e5e9f0;
}
.pub-head {
  background: linear-gradient(135deg, #56A8FF, #1673E6 60%, #0B51BE); color: #fff;
  padding: 16px 18px; display: flex; align-items: center; gap: 10px;
}
.pub-head img { width: 30px; height: 30px; border-radius: 6px; background: #fff; object-fit: contain; }
.pub-head b { font-size: 15px; display: block; }
.pub-head small { opacity: .85; font-size: 11.5px; }
.pub-body { padding: 18px; }
.pub-avatar {
  width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 10px; overflow: hidden;
  background: #eaf1ff; color: #1673E6; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700;
}
.pub-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pub-name { text-align: center; font-size: 20px; font-weight: 700; }
.pub-status { text-align: center; margin-top: 4px; }
.pub-kv { margin-top: 14px; border-top: 1px solid #eef1f6; }
.pub-kv div {
  display: flex; align-items: baseline; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #f2f5fa; font-size: 13.5px;
}
.pub-kv span { color: #8b95a5; width: 84px; flex: none; }
.pub-kv b { font-weight: 600; word-break: break-all; }
.pub-foot { padding: 12px 18px 18px; color: #8b95a5; font-size: 11.5px; line-height: 1.8; text-align: center; }
.pub-err { max-width: 420px; margin: 60px auto; text-align: center; color: #6b7280; }
.pub-err .ic { font-size: 42px; margin-bottom: 10px; }
