/* ============================================================
   化学品领用记录 — 样式表
   版式基准：原件 PDF 像素实测（300dpi，A4 纵向 210×297mm）
     表格左右边界   37.0mm ~ 177.1mm（宽 140.1mm）
     页眉文字       28.0 ~ 31.1mm，页眉横线 32.0mm
     标题           35.2 ~ 40.0mm
     表格顶         47.0mm，表头行 6.5/6.4mm，数据行 9.6mm
     表格底         约 271mm，页脚横线 271.5mm，两行页脚文字
     列宽比例       14.98 / 15.10 / 16.68 / 17.04 / 23.08 / 13.12 %
   ============================================================ */

:root {
  --c-primary: #1a56db;
  --c-primary-dark: #1544a8;
  --c-ink: #1f2430;
  --c-ink-2: #4a5262;
  --c-ink-3: #79808f;
  --c-line: #c9ced8;
  --c-line-soft: #e6e9ef;
  --c-bg: #eef1f6;
  --c-surface: #fff;
  --c-danger: #c92a2a;
  --c-ok: #1f9d55;
  --c-warn: #c47f0a;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .07);
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  --font-print: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --c-grid: #000;
  --c-th-bg: #f5f5f5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

/* ================= 工具栏 ================= */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line-soft);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--c-primary);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 15px; font-weight: 600; }
.brand-text span { font-size: 11.5px; color: var(--c-ink-3); }

.tb-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================= 按钮 ================= */
.btn {
  appearance: none;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .14s, border-color .14s;
  white-space: nowrap;
}
.btn:hover { background: #f6f8fb; border-color: #b6bdcc; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #a51f1f; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; margin-top: 4px; }
.btn-icon { width: 30px; padding: 5px 0; text-align: center; font-size: 15px; line-height: 1; }

/* ================= 状态条 ================= */
.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 20px;
  font-size: 12.5px;
  color: var(--c-ink-2);
  background: #f7f9fc;
  border-bottom: 1px solid var(--c-line-soft);
}
.statusbar .spacer { flex: 1; }
.statusbar .stat { color: var(--c-ink-3); }
.statusbar .stat b { color: var(--c-ink); font-weight: 600; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-ok);
  box-shadow: 0 0 0 3px rgba(31, 157, 85, .14);
  transition: background .2s, box-shadow .2s;
}
.dot.saving { background: var(--c-warn); box-shadow: 0 0 0 3px rgba(196, 127, 10, .16); }
.dot.dirty { background: var(--c-danger); box-shadow: 0 0 0 3px rgba(201, 42, 42, .14); }

/* ================= 工作区 ================= */
.workspace {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 20px;
}
.main-col { flex: 1; min-width: 0; }

.panel {
  width: 268px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 66px;
}
.panel-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.panel-card h3 {
  margin: 0 0 11px;
  font-size: 13px;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-line-soft);
}

.ctl {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--c-ink);
  padding: 7px 9px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: #fff;
  transition: border-color .14s, box-shadow .14s;
}
.ctl:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(26, 86, 219, .12); }
select.ctl { cursor: pointer; }
.ctl-inline { width: auto; min-width: 220px; }

.field { display: block; margin-bottom: 9px; }
.field > span { display: block; font-size: 11.5px; color: var(--c-ink-3); margin-bottom: 4px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.panel-actions { display: flex; gap: 8px; margin-top: 10px; }
.panel-actions .btn { flex: 1; }

.hint { font-size: 11.5px; color: var(--c-ink-3); margin: 8px 0 0; line-height: 1.5; }
.hint-top { margin: -4px 0 10px; }
.hint.err { color: var(--c-danger); }
.hint.ok { color: var(--c-ok); }

.overview { display: flex; flex-direction: column; gap: 8px; }
.ov-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.ov-row .k { color: var(--c-ink-2); }
.ov-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-sep { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--c-line-soft); }
.ov-empty { color: var(--c-ink-3); font-size: 12.5px; }

