/* 进销存管理系统（PHP 版）样式 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: #2c3345; background: #eef1f6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f3f7; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar { width: 208px; background: #1f2735; color: #c7cede; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { padding: 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #2c3648; }
.brand-mark {
  background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff;
  font-weight: bold; padding: 6px 8px; border-radius: 6px; font-size: 13px;
}
.brand-text { font-size: 14px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 8px 0 24px; }

/* 一级菜单：可点击的主入口，字号/字重/对比度均高于二级菜单 */
.nav-title {
  padding: 11px 14px 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #d6ddeb;
  letter-spacing: .5px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 3px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.nav-title:hover { background: #273244; color: #fff; }
.nav-title:active { background: #223049; }
/* 当前展开的一级菜单 */
.nav-title.is-open { background: #273244; color: #fff; border-left-color: #3b82f6; }
.nav-arrow {
  font-size: 12px;
  font-weight: 400;
  color: #8a94a8;
  transition: color .15s ease;
}
.nav-title:hover .nav-arrow,
.nav-title.is-open .nav-arrow { color: #cbd5e1; }

/* 二级菜单容器：展开时左侧给出一条层级引导线 */
.nav-group { display: none; position: relative; }
.nav-group::before {
  content: '';
  position: absolute;
  left: 15px; top: 3px; bottom: 5px;
  width: 1px;
  background: #2d384d;
}
.nav a {
  position: relative;
  display: block;
  padding: 8px 14px 8px 30px;
  color: #c7cede;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: background-color .15s ease, color .15s ease;
}
.nav a:hover { background: #273244; color: #fff; text-decoration: none; }
.nav a.active {
  background: #2a3650; color: #fff;
  border-left-color: #3b82f6;
  font-weight: 600;
}

/* ---------- 主区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 54px; background: #fff; border-bottom: 1px solid #e3e7ee;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { font-size: 13px; color: #5a647a; }
.topbar-right .who { margin-right: 14px; }
.topbar-right a { margin-left: 14px; }
.content { padding: 18px 22px 40px; }

/* ---------- Flash ---------- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; position: relative; font-size: 13px; }
.flash-ok { background: #e6f7ed; color: #146c43; border: 1px solid #b7e4c7; }
.flash-error { background: #fdecec; color: #a4262c; border: 1px solid #f3b8b8; }
.flash-warn { background: #fff6e0; color: #8a6100; border: 1px solid #f2dd9b; }
.flash a { color: inherit; text-decoration: underline; }
.flash-close { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- 面板与表格 ---------- */
.panel { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; margin-bottom: 18px; }
.panel-head {
  padding: 13px 16px; border-bottom: 1px solid #edf0f5;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sub-title { margin: 18px 16px 8px; font-size: 14px; font-weight: 600; }
.docno { color: #2563eb; font-weight: 500; margin-left: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
.table thead th { background: #f7f9fc; color: #48526a; font-weight: 600; position: sticky; top: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table td.r, .table th.r { text-align: right; }
.table td.c, .table th.c { text-align: center; }
.table td.small { font-size: 12px; color: #6b7688; }
.table td.num { font-variant-numeric: tabular-nums; }
.table td.empty { text-align: center; color: #98a1b3; padding: 26px; }
.table td.diff { color: #d0342c; font-weight: 600; }
.table td.in { color: #146c43; }
.table td.out { color: #b25000; }
.table tfoot td { background: #f7f9fc; border-top: 2px solid #e3e7ee; }
.table .actions a { margin-right: 8px; font-size: 12px; }
.row-disabled td { color: #98a1b3; }
.row-zero td { color: #98a1b3; }
.table-foot { padding: 9px 16px; font-size: 12px; color: #8b94a7; background: #fbfcfe; border-top: 1px solid #edf0f5; border-radius: 0 0 8px 8px; }
.empty-big { padding: 40px; text-align: center; color: #6b7688; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.badge-ok { background: #e6f7ed; color: #146c43; }
.badge-draft { background: #eef1f6; color: #5a647a; }
.badge-void { background: #fdecec; color: #a4262c; }
.badge-warn { background: #fff6e0; color: #8a6100; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 6px 13px; border: 1px solid #d5dae4; border-radius: 5px;
  background: #fff; color: #333c4f; font-size: 13px; cursor: pointer; line-height: 1.5;
}
.btn:hover { background: #f5f7fa; text-decoration: none; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4fd8; }
.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #fff; border-color: #e5a5a5; color: #c0392b; }
.btn-danger:hover { background: #fdecec; }
.btn-block { width: 100%; }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-mini { border: 0; background: #f1f3f7; color: #a4262c; border-radius: 4px; cursor: pointer; padding: 2px 8px; font-size: 14px; }
.btn-mini:hover { background: #fdecec; }

/* ---------- 表单 ---------- */
.form { padding: 16px; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; flex-wrap: wrap; }
.form-row > label:first-child { width: 108px; color: #48526a; flex-shrink: 0; }
.form-row-inline { gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 24px; padding: 0 16px; }
.form-grid .form-row > label:first-child { width: 92px; }
.form-actions { padding: 14px 16px; border-top: 1px solid #edf0f5; display: flex; gap: 10px; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=file], select, textarea {
  border: 1px solid #d5dae4; border-radius: 5px; padding: 6px 9px; font-size: 13px;
  font-family: inherit; background: #fff; color: #2c3345; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
input[readonly], input[disabled], select[disabled] { background: #f5f7fa; color: #7a8499; }
textarea.code { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.55; width: 100%; }
input.num, .num { font-variant-numeric: tabular-nums; }
.w-60 { width: 60px; } .w-80 { width: 80px; } .w-100 { width: 100px; }
.w-110 { width: 110px; } .w-140 { width: 140px; } .w-240 { width: 240px; }
.hint { font-size: 12px; color: #8b94a7; }
/* 字号选择（打印设置/系统配置）：标签与下拉贴在一起，四个一档不换行 */
.fs-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #48526a; margin-right: 4px; }
.fs-item select { width: auto; padding: 3px 5px; font-size: 12.5px; }
/* ---------- 单据行：商品格输入联想（图1样式：格内输入，弹可选商品） ---------- */
.w-prod { position: relative; }
.pid-wrap { position: relative; }
.c-pid-kw {
  width: 100%; box-sizing: border-box; padding: 5px 8px; font-size: 13px; color: #2c3345;
  border: 1px solid #d7dce5; border-radius: 6px; background: #fff;
}
.c-pid-kw::placeholder { color: #9aa4b8; }
.c-pid-kw:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, .15); }
.pid-pop {
  position: absolute; left: 0; top: 100%; z-index: 60; min-width: 360px; max-width: 600px; margin-top: 3px;
  background: #fff; border: 1px solid #ccd6e8; border-radius: 7px; box-shadow: 0 10px 26px rgba(23, 43, 77, .16);
  max-height: 300px; overflow-y: auto; padding: 4px 0; display: none;
}
.pid-pop .pid-empty { padding: 10px 14px; font-size: 12.5px; color: #8b94a7; }
.pid-pop .pid-item { padding: 7px 14px; font-size: 13px; color: #2c3345; cursor: pointer; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.pid-pop .pid-item:hover, .pid-pop .pid-item.on { background: #eef4ff; }
/* 联想项左侧商品缩略图（有图才出 img；无图留同尺寸浅色占位，避免文字左右跳动） */
.pid-pop .pi-thumb {
  width: 26px; height: 26px; flex: 0 0 26px; object-fit: cover; border-radius: 4px;
  border: 1px solid #e0e5ee; background: #f3f5f9; display: block;
}
.pid-pop .pi-thumb-none { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 4px; background: #f3f5f9; display: block; }
.pid-pop .pi-code { color: #2563eb; font-weight: 600; min-width: 60px; }
.pid-pop .pi-name { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.pid-pop .pi-code em, .pid-pop .pi-name em { font-style: normal; background: #fff2b8; border-radius: 2px; }
.pid-pop .pi-meta { color: #8b94a7; font-size: 12px; margin-left: auto; }
.pid-pop .pid-new {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: #16a34a; cursor: pointer;
  border-top: 1px solid #e8edf5; margin-top: 3px; background: #f7fdf9;
}
.pid-pop .pid-new:hover { background: #ecfdf3; }
.c-pid-label { display: inline-block; }
/* 批次号联想：包裹框提供定位上下文，弹层复用 .pid-pop 的样式 */
.batch-wrap { position: relative; }
.batch-pop { min-width: 300px; }
.req { color: #d0342c; font-style: normal; margin-left: 2px; }
.check, .check-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #48526a; margin-right: 14px; }

/* ---------- 打印纸张指引 ---------- */
.paper-guide { margin: 4px 0 0 108px; max-width: 640px; background: #f7faff; border: 1px solid #d8e4fb; border-radius: 6px; padding: 12px 16px; font-size: 12.5px; line-height: 1.75; color: #48526a; }
.paper-guide-title { font-weight: 600; color: #2b5bbd; margin-bottom: 6px; }
.paper-guide ol { margin: 4px 0 4px 18px; padding: 0; }
.paper-guide b { color: #243046; }
.paper-guide code { background: #e8effc; border-radius: 3px; padding: 1px 5px; color: #2b5bbd; }
.paper-guide p { margin: 6px 0; }
.paper-table { border-collapse: collapse; margin: 6px 0; font-size: 12.5px; }
.paper-table th, .paper-table td { border: 1px solid #cfd9ea; padding: 4px 10px; text-align: left; }
.paper-table th { background: #eef3fc; color: #2b5bbd; font-weight: 600; }
.paper-table tr.on td { background: #e4edff; color: #1d3f8f; font-weight: 600; }

/* ---------- 筛选条 ---------- */
.filter {
  padding: 12px 16px; background: #fbfcfe; border-bottom: 1px solid #edf0f5;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px;
}
.filter label { color: #5a647a; }
.filter input[type=text] { width: 190px; }

/* ---------- 单据表头 ---------- */
.head-fields { padding: 14px 16px 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 20px; }
.head-fields .f label { display: block; font-size: 12px; color: #7a8499; margin-bottom: 3px; }
.head-fields .f input, .head-fields .f select { width: 100%; }
.head-fields .f .v { padding: 5px 0; min-height: 20px; }
.f-wide { grid-column: 1 / -1; }

/* ---------- 明细行 ---------- */
.lines-wrap { overflow-x: auto; }
.lines th, .lines td { vertical-align: middle; }
.lines select { min-width: 210px; max-width: 320px; }
.lines input[type=text], .lines input[type=date] { width: 100%; min-width: 70px; }
.lines .c-amt, .lines .c-book { display: inline-block; min-width: 60px; text-align: right; }
.lines .c-spec, .lines .c-unit { display: inline-block; font-size: 12px; color: #48526a; }
.w-no { width: 42px; text-align: center; }
/* 单据明细商品缩略图（只在界面显示，不进打印/导出） */
.w-pic { width: 42px; text-align: center; vertical-align: middle; }
.p-thumb-none { background: #f3f5f9; }
.w-spec { min-width: 90px; } .w-unit { width: 56px; }
.w-qty { width: 92px; } .w-price { width: 96px; } .w-amt { width: 104px; } .w-tax { width: 74px; }
.w-batch { width: 110px; } .w-exp { width: 124px; } .w-serial { width: 140px; }
.w-book { width: 88px; } .w-loc { width: 132px; } .w-remark { min-width: 110px; } .w-op { width: 42px; }
/* 合计行：明细表最后一行之上一行（原表尾合计已挪进表内） */
.lines tr.erp-total-row td { font-size: 13px; background: #f7f9fc; border-top: 2px solid #e3e7ee; font-weight: 700; }
.lines tr.erp-total-row td.r b { color: #1f4e79; }
.line-tools { padding: 11px 16px; display: flex; align-items: center; gap: 12px; }
.action-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.action-bar form { display: inline; }

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: #fff; border-radius: 8px; padding: 15px 16px; border: 1px solid #e3e7ee; border-top: 3px solid #2563eb; }
.card-label { font-size: 12px; color: #7a8499; margin-bottom: 7px; }
.card-value { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-unit { font-size: 12px; color: #98a1b3; margin-right: 3px; }
.card-blue { border-top-color: #2563eb; }
.card-navy { border-top-color: #1e293b; }
.card-green { border-top-color: #16a34a; }
.card-purple { border-top-color: #7c3aed; }
.card-orange { border-top-color: #ea8a00; }
.card-red { border-top-color: #dc2626; }

/* ---------- 布局辅助 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 16px; }
.quick-big { padding: 0; }
.quick-item {
  display: block; padding: 13px 14px; background: #f7f9fc; border: 1px solid #e3e7ee; border-radius: 6px;
  font-size: 13px; color: #333c4f;
}
.quick-item:hover { background: #eef4ff; border-color: #b9d0fb; text-decoration: none; }
.quick-item span { font-size: 12px; color: #8b94a7; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 0 16px 8px; }
.perm-group { border: 1px solid #e3e7ee; border-radius: 6px; padding: 10px 12px; background: #fbfcfe; }
.perm-group-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; color: #333c4f; }
.perm-group .check { display: flex; margin: 4px 0; }
.perm-tools { padding: 0 16px 6px; }
.perm-tools a.small { margin-right: 12px; font-size: 12px; }

/* 按钮权限：无「报表导出」按钮时隐藏报表/库存类的导出入口（接口同样拦截） */
body[data-export-report="0"] a[href*="r=report%2F"][href*="fmt="],
body[data-export-report="0"] a[href*="r=inventory%2F"][href*="fmt="] { display: none; }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1b2436 0%, #26314c 55%, #2f3d5e 100%);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; position: relative; overflow: hidden;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-bg .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35; }
.login-bg .b1 { width: 420px; height: 420px; background: #3b82f6; top: -120px; left: -100px; }
.login-bg .b2 { width: 360px; height: 360px; background: #6366f1; bottom: -140px; right: -80px; }
.login-bg .b3 { width: 260px; height: 260px; background: #22d3ee; top: 40%; left: 45%; opacity: .18; }

.login-wrap { position: relative; z-index: 1; display: flex; align-items: stretch; gap: 0; width: 860px; max-width: calc(100vw - 40px); }

.login-side { flex: 1; color: #e8edf7; padding: 20px 44px 20px 8px; display: flex; flex-direction: column; justify-content: center; }
.login-logo { margin-bottom: 22px; }
.login-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff;
  font-weight: 700; font-size: 15px; letter-spacing: 1px;
  box-shadow: 0 12px 30px rgba(37,99,235,.45);
}
.login-slogan { margin: 0 0 8px; font-size: 30px; font-weight: 700; letter-spacing: 1px; }
.login-desc { margin: 0 0 26px; font-size: 15px; color: #aeb9d0; }
.login-feats { list-style: none; margin: 0; padding: 0; }
.login-feats li { position: relative; padding: 7px 0 7px 26px; font-size: 13.5px; color: #c3cde0; }
.login-feats li::before {
  content: ""; position: absolute; left: 0; top: 13px; width: 14px; height: 8px;
  border-left: 2.5px solid #4ade80; border-bottom: 2.5px solid #4ade80; transform: rotate(-45deg);
}

.login-panel { width: 400px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.login-card {
  width: 100%; background: #fff; border-radius: 16px; padding: 38px 36px 30px;
  box-shadow: 0 26px 60px rgba(0,0,0,.35);
}
.login-card-head { text-align: center; margin-bottom: 22px; }
.login-card-head h1 { margin: 0 0 6px; font-size: 24px; color: #1a2233; }
.login-card-head p { margin: 0; font-size: 13px; color: #8b94a7; }
.login-flash { margin-bottom: 16px; }

.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; color: #48526a; margin-bottom: 7px; font-weight: 500; }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-icon {
  position: absolute; left: 12px; display: flex; color: #98a1b3; pointer-events: none;
}
.login-input-wrap input {
  width: 100%; height: 46px; padding: 0 14px 0 38px; font-size: 14px;
  border: 1px solid #d7ddea; border-radius: 10px; background: #fafbfd;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.login-input-wrap input:focus {
  outline: none; border-color: #2563eb; background: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.14);
}
.login-input-wrap input::placeholder { color: #b3bccb; }

.login-submit { margin-top: 8px; height: 46px; font-size: 15px; letter-spacing: 8px; text-indent: 8px; border-radius: 10px; }
.login-foot { text-align: center; font-size: 12px; color: #98a1b3; margin-top: 18px; }
.login-copyright { margin-top: 16px; font-size: 12px; color: #8792ab; }

@media (max-width: 720px) {
  .login-side { display: none; }
  .login-panel { width: 100%; max-width: 400px; }
}

/* ---------- 打印 ---------- */
.print-bar { padding: 10px 16px; background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.print-frame-wrap { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 10px; }

@media print {
  .sidebar, .topbar, .print-bar, .flash, .action-bar, .filter, .panel-tools, .line-tools { display: none !important; }
  body { background: #fff; }
  /* 打印时取消布局容器的高度/边距/边框，避免 100vh 撑出多余空白页 */
  .app, .main { display: block !important; min-height: 0 !important; height: auto !important; }
  .content, .print-frame-wrap { padding: 0 !important; border: 0 !important; margin: 0 !important; box-shadow: none !important; background: #fff !important; }
  .panel { border: 0; }
  a { color: #000; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
  .head-fields, .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 按BOM展开用料：选择 BOM 清单弹框 ---------- */
.bom-mask {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: rgba(20,26,40,.45); z-index: 120;
  display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px 16px;
}
.bom-dlg {
  background: #fff; border-radius: 10px; width: 940px; max-width: 96vw; height: 620px; max-height: 80vh;
  box-shadow: 0 18px 48px rgba(0,0,0,.3); display: flex; flex-direction: column; overflow: hidden;
}
.bom-head { padding: 14px 18px; border-bottom: 1px solid #e6eaf1; display: flex; align-items: center; gap: 12px; }
.bom-head b { font-size: 15px; color: #2c3345; }
.bom-kw { padding: 10px 18px 0; }
.bom-kw input {
  width: 100%; height: 34px; padding: 0 12px; font-size: 13px; border: 1px solid #d7ddea; border-radius: 8px;
  background: #fafbfd;
}
.bom-kw input:focus { outline: none; border-color: #2563eb; background: #fff; }
.bom-list { flex: 1; overflow: auto; padding: 10px 18px; }
.bom-tb { width: 100%; border-collapse: collapse; font-size: 13px; }
.bom-tb th, .bom-tb td { padding: 7px 10px; border-bottom: 1px solid #eef1f6; text-align: left; white-space: nowrap; }
.bom-tb th { color: #8b94a7; font-weight: 600; font-size: 12px; background: #f7f9fc; position: sticky; top: 0; }
.bom-tb .r { text-align: right; }
.bom-tb tbody tr { cursor: pointer; }
.bom-tb tbody tr:hover, .bom-tb tbody tr.on { background: #eef4ff; }
.bom-empty { padding: 26px 0; text-align: center; color: #8b94a7; }
.bom-foot {
  padding: 11px 18px; border-top: 1px solid #e6eaf1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bom-btns { display: flex; gap: 10px; }

/* ---------- 商品图片：行内缩略图 + 大图查看/上传弹层（views/master/list.php + app.js） ---------- */
.p-thumb {
  width: 46px; height: 46px; object-fit: cover; display: block;
  border: 1px solid #d7ddea; border-radius: 6px; background: #fafbfd; cursor: zoom-in;
}
.p-thumb:hover { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37, 99, 235, .18); }
.p-noimg { color: #b6bdca; }
/* 单据列表/明细行用的小号缩略图（46px 太高，会顶开行高） */
.p-thumb-sm { width: 32px; height: 32px; border-radius: 4px; }
.thumb-cell { width: 40px; text-align: center; vertical-align: middle; }
.img-mask {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: rgba(20, 26, 40, .55); z-index: 140;
  display: flex; align-items: flex-start; justify-content: center; padding: 52px 16px 16px;
}
.img-dlg {
  background: #fff; border-radius: 10px; width: 600px; max-width: 96vw; overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .3);
}
.img-head { padding: 12px 16px; border-bottom: 1px solid #e6eaf1; display: flex; align-items: center; gap: 12px; }
.img-head b { font-size: 14px; color: #2c3345; flex: 1; }
.img-x { color: #8b93a5; font-size: 20px; line-height: 1; }
.img-body { padding: 14px 16px; display: flex; gap: 16px; align-items: flex-start; }
.img-cur img {
  width: 180px; height: 180px; object-fit: contain; display: block;
  border: 1px solid #e6eaf1; border-radius: 8px; background: #fafbfd; cursor: zoom-in;
}
.img-ops { flex: 1; font-size: 13px; color: #5b6373; }
.img-ops input[type=file] { display: block; margin: 8px 0 10px; font-size: 13px; }
.img-note { font-size: 12px; color: #8b93a5; margin-bottom: 10px; min-height: 16px; }
.img-foot { padding: 0 16px 14px; }
.img-lightbox { align-items: center; cursor: zoom-out; }
.img-view-box { max-width: 96vw; }
.img-view-box img {
  max-width: 94vw; max-height: 78vh; display: block; background: #fff; border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .35);
}
.img-view-cap { text-align: center; color: #e6eaf1; font-size: 13px; padding-top: 10px; }
@media (max-width: 760px) { .img-body { flex-direction: column; } }

/* ==================== 打印模板设计器（可视化设计 / 纸张预览 / 源码） ==================== */
.tpl-head { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 16px; background: #fbfcfe; border-bottom: 1px solid #edf0f5; }
.tpl-f { display: flex; align-items: center; gap: 8px; }
.tpl-f > label { color: #48526a; font-size: 13px; white-space: nowrap; }
.tpl-f input[type=text] { width: 190px; }
.tpl-f select { min-width: 190px; }
.tpl-f-check { align-items: center; }
.tpl-tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid #e3e7ee; background: #fff; }
.tpl-tab {
  border: 1px solid transparent; border-bottom: 0; background: transparent; cursor: pointer;
  padding: 8px 16px; font-size: 13px; color: #5a647a; border-radius: 6px 6px 0 0; font-family: inherit;
}
.tpl-tab:hover { background: #f5f7fa; }
.tpl-tab.on { background: #fff; border-color: #e3e7ee; color: #2563eb; font-weight: 600; margin-bottom: -1px; }
.tpl-pane { padding: 16px; }
.tpl-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.tpl-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.tpl-row > label { width: 84px; color: #48526a; font-size: 13px; flex-shrink: 0; }
.tpl-row input[type=text] { flex: 1; min-width: 0; }
.tpl-row-block { align-items: flex-start; }
.tpl-row-block > label { padding-top: 7px; }
.tpl-row-block textarea { flex: 1; font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.tpl-tip { color: #9aa3b5; font-size: 12px; font-weight: normal; }
.tpl-cols { margin: 14px 0 12px; border: 1px solid #e3e7ee; border-radius: 8px; overflow: hidden; }
.tpl-cols-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; background: #f7f9fc; border-bottom: 1px solid #e3e7ee; }
.tpl-cols-head strong { font-size: 13px; color: #2c3345; }
.tpl-cols-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tpl-cols-tools select { min-width: 120px; }
.tpl-coltable { margin: 0; }
.tpl-coltable th, .tpl-coltable td { white-space: nowrap; }
.tpl-coltable input[type=text] { width: 100%; min-width: 120px; }
.tpl-coltable input[type=number] { width: 80px; }
.tpl-col.on td { background: #e4edff; }
.tpl-col-no { color: #98a1b3; font-variant-numeric: tabular-nums; }
.tpl-var { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: #fbfcfe; border: 1px solid #e3e7ee; border-radius: 8px; }
.tpl-var > label { color: #48526a; font-size: 13px; }
.tpl-var select { min-width: 200px; }
.tpl-warn { margin-top: 10px; padding: 8px 12px; background: #fff8e1; border: 1px solid #f0d98c; border-radius: 6px; font-size: 12.5px; color: #8a6d1a; }
.tpl-preview-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-preview-wrap { border: 1px solid #dfe4ee; border-radius: 8px; overflow: hidden; background: #e9edf3; }
.tpl-preview-wrap iframe { width: 100%; height: 620px; border: 0; display: block; background: #e9edf3; }
.tpl-src-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tpl-code { width: 100%; box-sizing: border-box; font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.tpl-src-help { margin-top: 8px; line-height: 1.9; }
.tpl-src-help code { background: #f1f4f9; border-radius: 4px; padding: 1px 6px; margin-right: 2px; }
.tpl-actions { align-items: center; }
.tpl-actions .hint { margin-left: 4px; }
@media (max-width: 900px) {
  .tpl-grid2 { grid-template-columns: 1fr; }
  .tpl-f input[type=text], .tpl-f select { width: 100%; min-width: 0; }
}
