* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", Arial, sans-serif; background: #f4f6f8; color: #222; }

/* ===== 顶部栏 ===== */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: #1f3d7a; color: #fff; flex-wrap: wrap; }
.topbar .brand { font-size: 18px; font-weight: bold; }
.topbar .meta { display: flex; gap: 14px; align-items: center; }
.topbar .meta label { font-size: 13px; display: flex; align-items: center; gap: 4px; }
.topbar input[type="date"] { padding: 3px 6px; border-radius: 4px; border: none; font-size: 13px; }
.topbar select { padding: 3px 6px; border-radius: 4px; border: none; font-size: 13px; }
.period-label { background: #fff; color: #1f3d7a; padding: 3px 10px; border-radius: 4px; font-size: 13px; font-weight: bold; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.topbar button { padding: 6px 12px; border: none; border-radius: 4px; background: #4a90e2; color: #fff; cursor: pointer; font-size: 13px; transition: background .3s; }
.topbar button:hover { background: #357abd; }
.topbar button:disabled { background: #8aa5c9; cursor: not-allowed; }

.topbar button.blink { animation: blinkBtn 1.1s infinite; background: #e74c3c; }
@keyframes blinkBtn {
  0%, 100% { background: #e74c3c; box-shadow: 0 0 0 0 rgba(231,76,60,.7); }
  50%      { background: #ff8b7a; box-shadow: 0 0 0 10px rgba(231,76,60,0); }
}
.topbar button.price-loaded { background: #f39c12; }
.topbar button.price-loaded:hover { background: #d68910; }

/* ===== CODE 输入条 ===== */
.entry-bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: #fff; border-bottom: 1px solid #e0e4ea; flex-wrap: wrap; }
.entry-bar label { font-weight: bold; }
.entry-bar input { width: 260px; padding: 8px 10px; font-size: 16px; border: 2px solid #cfd8e3; border-radius: 4px; }
.entry-bar input:disabled { background: #f0f0f0; cursor: not-allowed; }
.entry-bar input.ok { border-color: #27ae60; background: #eafaf1; }
.entry-bar input.err { border-color: #e74c3c; background: #fdecea; }
#matchStatus { font-size: 13px; }
.price-info { margin-left: auto; font-size: 12px; color: #666; }
.price-info.ok { color: #27ae60; font-weight: bold; }
.price-info.none { color: #e74c3c; font-weight: bold; }

/* ===== 视图切换 ===== */
.main-view { display: block; }
.main-view.hidden { display: none; }

/* ===== Quick Pick ===== */
.quick-wrap { padding: 10px 20px; background: #f7f9fc; border-bottom: 1px solid #e0e4ea; }
.quick-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: #1f3d7a; font-weight: bold; margin-bottom: 8px;
}
.btn-quick-more {
  padding: 3px 10px; background: #4a90e2; color: #fff;
  border: none; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-quick-more:hover { background: #357abd; }

.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 6px; border-radius: 8px; cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
  color: #fff; text-align: center; min-height: 70px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12); user-select: none; overflow: hidden;
}
.quick-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.22);
  filter: brightness(1.08);
}
.quick-item:active { transform: translateY(0); filter: brightness(0.95); }
.quick-item .quick-code {
  font-size: 11px; font-weight: normal; opacity: .9;
  font-family: 'Courier New', monospace; letter-spacing: 1px;
  margin-bottom: 2px; white-space: nowrap;
}
.quick-item .quick-name {
  font-size: 12px; font-weight: bold; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}
.quick-item .quick-stock {
  font-size: 12px; margin-top: 4px; color: #ffffff; opacity: 1;
  font-weight: bold; text-shadow: 0 1px 2px rgba(0,0,0,.35); letter-spacing: .5px;
}
.quick-item.out { filter: grayscale(0.75) brightness(0.75); cursor: not-allowed; }
.quick-item.out:hover { transform: none; }

@media (max-width: 900px) {
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-item { min-height: 60px; padding: 8px 4px; }
  .quick-item .quick-name { font-size: 11px; }
  .quick-item .quick-code { font-size: 10px; }
  .quick-item .quick-stock { font-size: 11px; }
}
@media (max-width: 600px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .quick-wrap { padding: 8px 10px; }
}

/* ===== 表格 ===== */
.table-wrap { padding: 12px 20px 80px; overflow-x: auto; }
table#itemsTable { width: 100%; border-collapse: collapse; background: #fff; }
#itemsTable th, #itemsTable td { border: 1px solid #d9dee5; padding: 4px 6px; font-size: 13px; vertical-align: middle; }
#itemsTable th { background: #eef2f7; font-weight: bold; text-align: center; }
#itemsTable td { height: 26px; }
#itemsTable td.center { text-align: center; }
#itemsTable td.right { text-align: right; }
#itemsTable td.name { max-width: 480px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#itemsTable tr.anomaly td { background: #fff9c4; }
#itemsTable tr.nocode-row td { background: #f0f7ff; }
#itemsTable tr.nocode-row td:first-child { border-left: 3px solid #4a90e2; }
#itemsTable td.purpose input { width: 100%; border: 1px solid #cfd8e3; border-radius: 3px; padding: 3px 6px; font-size: 13px; }
#itemsTable td.purpose input.err { border-color: #e74c3c; background: #fdecea; }
#itemsTable td.actions button { padding: 2px 6px; font-size: 12px; border: none; border-radius: 3px; cursor: pointer; }
#itemsTable td.actions .btn-del { background: #e74c3c; color: #fff; }

/* ===== 状态栏 ===== */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 20px; background: #1f3d7a; color: #fff; font-size: 13px; z-index: 100;
}
.statusbar .status-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.statusbar .status-sep { color: rgba(255,255,255,.4); font-weight: normal; }
.statusbar .operator-label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.statusbar .operator-label select { padding: 3px 8px; border-radius: 4px; border: none; font-size: 12px; background: #fff; color: #1f3d7a; cursor: pointer; }
.statusbar .status-right { display: flex; align-items: center; font-size: 13px; color: #fff; }

/* ===== Back 按钮 ===== */
.btn-back {
  padding: 8px 14px; background: #4a90e2; color: #fff;
  border: none; border-radius: 4px; font-size: 13px; cursor: pointer;
  transition: background .2s; white-space: nowrap; margin-right: 8px;
}
.btn-back:hover { background: #357abd; }
.btn-back.hidden { display: none; }

/* ===== 通用 modal ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 6px; min-width: 480px; max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal-box.wide { min-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #e0e4ea; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .close { background: none; border: none; font-size: 22px; cursor: pointer; color: #666; }
.modal-body { padding: 16px; overflow: auto; }

/* ===== 审批中心 ===== */
.approve-page { padding: 16px 20px 80px; max-width: 1200px; margin: 0 auto; }
.approve-page-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; padding: 16px 0;
  border-bottom: 1px solid #e0e4ea; margin-bottom: 16px;
}
.approve-page-header h2 { margin: 0; font-size: 20px; color: #1f3d7a; }
.approve-filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.approve-filters label { font-size: 13px; color: #444; display: flex; align-items: center; gap: 4px; }
.approve-filters input[type="date"],
.approve-filters select { padding: 5px 10px; border: 1px solid #cfd8e3; border-radius: 4px; font-size: 13px; background: #fff; }
.toggle-rejected {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: #444;
  cursor: pointer; user-select: none; padding: 4px 10px; background: #fff;
  border: 1px solid #cfd8e3; border-radius: 4px;
}
.toggle-rejected input[type="checkbox"] { margin: 0; cursor: pointer; }
.toggle-rejected:hover { background: #f4f8ff; border-color: #8bb6e6; }
.approve-list { min-height: 200px; }
.approve-pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 0; }

.btn-refresh {
  padding: 6px 14px; background: #17a2b8; color: #fff;
  border: none; border-radius: 4px; font-size: 13px; cursor: pointer;
  transition: background .2s; white-space: nowrap;
}
.btn-refresh:hover { background: #138496; }
.btn-refresh:disabled { background: #8ac2cc; cursor: not-allowed; }

/* ===== 审批卡片 ===== */
.approve-card { border: 1px solid #e0e4ea; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fff; transition: box-shadow .2s; }
.approve-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.approve-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.approve-card-header > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.approve-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.approve-actions .btn-open,
.approve-actions .btn-approve,
.approve-actions .btn-reject { padding: 5px 12px; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; }
.approve-actions .btn-open { background: #4a90e2; color: #fff; }
.approve-actions .btn-open:hover { background: #357abd; }
.approve-actions .btn-approve { background: #27ae60; color: #fff; }
.approve-actions .btn-approve:hover { background: #219150; }
.approve-actions .btn-reject { background: #e74c3c; color: #fff; }
.approve-actions .btn-reject:hover { background: #c0392b; }
.approve-card-body { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: #555; }
.approve-card-body span { display: inline-block; }
.approve-meta-mini { margin-top: 8px; font-size: 12px; color: #888; }

/* ===== 预览选列表格 ===== */
.preview-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.preview-table th, .preview-table td { border: 1px solid #ddd; padding: 4px 8px; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.preview-table th { background: #eef2f7; text-align: center; vertical-align: top; }
.preview-table th.col-code { background: #d6e8fa; }
.preview-table th.col-price { background: #fde3c0; }
.preview-table .col-head { display: flex; flex-direction: column; gap: 4px; align-items: center; min-width: 80px; }
.preview-table .col-head .col-name { font-weight: bold; font-size: 12px; }
.preview-table .col-head .col-btn { font-size: 11px; padding: 2px 8px; border: 1px solid #ccc; border-radius: 3px; background: #fff; cursor: pointer; }
.preview-table .col-head .col-btn:hover { background: #f0f0f0; }
.preview-table .col-head .col-btn.active-code { background: #4a90e2; color: #fff; border-color: #4a90e2; }
.preview-table .col-head .col-btn.active-price { background: #f39c12; color: #fff; border-color: #f39c12; }

/* ===== 历史列表 ===== */
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid #eee; }
.history-item:hover { background: #f7f9fc; }
.history-item .hinfo { font-size: 13px; }
.history-item .hact button { margin-left: 6px; padding: 4px 10px; font-size: 12px; border: none; border-radius: 3px; cursor: pointer; }
.history-item .hact .btn-open { background: #4a90e2; color: #fff; }
.history-item .hact .btn-del { background: #e74c3c; color: #fff; }
.reject-comment {
  margin-top: 4px; padding: 4px 8px; background: #fdecea;
  border-left: 3px solid #e74c3c; border-radius: 3px;
  font-size: 12px; color: #c0392b;
}

/* ===== 进度条 ===== */
.progress-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 300; }
.progress-overlay.hidden { display: none; }
.progress-box { background: #fff; border-radius: 8px; padding: 24px 30px; width: 460px; text-align: center; }
.progress-title { font-size: 15px; margin-bottom: 14px; color: #1f3d7a; font-weight: bold; }
.progress-bar { height: 14px; background: #e6ebf2; border-radius: 7px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #4a90e2, #27ae60); transition: width .2s; }
.progress-text { margin-top: 8px; font-size: 13px; color: #666; }

/* ===== 数量选择弹窗 ===== */
#qtyModal { z-index: 400; }
.qty-modal-box {
  background: #fff; border-radius: 12px; padding: 16px 14px;
  width: 134px; text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
  animation: qtyPop .18s ease-out; box-sizing: border-box;
}
@keyframes qtyPop {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.qty-modal-title { font-size: 12px; font-weight: bold; color: #1f3d7a; margin-bottom: 6px; white-space: nowrap; }
.qty-modal-product {
  font-size: 10px; color: #999; margin: 0 0 8px;
  word-break: break-all; line-height: 1.25;
  max-height: 25px; overflow: hidden;
}
.qty-list {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; margin-bottom: 10px; padding: 0;
  overflow: visible; max-height: none;
}
.qty-item {
  width: 60px; height: 60px; line-height: 56px;
  box-sizing: border-box;
  font-size: 30px; font-weight: bold; color: #1f3d7a;
  border-radius: 8px; background: #f4f6f8; border: 2px solid #d9dee5;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
  user-select: none;
}
.qty-item:hover { background: #e8eef7; border-color: #4a90e2; }
.qty-item.active {
  background: #f0c419; color: #fff;
  border-color: #f0c419;
  box-shadow: 0 0 0 3px rgba(240,196,25,.35);
  transform: scale(1.08);
}
.qty-custom input {
  width: 100%; padding: 4px 4px;
  border: 2px solid #cfd8e3; border-radius: 8px;
  font-size: 12px; text-align: center; box-sizing: border-box;
}
.qty-custom input::placeholder { font-size: 11px; color: #aab; text-align: center; }
.qty-custom input:focus { outline: none; border-color: #4a90e2; }
.qty-tip { font-size: 10px; color: #999; margin-top: 8px; line-height: 1.3; }

/* ===== 报告捕获容器 ===== */
.report-capture {
  position: absolute; left: 0; top: 0; width: 900px;
  background: #fff; padding: 24px;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: #222; opacity: 0; pointer-events: none; z-index: -1;
}
.report-capture .rpt-title { font-size: 20px; font-weight: bold; text-align: center; color: #1f3d7a; margin-bottom: 6px; }
.report-capture .rpt-sub { font-size: 13px; text-align: center; color: #666; margin-bottom: 16px; }
.report-capture .rpt-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.report-capture .rpt-summary .card { flex: 1; min-width: 140px; background: #f7f9fc; border-radius: 6px; padding: 10px 14px; }
.report-capture .rpt-summary .card .label { font-size: 12px; color: #888; }
.report-capture .rpt-summary .card .value { font-size: 22px; font-weight: bold; color: #1f3d7a; }
.report-capture .rpt-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.report-capture .rpt-table th, .report-capture .rpt-table td { border: 1px solid #ddd; padding: 6px 8px; font-size: 13px; }
.report-capture .rpt-table th { background: #eef2f7; }
.report-capture .rpt-table tr.anomaly td { background: #fff9c4; }
.report-capture .rpt-anomaly { background: #fff9c4; padding: 10px; border-radius: 6px; margin-top: 14px; font-size: 13px; }
.report-capture .rpt-anomaly ul { margin: 6px 0 0 18px; padding: 0; }
.report-capture .rpt-footer { margin-top: 20px; font-size: 13px; color: #666; display: flex; justify-content: space-between; }
.report-capture .rpt-section-title {
  font-size: 14px; font-weight: bold; color: #1f3d7a;
  margin: 12px 0 6px; padding-left: 6px; border-left: 4px solid #4a90e2;
}
.report-capture .rpt-spacer { height: 22px; }

/* ===== 历史弹窗分页 ===== */
.modal-box .modal-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-top: 1px solid #e0e4ea; background: #fafbfc;
}
.pager-left .btn-danger {
  padding: 6px 14px; background: #e74c3c; color: #fff;
  border: none; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.pager-left .btn-danger:hover { background: #c0392b; }
.pager-right { display: flex; align-items: center; gap: 8px; }
.pager-right .page-info { font-size: 13px; color: #666; margin-right: 6px; }
.pager-right .btn-page {
  padding: 6px 14px; background: #4a90e2; color: #fff;
  border: none; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.pager-right .btn-page:hover:not(:disabled) { background: #357abd; }
.pager-right .btn-page:disabled { background: #cfd8e3; cursor: not-allowed; }
.modal-foot .pager-right .btn-confirm {
  padding: 8px 20px; background: #27ae60; color: #fff;
  border: none; border-radius: 4px; cursor: pointer; font-size: 13px; margin-left: 8px;
}
.modal-foot .pager-right .btn-danger {
  padding: 8px 20px; background: #e74c3c; color: #fff;
  border: none; border-radius: 4px; cursor: pointer; font-size: 13px;
}

/* ===== 类型徽章 ===== */
.history-item .hinfo .type-badge {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 11px; margin-left: 6px; vertical-align: middle;
}
.history-item .hinfo .type-badge.type-draft { background: #e8eef7; color: #4a90e2; }
.history-item .hinfo .type-badge.type-final { background: #fff5d6; color: #b8860b; }
.history-item .hinfo .type-badge.type-approved { background: #eafaf1; color: #27ae60; }
.history-item .hinfo .type-badge.type-rejected { background: #fdecea; color: #e74c3c; }

/* ===== 登录界面 ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f3d7a 0%, #2c5aa0 55%, #4a7fc1 100%);
  padding: 20px;
}
.login-box {
  background: #fff; padding: 44px 40px 36px; border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
  width: 400px; max-width: 100%;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { display: inline-block; font-size: 26px; font-weight: bold; color: #1f3d7a; letter-spacing: 2px; }
.login-title { font-size: 14px; color: #888; letter-spacing: 4px; margin-top: 8px; }
.login-form { display: block; }
.login-label { display: block; font-size: 13px; color: #444; font-weight: bold; margin-bottom: 6px; }
#loginUser, #loginCode {
  width: 100%; padding: 11px 14px; border: 2px solid #d9dee5; border-radius: 8px;
  font-size: 15px; margin-bottom: 16px; box-sizing: border-box; transition: border-color .2s;
}
#loginUser:focus, #loginCode:focus { outline: none; border-color: #4a90e2; }
.login-btn {
  width: 100%; padding: 12px; background: #1f3d7a; color: #fff;
  border: none; border-radius: 8px; font-size: 15px; font-weight: bold;
  letter-spacing: 4px; cursor: pointer; margin-top: 8px; transition: background .2s;
}
.login-btn:hover { background: #2c5aa0; }
.login-btn:disabled { background: #8aa5c9; cursor: not-allowed; }
.login-msg { margin-top: 14px; font-size: 13px; text-align: center; min-height: 18px; }
.login-msg.err { color: #e74c3c; }
.login-msg.ok  { color: #27ae60; }

/* ===== 用户 chip ===== */
.user-chip { background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 4px; font-size: 12px; color: #fff; }
.btn-ghost { background: transparent !important; border: 1px solid rgba(255,255,255,.4) !important; }
.btn-ghost:hover { background: rgba(255,255,255,.15) !important; }

/* ===== 表单通用 ===== */
.form-label { display: block; font-size: 13px; color: #444; font-weight: bold; margin-bottom: 6px; }
.form-select { width: 100%; padding: 8px 10px; border: 2px solid #cfd8e3; border-radius: 6px; font-size: 14px; background: #fff; }
.form-select:focus { outline: none; border-color: #4a90e2; }
.btn-cancel, .btn-confirm {
  padding: 8px 20px; border: none; border-radius: 4px;
  font-size: 13px; cursor: pointer; margin-left: 8px;
}
.btn-cancel { background: #cfd8e3; color: #333; }
.btn-confirm { background: #27ae60; color: #fff; }
.btn-confirm:disabled { background: #95c9a8; cursor: not-allowed; }

/* ============================================================= */
/* ============ 无 CODE 商品选择器 ============================= */
/* ============================================================= */
.special-modal-box {
  background: #fff;
  border-radius: 8px;
  width: 90vw;
  max-width: 860px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}

.special-toolbar {
  display: flex; gap: 8px; padding: 10px 14px;
  background: #fafbfc; border-bottom: 1px solid #e0e4ea; align-items: center;
  flex-shrink: 0;
}
.special-search {
  flex: 1; padding: 7px 12px; border: 2px solid #cfd8e3; border-radius: 6px;
  font-size: 13px; box-sizing: border-box; min-width: 0;
}
.special-search:focus { outline: none; border-color: #4a90e2; }
.btn-special-toggle {
  padding: 7px 14px; background: #4a90e2; color: #fff;
  border: none; border-radius: 6px; font-size: 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn-special-toggle:hover { background: #357abd; }
.btn-special-toggle.hidden { display: none; }

/* ==== 列表：关键 ==== */
.special-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

/* 单列 */
.special-list.mode-single {
  grid-template-columns: minmax(0, 1fr);
}

/* 三列：严格占满容器三等分 */
.special-list.mode-all {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

/* 窄屏切回 1 列 */
@media (max-width: 700px) {
  .special-list.mode-all {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 卡片 */
.special-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid #e0e4ea;
  border-radius: 6px;
  cursor: pointer;
  transition: all .12s;
  background: #fff;
  font-size: 13px;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
}
.special-item:hover { border-color: #8bb6e6; background: #f4f8ff; }
.special-item.active { border-color: #4a90e2; background: #e8f0ff; box-shadow: 0 0 0 2px rgba(74,144,226,.2); }
.special-item.out-of-stock { opacity: .5; background: #f5f5f5; cursor: not-allowed; }

.special-item .special-code {
  font-weight: bold; color: #1f3d7a;
  font-family: 'Courier New', monospace;
  font-size: 14px; margin-right: 8px;
  flex-shrink: 0; min-width: 32px;
}
.special-item .special-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}
.special-item .special-stock {
  font-size: 11px; color: #27ae60;
  margin-left: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.special-item.out-of-stock .special-stock { color: #e74c3c; }

.special-list.mode-all .special-item {
  padding: 6px 8px;
  font-size: 12px;
}
.special-list.mode-all .special-item .special-code {
  font-size: 12px;
  min-width: 26px;
  margin-right: 6px;
}
.special-list.mode-all .special-item .special-stock {
  font-size: 10px;
  margin-left: 6px;
}

/* ===== Tooltip ===== */
.special-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 360px;
  padding: 8px 12px;
  background: #1f3d7a;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  pointer-events: none;
  word-break: break-word;
  white-space: normal;
  animation: tipFadeIn .12s ease-out;
}
@keyframes tipFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.special-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f3d7a;
  bottom: -12px;
}
.special-tooltip.above::after {
  border-top-color: transparent;
  border-bottom-color: #1f3d7a;
  bottom: auto;
  top: -12px;
}
.special-tooltip.hidden { display: none; }

/* ===== 分页 ===== */
.special-pager {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  padding: 10px 14px; background: #fafbfc; border-top: 1px solid #e0e4ea;
  flex-shrink: 0;
}
.special-pager .page-info { font-size: 12px; color: #666; margin-right: 8px; }
.special-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 30px; color: #888; font-size: 13px;
}

/* ===== Maintain No-Code modal ===== */
.modal-toolbar {
  display: flex; gap: 8px; padding: 10px 16px;
  background: #f7f9fc; border-bottom: 1px solid #e0e4ea; flex-wrap: wrap;
}
.nocode-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nocode-table th, .nocode-table td {
  border: 1px solid #e0e4ea; padding: 6px 8px;
  text-align: left; vertical-align: middle;
}
.nocode-table th { background: #eef2f7; font-weight: bold; color: #333; }
.nocode-table .btn-mini {
  padding: 3px 10px; font-size: 12px;
  border: none; border-radius: 3px; cursor: pointer; margin: 0 2px;
}
.nocode-table .btn-mini.btn-edit { background: #4a90e2; color: #fff; }
.nocode-table .btn-mini.btn-edit:hover { background: #357abd; }
.nocode-table .btn-mini.btn-del { background: #e74c3c; color: #fff; }
.nocode-table .btn-mini.btn-del:hover { background: #c0392b; }

#fileStatusText { font-weight: bold; color: #fff; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .topbar .brand { font-size: 16px; text-align: center; }
  .topbar .meta { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .topbar .actions { margin-left: 0; justify-content: center; }
  .topbar .actions button { flex: 1; min-width: 84px; padding: 8px 8px; font-size: 12px; }

  .entry-bar { flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 6px; }
  .entry-bar input { width: 100%; }
  .price-info { margin-left: 0; text-align: center; }

  .table-wrap { padding: 8px 8px 90px; }
  #itemsTable th, #itemsTable td { font-size: 11px; padding: 4px 3px; }
  #itemsTable td.name { max-width: 140px; }

  .statusbar { flex-direction: column; gap: 4px; padding: 6px 10px; font-size: 11px; }
  .statusbar .status-left { justify-content: center; }
  .statusbar .status-right { justify-content: center; }

  .modal-box { min-width: auto; width: 92vw; max-width: 92vw; }
  .modal-box.wide { min-width: auto; width: 94vw; }

  .qty-modal-box { width: 150px; }
  .qty-item { width: 70px; height: 70px; line-height: 66px; font-size: 34px; }

  .report-capture { width: 100%; padding: 12px; }

  .btn-back { padding: 6px 10px; font-size: 12px; margin-right: 4px; }
  .btn-refresh { padding: 5px 10px; font-size: 12px; }

  .approve-page { padding: 12px 10px 80px; }
  .approve-page-header h2 { font-size: 16px; }
  .approve-filters { gap: 6px; font-size: 12px; }

  .special-modal-box { width: 94vw; max-height: 86vh; }
  .special-toolbar { padding: 8px 10px; gap: 6px; }
  .special-list { padding: 8px 10px; }
}

@media (max-width: 600px) {
  .topbar .meta label { font-size: 12px; }
  .topbar input[type="date"] { font-size: 12px; }
  .topbar .actions button { flex: 1 1 46%; }
  #itemsTable td.name { max-width: 100px; }
  .history-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .history-item .hact { width: 100%; display: flex; gap: 6px; }
  .history-item .hact button { flex: 1; }
  .approve-card-body { gap: 10px; font-size: 12px; }
  .approve-actions .btn-open,
  .approve-actions .btn-approve,
  .approve-actions .btn-reject { padding: 4px 10px; font-size: 11px; }

  .special-modal-box { width: 96vw; max-height: 88vh; }
  .special-toolbar { flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  .special-search { flex: 1 1 100%; }
  .special-list { padding: 8px 10px; }
  .special-item { font-size: 12px; padding: 6px 8px; }
  .special-item .special-code { font-size: 12px; margin-right: 6px; }
}
.topbar .meta .date-text {
  display: inline-block;
  min-width: 96px;
  padding: 2px 6px;
  font: inherit;
  color: inherit;
  vertical-align: middle;
}

/* ============================================================= */
/* ============ 新增：已审核 / 已提交记录行删除占位符 ========== */
/* ============================================================= */
/* 当记录为 pending 或 approved 时，renderTable() 不再渲染 .btn-del，
   而是渲染 <span class="del-disabled">—</span>，样式如下：
   - 固定宽度，与按钮对齐
   - 灰色、不可点，视觉上明确表示不可删除
   - cursor: not-allowed 提示用户
*/
#itemsTable td.actions .del-disabled {
  display: inline-block;
  width: 24px;
  text-align: center;
  color: #bbb;
  font-size: 16px;
  line-height: 1;
  cursor: not-allowed;
  user-select: none;
}