/* 进口明细独立页 —— 复用 dispatch_page.css 的外壳，只加表格自身的样式。 */
/* 让表格在页内滚动（表头吸附），而不是整页滚动把工具栏和表头带走。 */
.inbound-page .dispatch-page-main {
  box-sizing: border-box; padding: 16px 20px 18px;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.inbound-page .dispatch-page-main > .inbound-grid-shell {
  height: 100%; min-height: 0; flex: 1 1 auto;
}

.inbound-page-source {
  flex: 1 1 auto; min-width: 0; font-size: 12px; color: #64748b;
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
}
.inbound-page-source b { color: #0f2350; font-weight: 600; font-family: inherit; }

.inbound-grid-shell {
  display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
  background: #fff; border: 1px solid #8ba0ba; border-radius: 12px; overflow: hidden;
}
.inbound-grid-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #c2cddc; background: #fbfcfe;
}
.inbound-grid-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inbound-grid-chips button {
  border: 1px solid #e2e8f2; background: #f4f7fc; color: #334155;
  border-radius: 999px; padding: 5px 13px; font-size: 12px; cursor: pointer;
}
.inbound-grid-chips button b { color: #0f2350; margin-left: 5px; }
.inbound-grid-chips button.active { background: #0f2350; border-color: #0f2350; color: #fff; }
.inbound-grid-chips button.active b { color: #cfe0ff; }

.inbound-grid-search { display: flex; gap: 8px; align-items: center; }
.inbound-grid-search input {
  border: 1px solid #d5dbe6; border-radius: 8px; padding: 7px 11px;
  font-size: 13px; min-width: 320px;
}
.inbound-grid-search button {
  background: #0f2350; color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 13px; cursor: pointer;
}
.inbound-grid-search button.ghost { background: #fff; color: #475569; border: 1px solid #d5dbe6; }

.inbound-grid-message { padding: 10px 14px; font-size: 13px; color: #b45309; background: #fffbeb; }

.inbound-grid-scroll { flex: 1 1 auto; overflow: auto; min-height: 280px; }
table.inbound-grid-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: max-content; min-width: 100%; }
table.inbound-grid-table th, table.inbound-grid-table td {
  padding: 8px 11px; border-bottom: 1px solid #d5dce6; border-right: 1px solid #d5dce6;
  text-align: left; white-space: nowrap;
}
table.inbound-grid-table th:last-child, table.inbound-grid-table td:last-child { border-right: none; }
table.inbound-grid-table th {
  background: #eceff6; color: #3d4e66; font-weight: 700; font-size: 11.5px; letter-spacing: .35px;
  position: sticky; top: 0; z-index: 2; border-bottom: 2px solid #8ba0ba;
}
table.inbound-grid-table tbody tr:hover td { background: #f2f6fd; }
table.inbound-grid-table td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.inbound-grid-table th.num-h { text-align: right; }
table.inbound-grid-table td.muted { color: #c6cfdb; }
table.inbound-grid-table .stock-chip {
  display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600;
  background: #e8f0ff; color: #1b437f;
}
table.inbound-grid-table .sn { font-family: inherit; color: #475569; }
/* 备货 + PI 两列吸附在左，横向滚动时保持定位 */
table.inbound-grid-table th.stick1, table.inbound-grid-table td.stick1 { position: sticky; left: 0; z-index: 3; background: #fff; }
table.inbound-grid-table th.stick1 { z-index: 4; background: #f7f9fc; }
table.inbound-grid-table tbody tr:hover td.stick1 { background: #f9fbff; }

.inbound-grid-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-top: 1px solid #c2cddc; background: #fbfcfe; font-size: 13px; color: #475569;
}
.inbound-grid-pagination { display: flex; align-items: center; gap: 10px; }
.inbound-grid-pagination button {
  border: 1px solid #d5dbe6; background: #fff; border-radius: 8px; padding: 6px 13px; cursor: pointer; font-size: 13px;
}
.inbound-grid-pagination button:disabled { opacity: .4; cursor: not-allowed; }
.inbound-grid-page-number { font-weight: 600; color: #0f2350; }

@media (max-width: 860px) {
  .inbound-grid-search input { min-width: 0; width: 100%; }
  .inbound-grid-search { width: 100%; }
}

/* 按 PI 成块：PI 变化处画一条分隔线（与发货工作表一致） */
table.inbound-grid-table tbody tr.ib-pi-break > td { border-top: 2px solid #8ba0ba; background: #fafbfe; }

/* 表格线统一到台账那套 token：网格 #c2cddc、分隔 #8ba0ba、表头底 #eceff6 */
.inbound-grid-shell { border-color: #8ba0ba; }
table.inbound-grid-table tbody tr:last-child > td { border-bottom: none; }

/* ---------------------------------------------------------------- 人工编辑层（044）
   双击改格子 / 新增整行。改过的格子左上角一个小三角，手动加的行整行浅黄。 */
.ib-addrow { margin-left: 8px; }
#inboundTable th.ib-gutter,
#inboundTable td.ib-gutter {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface, #fff);
  white-space: nowrap; padding-right: 10px;
}
.ib-rownum { color: #94a3b8; font-variant-numeric: tabular-nums; margin-right: 4px; }
.ib-tag {
  display: inline-block; margin-left: 3px; padding: 0 5px;
  border-radius: 8px; font-size: 10px; line-height: 15px; white-space: nowrap;
}
.ib-tag-manual { background: #dbeafe; color: #1d4ed8; }
.ib-tag-doc    { background: #fef3c7; color: #b45309; }
.ib-tag-live   { background: #dcfce7; color: #15803d; }
.ib-tag-lark   { background: #fef3c7; color: #b45309; }
.ib-tag-live-split { background: #e0e7ff; color: #4338ca; }
.ib-tag-live-unmatched { background: #fee2e2; color: #b91c1c; }
.ib-live-hint { margin-left: 8px; font-size: 12px; color: #6b7280; }
.ib-live-hint-on { color: #15803d; font-weight: 600; }
.ib-tag-edited { background: #ede9fe; color: #6d28d9; }
.ib-rowdel {
  margin-left: 4px; border: 0; background: transparent; cursor: pointer;
  color: #cbd5e1; font-size: 14px; line-height: 1; padding: 0 3px;
}
.ib-rowdel:hover { color: #dc2626; }
#inboundTable td.ib-cell-edit { cursor: text; }
#inboundTable td.ib-cell-edit:hover { background: #f1f5f9; }
#inboundTable td.ib-cell-patched { position: relative; background: #f5f3ff; }
#inboundTable td.ib-cell-patched::before {
  content: ""; position: absolute; top: 0; left: 0;
  border-width: 5px 5px 0 0; border-style: solid; border-color: #7c3aed transparent transparent transparent;
}
#inboundTable td.ib-cell-editing { padding: 0; }
.ib-editor {
  width: 100%; box-sizing: border-box; border: 1px solid #2563eb; border-radius: 3px;
  padding: 3px 5px; font: inherit; background: #fff;
}
#inboundTable tr.ib-row-manual > td { background: #fffbeb; }
#inboundTable tr.ib-row-live > td { background: #f0fdf4; }
#inboundTable tr.ib-row-draft > td { background: #eff6ff; }
.ib-draft-save, .ib-draft-cancel {
  border: 0; border-radius: 4px; cursor: pointer; font-size: 11px;
  padding: 3px 7px; margin-right: 3px;
}
.ib-draft-save { background: #2563eb; color: #fff; }
.ib-draft-cancel { background: #e2e8f0; color: #334155; }
.ib-conflict { margin: 10px 0; border: 1px solid #f0c36d; background: #fffaf0; border-radius: 10px; padding: 10px 14px; }
.ib-conflict-head { color: #8a5a00; font-size: 12.5px; line-height: 1.7; }
.ib-conflict-list { margin: 6px 0 0; padding-left: 18px; color: #5a6b82; font-size: 12px; line-height: 1.9; }
.ib-conflict-list .cf-was { color: #93a3b8; }
.ib-conflict-list .cf-mine { color: #6d28d9; }
.ib-conflict-list .cf-lark { color: #b45309; }
.ib-tag-suspended { background: #fee2e2; color: #b42318; }
.ib-tag-dup { background: #e2e8f0; color: #475569; }
.ib-conflict-list .cf-stop { color: #b42318; font-weight: 600; }
.ib-rebind, .ib-discard {
  margin-left: 3px; border: 1px solid #cbd5e1; background: #fff; border-radius: 4px;
  cursor: pointer; font-size: 10px; line-height: 15px; padding: 0 5px; color: #475569;
}
.ib-rebind:hover { border-color: #2563eb; color: #2563eb; }
.ib-discard:hover { border-color: #b42318; color: #b42318; }

/* ---------------------------------------------------------------- v38（用户 9/25）
   列宽像 Excel：拖表头右边线改宽，双击右边线按内容自适配（宽度记在本浏览器）；表格上方同步横向拉条；
   超出列宽的内容省略显示，鼠标停上去看全文，双击任一格直接改。 */
table.inbound-grid-table { table-layout: fixed; width: 1px; min-width: 0; }
table.inbound-grid-table th, table.inbound-grid-table td { overflow: hidden; text-overflow: ellipsis; }
table.inbound-grid-table th { position: sticky; }
.ib-col-resize {
  position: absolute; top: 0; right: -1px; bottom: 0; width: 9px; cursor: col-resize; z-index: 5;
  border-right: 3px solid transparent;
}
table.inbound-grid-table th:hover .ib-col-resize { border-right-color: #9fb3cf; }
body.ib-col-resizing, body.ib-col-resizing * { cursor: col-resize !important; user-select: none !important; }
#inboundTable th.ib-gutter, #inboundTable td.ib-gutter { left: 0; z-index: 3; overflow: hidden; }
#inboundTable th.ib-gutter { z-index: 6; background: #eceff6; }
table.inbound-grid-table th.stick1, table.inbound-grid-table td.stick1 { left: 0; }
/* v43：行号列删除后，行标记与行按钮放在「仓库」格里，放不下就换行，不裁掉 */
table.inbound-grid-table td.ib-first { white-space: normal; text-overflow: clip; background: var(--surface, #fff); z-index: 2; }
/* v43r2：手改过仓库的格带 #inboundTable td.ib-cell-patched { position: relative }，优先级更高会把首格的钉住冲掉；这里按更高优先级钉回，紫底与角标保留 */
#inboundTable td.ib-first.stick1 { position: sticky; left: 0; }
.ib-marks { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-left: 4px; vertical-align: middle; }
.ib-marks .ib-tag { margin-left: 0; }
.ib-draft-actions { display: inline-flex; gap: 4px; margin-top: 4px; }
table.inbound-grid-table td.ib-first.ib-cell-editing .ib-editor { display: block; }
table.inbound-grid-table th.stick1 { z-index: 6; }
table.inbound-grid-table td.ib-cell-editing { padding: 3px 4px; }
table.inbound-grid-table td.ib-cell-editing .ib-editor { width: 100%; box-sizing: border-box; }
.ib-topscroll { overflow-x: auto; overflow-y: hidden; height: 14px; flex: 0 0 auto; border-bottom: 1px solid #e3e9f1; }
.ib-topscroll > div { height: 1px; }

/* 嵌在台账页「进口明细」子页里：不画顶栏，表格占满 */
body.inbound-embed .dispatch-page-topbar { display: none; }
body.inbound-embed .dispatch-page-main { padding: 0; }
body.inbound-embed .inbound-grid-shell { border-radius: 10px; }
body.inbound-embed .dispatch-page-shell { grid-template-rows: minmax(0, 1fr); }