/* ================= 记录块导航 ================= */
.blockbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.blockbar .spacer { flex: 1; }
.blockbar-sep { width: 1px; height: 20px; background: var(--c-line-soft); margin: 0 3px; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--c-ink-2); cursor: pointer; }
.switch input { cursor: pointer; }

/* ================= 纸张 ================= */
.sheet-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; }

.sheet {
  width: 210mm;
  height: 297mm;
  background: #fff;
  padding: 20mm 20mm 15mm;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .1), 0 16px 48px rgba(16, 24, 40, .1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet.is-hidden { display: none; }
.sheet-idx {
  font-size: 11px;
  color: var(--c-ink-3);
  text-align: center;
  margin-top: -12px;
  margin-bottom: 10px;
}
.empty-sheet {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--c-ink-3);
  font-size: 14px;
}

/* 页眉 */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 9pt;
  color: #000;
  padding-bottom: 0.8mm;
  border-bottom: 1px solid var(--c-grid);
  flex-shrink: 0;
}
.doc-header .dh-left { font-weight: 600; }

/* 标题 */
.doc-title {
  margin: 3.2mm 0 5.2mm;
  font-family: var(--font-print);
  font-size: 16pt;
  font-weight: 700;
  color: #000;
  line-height: 1.05;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

/* ================= 表格 ================= */
.form-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-print);
  color: #000;
  flex-shrink: 0;
}
.form-table th, .form-table td {
  border: 1px solid var(--c-grid);
  padding: 0;
  text-align: center;
  vertical-align: middle;
}
.form-table thead th {
  font-size: 10pt;
  font-weight: 700;
  background: var(--c-th-bg);
  padding: 0 1mm;
  white-space: nowrap;
}
/* 表头第一行的值格（白底） */
.form-table thead td.hv-cell { background: #fff; }
.form-table .hr1 th { height: 7mm; }
.form-table .hr2 th { height: 7mm; }

.form-table tbody tr { height: 7mm; }
.form-table tbody td { position: relative; padding: 0; }

.cell {
  width: 100%;
  height: 6.6mm;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 9.5pt;
  color: #000;
  text-align: center;
  padding: 0 0.8mm;
  outline: none;
  border-radius: 0;
}
.cell:focus { background: #eef4ff; box-shadow: inset 0 0 0 0.25mm var(--c-primary); }
.cell::placeholder { color: #c2c7d0; }
.cell[readonly] { color: #000; }
.cell-left { text-align: left; padding-left: 2mm; }

/* 表头第一行的值输入格（几何与原件一致，字体略小以容纳长文本） */
.form-table thead td.hv-cell { padding: 0; }
.hv {
  width: 100%;
  height: 6.6mm;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 9pt;
  color: #000;
  text-align: center;
  padding: 0 0.8mm;
  outline: none;
}
.hv:focus { background: #eef4ff; box-shadow: inset 0 0 0 0.25mm var(--c-primary); }
.hv::placeholder { color: #c2c7d0; }
.hv-sel {
  width: 100%; height: 6.6mm;
  border: 0; background: transparent;
  font-family: inherit; font-size: 8.5pt; color: #000;
  text-align: center;
  appearance: none; -webkit-appearance: none;
  cursor: pointer; outline: none;
  padding: 0 0.8mm;
}
.hv-sel:focus { background: #eef4ff; box-shadow: inset 0 0 0 0.25mm var(--c-primary); }
.hv-sel option { font-size: 12pt; }

.cell-sel {
  width: 100%; height: 6.6mm;
  border: 0; background: transparent;
  font-family: inherit; font-size: 8.5pt; color: #000;
  text-align: center;
  appearance: none; -webkit-appearance: none;
  cursor: pointer; outline: none;
  padding: 0 0.6mm;
}
.cell-sel:focus { background: #eef4ff; box-shadow: inset 0 0 0 0.25mm var(--c-primary); }
.cell-sel option { font-size: 12pt; }

/* 打印补齐行 */
tr.pad-row td { height: 7mm; }

/* 日期：屏幕用原生日期控件，打印用纯文本 ISO 格式（YYYY-MM-DD） */
.date-print { display: none; }

td.warn-cell { background: #fff6e0; }
tr.row-warn td.warn-cell { background: #fff6e0; }

/* 行号（不打印） */
.row-tag {
  position: absolute;
  left: -1px; top: 50%;
  transform: translate(-100%, -50%);
  font-size: 10px;
  color: var(--c-ink-3);
  padding-right: 5px;
  user-select: none;
}

/* ================= 页脚 ================= */
.doc-footer {
  margin-top: auto;
  padding-top: 1.2mm;
  border-top: 1px solid var(--c-grid);
  font-size: 9pt;
  color: #000;
  flex-shrink: 0;
}
.df-line {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: baseline;
  line-height: 1.5;
}
.df-line1 span:nth-child(2) { text-align: center; }
.df-line1 span:nth-child(3), .df-line2 span:nth-child(3) { text-align: right; }

/* ================= 弹窗 ================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #fff;
  border-radius: 10px;
  width: min(680px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .3);
}
.modal-box-sm { width: min(400px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-line-soft);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-close {
  border: 0; background: transparent; cursor: pointer;
  font-size: 16px; color: var(--c-ink-3); line-height: 1;
  padding: 4px 6px; border-radius: 4px;
}
.modal-close:hover { background: #f1f3f7; color: var(--c-ink); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-tip { margin: 0 0 12px; font-size: 12.5px; color: var(--c-ink-2); line-height: 1.6; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 12px 18px;
  border-top: 1px solid var(--c-line-soft);
  background: #fafbfd;
}
.modal-foot .hint { margin: 0; margin-right: auto; }

.dict-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dict-table th, .dict-table td {
  border: 1px solid var(--c-line-soft);
  padding: 5px 7px;
  text-align: left;
}
.dict-table th { background: #f7f9fc; font-weight: 600; color: var(--c-ink-2); font-size: 12px; }
.dict-table input, .dict-table select {
  width: 100%; border: 0; background: transparent;
  font-family: inherit; font-size: 12.5px; padding: 2px 0; outline: none;
}
.dict-table select { cursor: pointer; }
.dict-table .del {
  border: 0; background: transparent; color: var(--c-danger);
  cursor: pointer; font-size: 14px; padding: 0 4px;
}
.dict-add {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.2fr .6fr auto;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--c-line-soft);
}
textarea.ctl { font-family: ui-monospace, Consolas, monospace; font-size: 12px; resize: vertical; }

/* ================= 响应式 ================= */
.tb-toggle { display: none; }

@media (max-width: 1280px) {
  .workspace { flex-direction: column; align-items: stretch; }
  .panel { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; }
  .panel-card { flex: 1; min-width: 250px; }
}

/* ---------- 手机 / 平板竖屏 ---------- */
@media (max-width: 700px) {
  .toolbar { padding: 9px 12px; gap: 10px; }
  .tb-right { width: 100%; }
  .tb-right .btn { flex: 1; }
  .statusbar { padding: 7px 12px; font-size: 12px; }
  .workspace { padding: 12px; }
  .sheet-wrap { overflow-x: auto; }
}

/* 真正的手机端（扫码进入）布局 */
@media (max-width: 820px) {
  /* 工具栏：只留品牌 + 「更多」按钮，其余折叠成抽屉 */
  .toolbar { padding: 8px 12px; gap: 8px; flex-wrap: nowrap; position: relative; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; }
  .brand-text strong { font-size: 14px; }
  .brand-text span { font-size: 10.5px; }
  .tb-toggle { display: inline-block; margin-left: auto; flex-shrink: 0; }

  /* 抽屉以绝对定位展开，不挤动品牌行与「更多」按钮 */
  .tb-right {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 10px 12px 12px;
    gap: 6px;
    background: var(--c-surface);
    border-top: 1px solid var(--c-line-soft);
    border-bottom: 1px solid var(--c-line-soft);
    box-shadow: 0 10px 24px rgba(16, 24, 40, .12);
  }
  .toolbar.open .tb-right { display: flex; flex-wrap: wrap; }
  .tb-right .btn { flex: 1 1 calc(50% - 6px); font-size: 13px; padding: 9px 9px; }
  .tb-right .tb-sep { display: none; }
  .tb-right .tb-user { width: 100%; font-size: 12.5px; }
  .tb-right #btnLogout { flex: 0 0 auto; }

  /* 状态条精简 */
  .statusbar { gap: 10px; padding: 6px 12px; font-size: 11.5px; flex-wrap: wrap; }
  .statusbar .stat:nth-of-type(1) { display: none; }

  /* 记录块导航 */
  .workspace { padding: 10px; gap: 12px; }
  .blockbar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .blockbar .switch { width: 100%; font-size: 12px; }
  .blockbar-sep { display: none; }

  /* A4 纸张：按屏宽等比缩放（JS 写入 transform） */
  .sheet-wrap { overflow-x: visible; }
  .sheet-holder { overflow: hidden; }
  .sheet { box-shadow: 0 1px 4px rgba(16,24,40,.12); }

  /* 侧栏：领用登记置顶，成为一个直立的表单卡片 */
  .panel { flex-direction: column; gap: 12px; }
  .panel-card { padding: 14px; }
  .panel-card h3 { font-size: 14px; }
  .field { flex-direction: column; align-items: stretch; gap: 5px; }
  .field > span { width: auto; text-align: left; font-size: 12.5px; }
  .ctl { font-size: 16px; /* 防 iOS 聚焦缩放 */ padding: 9px 10px; }
  .btn-primary.btn-block { padding: 12px; font-size: 15px; }

  /* 弹窗全宽 */
  .modal-box { width: 94vw; max-height: 88vh; }
  .dict-add { flex-direction: column; }
  .dict-table { font-size: 12px; }
}

@media (max-width: 420px) {
  .tb-right .btn { flex: 1 1 calc(50% - 6px); }
}

/* ================= 微信内打印引导 ================= */
.wx-tip-mask {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, .58);
}
.wx-tip-mask[hidden] { display: none; }
.wx-tip-box {
  width: 340px;
  max-width: 92vw;
  background: #fff;
  border-radius: 14px;
  padding: 26px 22px 20px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .32);
}
.wx-tip-icon { font-size: 34px; text-align: center; line-height: 1; margin-bottom: 10px; }
.wx-tip-box h3 { margin: 0 0 8px; font-size: 16.5px; text-align: center; color: var(--c-ink); }
.wx-tip-box p { margin: 0 0 10px; font-size: 13px; color: var(--c-ink-2); text-align: center; }
.wx-tip-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 12.8px;
  line-height: 1.75;
  color: var(--c-ink-2);
}
.wx-tip-steps b { color: var(--c-primary); }
.wx-tip-box .btn + .btn { margin-top: 8px; }

/* 微信内常驻提示条 */
.wx-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  color: #7a4a00;
  background: #fff8e6;
  border-bottom: 1px solid #f3e0b5;
}
.wx-bar.show { display: flex; }
.wx-bar .wx-bar-x { margin-left: auto; cursor: pointer; color: #a07a2a; padding: 0 4px; }

/* ================= 打印 ================= */
@page { size: A4 portrait; margin: 0; }

@media print {
  html, body { background: #fff; margin: 0; padding: 0; }
  .toolbar, .statusbar, .panel, .modal, .row-tag, .blockbar, .sheet-idx { display: none !important; }
  .workspace { display: block; padding: 0; }
  .sheet-wrap { display: block; gap: 0; }
  .sheet-holder { overflow: visible !important; width: auto !important; height: auto !important; margin: 0 !important; }
  .sheet { transform: none !important; }
  .main-col { width: 100%; }

  .sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 20mm 20mm 15mm;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
    display: flex !important;
  }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet.is-hidden { display: flex !important; }

  .form-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
  .form-table thead { display: table-header-group; }

  .cell, .hv, .hv-sel, .cell-sel {
    background: transparent !important;
    box-shadow: none !important;
    color: #000 !important;
  }
  .cell::placeholder, .hv::placeholder { color: transparent !important; }
  td.warn-cell { background: transparent !important; }

  /* 表头灰底与实黑网格在打印时保持 */
  .form-table thead th { background: var(--c-th-bg) !important; }

  /* 日期改为纯文本输出（YYYY-MM-DD），去掉原生控件 */
  input[type="date"].date-input { display: none !important; }
  .date-print {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 6.6mm;
    font-size: 9.5pt;
    color: #000;
  }
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------- 登录遮罩 ---------------- */
.login-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, .55);
}
.login-mask.hidden { display: none; }
.login-box {
  width: 360px;
  max-width: 92vw;
  background: #fff;
  border-radius: 12px;
  padding: 30px 26px 22px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .30);
  text-align: center;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 19px; color: #1f2a3a; }
.login-sub { margin: 8px 0 20px; color: #79808f; font-size: 12.5px; }
.login-label { display: block; text-align: left; font-size: 13px; color: #3a4250; margin-bottom: 7px; }
.login-input { width: 100%; margin-bottom: 16px; font-size: 14px; padding: 10px 12px; text-align: center; }
.login-tip { margin-top: 14px; color: #a0a6b0; font-size: 11.5px; }
.tb-user { font-size: 13px; color: #3a4250; margin: 0 2px; }
.tb-user b { color: #1f2a3a; }
.tb-sep { width: 1px; height: 22px; background: #e3e7ee; margin: 0 6px; }
.login-pwd { font-size: 13px; }
.login-pwd::placeholder { font-size: 12px; color: #b3b9c4; }

/* 领用数量 + 单位下拉 */
.qty-row { display: flex; gap: 6px; }
.qty-row .ctl { flex: 1; min-width: 0; }
.qty-unit-sel { flex: 0 0 64px !important; width: 64px; padding-left: 6px; padding-right: 4px; }
.qty-cell { position: relative; }
.qty-unit-tag {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: #8b96a6;
  pointer-events: none;
  background: #f2f4f7;
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.5;
}
@media print {
  .qty-unit-tag {
    background: none;
    border-radius: 0;
    font-size: 9pt;
    color: #000;
  }
}

/* 角色标签 */
.tb-role {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #0f5c4a;
  color: #fff;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 600;
  vertical-align: 1px;
  letter-spacing: .3px;
}
.tb-role:empty { display: none; }

/* 侧栏「最近领用」 */
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.rc-item {
  border: 1px solid var(--c-line-soft);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafbfc;
}
.rc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rc-name { font-size: 13px; font-weight: 600; color: var(--c-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-qty { font-size: 14px; font-weight: 700; color: #0f5c4a; flex-shrink: 0; }
.rc-meta { margin-top: 3px; font-size: 11.5px; color: #8b96a6; }

/* ================= 权限：记录表隐藏后的版式 ================= */
/* 非管理员：所有 admin-only 元素一律不显示 */
body.is-viewer .admin-only { display: none !important; }

/* 记录表关闭时，工作区只留领用登记，居中一列更好用 */
body.sheet-off .workspace { display: flex; justify-content: center; align-items: flex-start; }
body.sheet-off .main-col { display: none; }
body.sheet-off .panel {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  position: static;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
}
body.sheet-off .panel-card { flex: 1 1 300px; max-width: 420px; }
/* 非管理员：顶部不再展示记录块/流水等管理统计 */
body.is-viewer .statusbar .stat { display: none; }

@media (max-width: 820px) {
  body.sheet-off .workspace { padding: 12px; }
  body.sheet-off .panel { max-width: 100%; flex-direction: column; }
  body.sheet-off .panel-card { flex: 1 1 auto; max-width: 100%; }
}

/* 打印：记录表被隐藏时不输出任何页面，避免打出空白 A4 */
@media print {
  body.sheet-off #sheetArea { display: none !important; }
}

@media print {
  .login-mask { display: none !important; }
}
