:root {
  --nav-bg: #425164;
  --nav-bg-deep: #394656;
  --panel-bg: #ffffff;
  --page-bg: #f3f4f7;
  --line: #e8edf3;
  --line-strong: #dfe5ed;
  --text: #2f4259;
  --muted: #8c97a7;
  --primary: #3b82f6;
  --primary-soft: #edf4ff;
  --orange: #f0a33a;
  --danger: #ef5b5b;
  --shadow: 0 16px 30px rgba(31, 45, 61, 0.08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.erp-shell {
  display: grid;
  grid-template-columns: 144px 1fr;
  min-height: 100vh;
}

.global-nav {
  background: var(--nav-bg);
  color: #fff;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.avatar {
  width: 30px;
  height: 30px;
  margin: 0 0 12px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #9ccf62, #3f7f30);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 6px;
}

.nav-item {
  border: none;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}

.nav-item.active {
  background: #607185;
}

.nav-icon {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  opacity: 0.95;
  font-size: 14px;
  line-height: 1;
}

.nav-icon-green,
.nav-icon-orange,
.nav-icon-dark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.nav-icon-green {
  background: #8ecf4d;
}

.nav-icon-orange {
  background: #f3b13d;
}

.nav-icon-dark {
  background: #000;
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  padding: 0 5px;
  height: 18px;
  border-radius: 999px;
  background: #ef4d4d;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  margin: 10px 8px;
  background: rgba(255, 255, 255, 0.16);
}

.nav-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-around;
  padding: 10px 6px 0;
}

.nav-mini {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 38px;
  padding: 0 14px;
  background: var(--nav-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.topbar-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #f1b249;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.topbar-icon {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  opacity: 0.95;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.workspace-body {
  display: grid;
  grid-template-columns: 286px 1fr;
  gap: 10px;
  padding: 10px 10px 14px 10px;
  min-height: calc(100vh - 38px);
}

.warehouse-sidebar,
.content-area {
  min-width: 0;
}

.warehouse-card,
.filter-bar,
.table-panel {
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.warehouse-card {
  height: 100%;
  border-radius: var(--radius-lg);
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.warehouse-top-gap {
  height: 8px;
  flex: 0 0 auto;
}

.warehouse-card-body {
  flex: 1 1 auto;
  padding: 0 6px 6px 8px;
  overflow: auto;
}

.warehouse-bottom-gap {
  height: 14px;
  flex: 0 0 auto;
}

.warehouse-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.warehouse-node {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.warehouse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 10px 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.warehouse-row.level-0 {
  padding-left: 12px;
}

.warehouse-row.level-1 {
  padding-left: 28px;
}

.warehouse-row.level-2 {
  padding-left: 44px;
}

.warehouse-row.active {
  background: transparent;
  color: var(--text);
  font-weight: 500;
}

.warehouse-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px 8px 50px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  position: relative;
  color: var(--text);
}

.warehouse-main {
  border: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  padding: 0;
  display: block;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.warehouse-item.level-2 {
  padding-left: 66px;
}

.warehouse-item.active {
  background: #f0f3f7;
}

.warehouse-label {
  display: block;
  min-width: 0;
  position: relative;
  width: 100%;
  padding-right: 20px;
}

.warehouse-alert-indicator {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: #d96b1d;
  pointer-events: none;
}

.warehouse-alert-indicator svg {
  width: 16px;
  height: 16px;
  display: block;
}

.tree-toggle {
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  cursor: pointer;
}

.warehouse-arrow {
  color: #616d7d;
  font-size: 11px;
  display: inline-block;
  transition: transform 0.16s ease;
}

.warehouse-arrow.expanded {
  transform: rotate(0deg);
}

.warehouse-arrow:not(.expanded) {
  transform: rotate(-90deg);
}

.warehouse-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.warehouse-actions {
  position: relative;
  width: 22px;
  min-width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dots-button,
.plus-button {
  border: none;
  background: transparent;
  color: #6d7786;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plus-button {
  width: 20px;
  height: 20px;
  padding: 0;
  line-height: 1;
  font-size: 14px;
}

.dots-button {
  width: 22px;
  height: 22px;
  padding: 0;
  gap: 3px;
  border-radius: 999px;
}

.dots-button span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.88;
}

.dots-button:hover,
.plus-button:hover {
  background: rgba(59, 130, 246, 0.08);
}

.more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: -6px;
  min-width: 92px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(49, 61, 78, 0.12);
  z-index: 20;
  overflow: hidden;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
  color: #58677a;
  font-size: 13px;
  line-height: 1;
}

.menu-item:hover {
  background: #f4f7fb;
}

.menu-item.primary {
  color: #58677a;
  font-weight: 400;
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 0 0;
}

.content-top-gap {
  height: 0;
  flex: 0 0 auto;
}

.content-card {
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.filter-bar {
  min-height: 62px;
  padding: 12px 18px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.search-box {
  width: 256px;
  height: 34px;
  border: 1px solid #d4dbe5;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  color: var(--text);
}

.search-box input::placeholder {
  color: #a0a9b5;
}

.search-icon {
  color: #7a8798;
  font-size: 14px;
  line-height: 1;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #778396;
  font-size: 14px;
}

.table-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.table-wrap {
  overflow: auto;
  padding: 12px 10px 0 10px;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  border: 1px solid #edf1f6;
  height: 46px;
  padding: 10px 12px;
  font-size: 14px;
  color: #4d5e73;
  vertical-align: middle;
  background: #fff;
}

th {
  background: #eff3f7;
  font-weight: 500;
  color: #394b62;
  text-align: left;
}

td:first-child a,
.product-link {
  color: #2d73ff;
  text-decoration: none;
}

.table-panel th:nth-child(1),
.table-panel th:nth-child(2),
.table-panel td:nth-child(1),
.table-panel td:nth-child(2) {
  width: 1%;
  white-space: nowrap;
}

.numeric {
  text-align: right;
}

.stock-cell {
  min-width: 150px;
}

.stock-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.transit-chip {
  position: relative;
  min-width: 18px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #edf4ff;
  color: #2b73e0;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.transit-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  min-width: 220px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(43, 53, 68, 0.96);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 14px 28px rgba(24, 33, 48, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 8;
}

.transit-chip:hover .transit-popover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.transit-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
}

.transit-row + .transit-row {
  margin-top: 4px;
}

.transit-row.pending {
  background: rgba(240, 163, 58, 0.12);
}

.transit-row.approving {
  background: rgba(59, 130, 246, 0.14);
}

.transit-row.approved {
  background: rgba(62, 179, 126, 0.14);
}

.transit-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.transit-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.transit-label {
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}

.transit-qty {
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.type-tag,
.attr-tag,
.footer-tag,
.meta-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.type-tag {
  padding: 2px 8px;
  background: #f5f7fa;
  color: #6f7c8e;
  font-size: 12px;
}

.attr-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.attr-tag {
  min-width: 34px;
  padding: 2px 8px;
  background: #f5f7fa;
  color: #5f7086;
  font-size: 12px;
  border-radius: 4px;
}

.attr-tag.link {
  color: #2d73ff;
}

.status-pill {
  padding: 5px 10px;
  font-size: 12px;
}

.status-empty {
  color: #7b8695;
  background: #f1f4f8;
}

.status-low {
  color: #b26d10;
  background: #fff1da;
}

.status-high {
  color: #c54b3f;
  background: #fde4e1;
}

.status-normal {
  color: #2f7d4e;
  background: #e6f7ec;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 12px 16px 16px;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7c8897;
  font-size: 13px;
  flex-wrap: wrap;
}

.footer-tag,
.meta-pill {
  padding: 4px 8px;
  background: #f3f6fb;
  color: #627287;
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pagination-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  min-width: 34px;
  height: 32px;
  border: 1px solid #dfe5ed;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #627287;
  cursor: pointer;
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn[disabled] {
  opacity: 0.45;
  cursor: default;
}

.page-size {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #dfe5ed;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #627287;
  font-size: 13px;
}

.content-bottom-gap {
  height: 0;
  flex: 0 0 auto;
}

.hidden-trigger,
.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 39, 53, 0.32);
  display: grid;
  place-items: center;
  z-index: 40;
}

.modal {
  width: min(1060px, calc(100vw - 60px));
  height: min(660px, calc(100vh - 70px));
  max-height: calc(100vh - 70px);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 22px 40px rgba(20, 30, 41, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid #eef2f7;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.modal h3 {
  margin: 0;
  font-size: 18px;
}

.modal-subtitle {
  margin: 8px 0 0;
  color: #7b8697;
  font-size: 13px;
}

.modal-search-box {
  width: 320px;
  height: 34px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #d6dce6;
  border-radius: var(--radius-sm);
  background: #fff;
}

.modal-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.modal-search-icon {
  color: #8c97a7;
  font-size: 15px;
  flex: 0 0 auto;
  line-height: 1;
}

.modal-search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #31455d;
  background: transparent;
}

.modal-search-box input::placeholder {
  color: #a7b0bf;
}

.close-button {
  border: none;
  background: transparent;
  font-size: 26px;
  color: #8590a0;
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
}

.modal-table-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 0;
  margin-top: 10px;
}

.modal-table-wrap::before {
  content: "";
  position: sticky;
  display: block;
  top: 0;
  height: 10px;
  margin: 0 -10px;
  background: #fff;
  z-index: 9;
}

.modal-table th {
  position: sticky;
  top: 10px;
  z-index: 8;
  background: #eef3f8;
  box-shadow: 0 1px 0 #dfe7f1;
  background-clip: padding-box;
}

.modal-table {
  width: 100%;
  table-layout: fixed;
}

.modal-col-select {
  width: 58px;
}

.modal-col-product {
  width: 20%;
}

.modal-col-stock {
  width: 10%;
}

.modal-col-upper,
.modal-col-lower {
  width: 34%;
}

.modal-table th,
.modal-table td {
  height: auto;
  padding: 12px 12px;
  vertical-align: top;
}

.bulk-header-cell {
  display: block;
  position: relative;
  background: #eef3f8;
}

.bulk-header {
  position: relative;
  min-height: 24px;
  background: #eef3f8;
}

.bulk-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-icon-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  background: #fff;
  color: #6f7d91;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bulk-icon-btn svg {
  width: 14px;
  height: 14px;
}

.bulk-icon-btn.active {
  color: var(--primary);
  border-color: #bdd1ff;
  background: #edf4ff;
}

.bulk-field-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 6;
  padding: 10px 12px 12px;
  background: #edf2f7;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(31, 45, 61, 0.04);
}

.bulk-field-wrap {
  width: 100%;
}

.bulk-field-wrap input {
  max-width: none;
  background: #fff;
}

.modal-table td:first-child,
.modal-table td:nth-child(2),
.modal-table td:nth-child(3) {
  white-space: normal;
}

.bulk-select-header,
.bulk-select-cell {
  text-align: center;
}

.bulk-select-header {
  min-width: 34px;
  white-space: nowrap;
}

.bulk-select-cell {
  padding: 0;
}

.bulk-select-cell-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-product-name {
  color: #31455d;
  font-weight: 500;
  line-height: 1.5;
  word-break: break-word;
}

.product-type-row {
  margin-top: 6px;
}

.product-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid transparent;
}

.product-type-badge.integer {
  color: #7a4f11;
  background: #fff4df;
  border-color: #f5d7a6;
}

.product-type-badge.decimal {
  color: #1e5bb8;
  background: #edf5ff;
  border-color: #c8dcfb;
}

.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  width: 100%;
}

.field-wrap input {
  height: 34px;
  width: 100%;
  max-width: 320px;
  border: 1px solid #d6dce6;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  outline: none;
}

.field-wrap input:focus {
  border-color: var(--primary);
}

.field-wrap input.invalid {
  border-color: var(--danger);
  background: #fff8f8;
}

.field-error {
  font-size: 12px;
}

.field-error {
  color: var(--danger);
}

.bulk-checkbox {
  position: relative;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  flex: 0 0 16px;
}

.bulk-checkbox input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.bulk-checkbox.disabled input {
  cursor: not-allowed;
}

.bulk-checkbox span {
  display: block;
  width: 16px;
  height: 16px;
  border: 1px solid #cbd5e3;
  border-radius: 4px;
  background: #fff;
}

.bulk-checkbox input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 3px #fff;
}

.bulk-checkbox.disabled span {
  background: #f2f4f8;
  border-color: #d9e0ea;
  opacity: 0.7;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 22px;
  border-top: 1px solid #eef2f7;
}

.secondary-button,
.primary-button {
  min-width: 74px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.secondary-button {
  border: 1px solid #d6dce6;
  background: #fff;
  color: #637386;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.toast {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: rgba(29, 39, 52, 0.94);
  color: #fff;
  z-index: 50;
  box-shadow: 0 10px 24px rgba(29, 39, 52, 0.18);
}

@media (max-width: 1180px) {
  .erp-shell {
    grid-template-columns: 88px 1fr;
  }

  .workspace-body {
    grid-template-columns: 240px 1fr;
  }

  .nav-item span:last-child:not(.nav-badge),
  .nav-item span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 900px) {
  .workspace-body {
    grid-template-columns: 1fr;
  }

  .warehouse-sidebar {
    display: none;
  }

  .filter-bar,
  .table-panel {
    border-radius: 8px;
  }
}


/* Product operations dropdown */
.product-ops-cell{position:relative;}
.product-ops-cell .warehouse-actions{position:relative;display:inline-flex;}
.product-more-menu{position:fixed;z-index:99999;box-shadow:0 4px 16px rgba(0,0,0,0.15);min-width:80px;display:flex;flex-direction:column;padding:4px 0;background:#fff;border-radius:6px;border:1px solid #edf1f6;}
.product-more-menu .action-menu-item{display:block;width:100%;text-align:center;padding:8px 20px;white-space:nowrap;border:none;background:transparent;cursor:pointer;font-size:14px;color:#4d5e73;}
.product-more-menu .action-menu-item:hover{background:#f5f7fa;color:#3b82f6;}
.product-ops-cell{position:relative;overflow:visible;}
table,tbody,tr,td{overflow:visible;}

/* Transfer dialog */
.transfer-dialog{width:min(720px,calc(100vw - 60px));max-height:calc(100vh - 60px);background:#fff;border-radius:10px;box-shadow:0 22px 40px rgba(20,30,41,0.22);display:flex;flex-direction:column;overflow:hidden;}
.transfer-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px 16px;}
.transfer-title{margin:0;font-size:16px;font-weight:600;color:#2f4259;}
.transfer-close-btn{border:none;background:transparent;font-size:22px;color:#8c97a7;cursor:pointer;line-height:1;padding:0 2px;font-family:inherit;}
.transfer-close-btn:hover{color:#4d5e73;}
.transfer-body{flex:1 1 auto;overflow-y:auto;padding:0 24px 8px;}
.transfer-target-field{margin-bottom:16px;}
.transfer-field-label{display:block;font-size:14px;color:#4d5e73;margin-bottom:8px;}
.required-star{color:#ef5b5b;margin-right:2px;}
.transfer-select-wrap{position:relative;}
.transfer-select-input{width:100%;height:36px;border:1px solid #d6dce6;border-radius:6px;padding:0 12px;font-size:14px;color:#2f4259;background:#fff;outline:none;}
.transfer-select-input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(59,130,246,0.12);}
.transfer-row-product-select{width:100%;height:30px;border:1px solid #d6dce6;border-radius:4px;padding:0 8px;background:#fff;color:#2f4259;font:inherit;outline:none;}
.transfer-row-product-select:focus{border-color:var(--primary);}
.transfer-table-area{margin-bottom:8px;}
.transfer-table{width:100%;border-collapse:collapse;table-layout:fixed;}
.transfer-table th,.transfer-table td{border:1px solid #edf1f6;padding:10px 12px;font-size:13px;color:#4d5e73;vertical-align:middle;background:#fff;text-align:left;}
.transfer-table th{background:#f7f9fb;font-weight:500;color:#394b62;}
.transfer-table th:nth-child(1){width:28%;}
.transfer-table th:nth-child(2){width:15%;text-align:center;}
.transfer-table th:nth-child(3){width:40%;}
.transfer-table th:nth-child(4){width:17%;text-align:center;}
.transfer-table td:nth-child(2){text-align:center;}
.transfer-table td:nth-child(4){text-align:center;}
.transfer-qty-code-cell{display:flex;align-items:center;gap:8px;}
.transfer-qty-input{width:100px;height:30px;border:1px solid #d6dce6;border-radius:4px;padding:0 8px;font-size:13px;color:#2f4259;outline:none;}
.transfer-qty-input:focus{border-color:var(--primary);}
.transfer-qty-input::placeholder{color:#b0b8c4;}
.transfer-qty-input:disabled,.transfer-code-btn:disabled{cursor:not-allowed;opacity:.45;}
.transfer-code-btn{display:inline-flex;align-items:center;gap:4px;border:none;background:transparent;color:#3b82f6;font-size:13px;cursor:pointer;padding:4px 0;white-space:nowrap;}
.transfer-code-btn:hover{color:#2563eb;}
.transfer-code-btn.has-code-tooltip{position:relative;}
.transfer-code-btn.has-code-tooltip::after{content:attr(data-code-tooltip);position:absolute;z-index:100002;left:0;top:calc(100% + 6px);min-width:180px;max-width:280px;padding:8px 10px;border-radius:4px;background:rgba(37,52,71,.96);box-shadow:0 6px 16px rgba(20,30,41,.18);color:#fff;font-size:12px;font-weight:400;line-height:18px;text-align:left;white-space:pre-line;opacity:0;pointer-events:none;transform:translateY(-2px);transition:opacity .15s ease,transform .15s ease;}
.transfer-code-btn.has-code-tooltip:hover::after{opacity:1;transform:translateY(0);}
.transfer-ops-cell{display:flex;align-items:center;justify-content:center;gap:12px;}
.transfer-count-label{color:#8c97a7;font-size:13px;}
.transfer-delete-btn{border:none;background:transparent;color:#8c97a7;font-size:16px;cursor:pointer;padding:2px;}
.transfer-delete-btn:hover{color:#ef5b5b;}
.transfer-add-row-wrap{display:flex;justify-content:center;padding:12px 0;}
.transfer-add-btn{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 20px;border:1px solid #3b82f6;border-radius:6px;background:#fff;color:#3b82f6;font-size:13px;cursor:pointer;font-weight:500;}
.transfer-add-btn:hover{background:#f0f6ff;}
.transfer-remark-area{margin-top:4px;}
.transfer-remark-label{display:block;font-size:14px;color:#4d5e73;margin-bottom:8px;}
.transfer-remark-wrap{position:relative;}
.transfer-remark-input{width:100%;min-height:80px;border:1px solid #d6dce6;border-radius:6px;padding:10px 12px 24px;font-size:14px;color:#2f4259;outline:none;resize:vertical;font-family:inherit;box-sizing:border-box;}
.transfer-remark-input:focus{border-color:var(--primary);}
.transfer-remark-input::placeholder{color:#b0b8c4;}
.transfer-remark-counter{position:absolute;right:12px;bottom:8px;font-size:12px;color:#b0b8c4;}
.transfer-footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid #eef2f7;}

/* Code select dialog */
.code-select-dialog{width:min(560px,calc(100vw - 60px));max-height:calc(100vh - 60px);background:#fff;border-radius:10px;box-shadow:0 22px 40px rgba(20,30,41,0.22);display:flex;flex-direction:column;overflow:hidden;z-index:100001;}
.code-select-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px 12px;}
.code-select-title{margin:0;font-size:16px;font-weight:600;color:#2f4259;}
.code-select-body{flex:1 1 auto;overflow-y:auto;padding:0 24px 8px;}
.code-search-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px;}
.code-search-wrap{position:relative;flex:1;max-width:280px;}
.code-search-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);font-size:14px;color:#8c97a7;line-height:1;}
.code-search-input{width:100%;height:34px;border:1px solid #d6dce6;border-radius:6px;padding:0 12px 0 32px;font-size:14px;color:#2f4259;outline:none;background:#f7f9fb;}
.code-search-input:focus{border-color:var(--primary);background:#fff;}
.code-search-input::placeholder{color:#b0b8c4;}
.code-selected-count{margin-left:auto;font-size:14px;color:#4d5e73;white-space:nowrap;}
.code-table-area{flex:1;min-width:0;height:420px;max-height:420px;overflow-y:auto;border:1px solid #edf1f6;border-radius:4px;}
.code-table{width:100%;table-layout:fixed;border-collapse:collapse;}
.code-table th,.code-table td{padding:10px 12px;font-size:14px;color:#4d5e73;border-bottom:1px solid #edf1f6;text-align:left;background:#fff;vertical-align:middle;}
.code-table th{background:#f7f9fb;font-weight:500;color:#394b62;position:sticky;top:0;z-index:1;}
.code-th-check,.code-td-check{width:44px;text-align:center;}
.code-code-cell{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.45;}
.code-table tr:hover td{background:#f5f7fa;}
.code-pagination{display:flex;align-items:center;justify-content:center;gap:6px;padding:14px 0 4px;flex-wrap:wrap;font-size:13px;color:#4d5e73;}
.code-pagination button{min-width:30px;height:28px;border:1px solid #d6dce6;border-radius:4px;background:#fff;color:#4d5e73;font-size:13px;cursor:pointer;padding:0 6px;}
.code-pagination button:hover{border-color:var(--primary);color:var(--primary);}
.code-pagination button.active{background:var(--primary);color:#fff;border-color:var(--primary);}
.code-pagination button:disabled{opacity:0.4;cursor:default;}
.code-pagination .code-page-info{font-size:13px;color:#8c97a7;}
.code-pagination .code-page-size{height:28px;border:1px solid #d6dce6;border-radius:4px;padding:0 6px;font-size:13px;color:#4d5e73;outline:none;}
.code-select-footer{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid #eef2f7;}

/* Code select backdrop higher than transfer */
#codeSelectBackdrop{z-index:100000;}

/* Code select expanded mode */
.code-select-dialog.expanded{width:min(980px,calc(100vw - 40px));}
.code-select-body.split-view{display:flex;align-items:stretch;gap:12px;padding-bottom:16px;}
.code-left-panel{flex:1;min-width:0;padding-right:0;display:flex;flex-direction:column;}
.code-right-panel{width:260px;flex:0 0 260px;padding-left:0;display:flex;flex-direction:column;gap:12px;}
.code-right-title{font-size:14px;font-weight:600;color:#2f4259;margin:0 0 8px;}
.code-right-desc{font-size:13px;color:#8c97a7;margin:0 0 8px;}
.code-paste-area{flex:1;min-height:320px;border:1px dashed #d6dce6;border-radius:8px;padding:12px;font-size:13px;color:#2f4259;outline:none;resize:none;font-family:monospace;line-height:1.8;background:#f9fafb;box-sizing:border-box;}
.code-paste-area:focus{border-color:var(--primary);background:#fff;}
.code-paste-area::placeholder{color:#b0b8c4;font-family:inherit;}
.code-scan-row{display:flex;gap:8px;align-items:center;}
.code-scan-btn{height:32px;padding:0 14px;border:1px solid var(--primary);border-radius:6px;background:#fff;color:var(--primary);font-size:13px;cursor:pointer;display:inline-flex;align-items:center;gap:4px;}
.code-scan-btn:hover{background:#f0f6ff;}
.code-recognize-btn{height:32px;padding:0 14px;border:1px solid var(--primary);border-radius:6px;background:var(--primary);color:#fff;font-size:13px;cursor:pointer;font-weight:500;}
.code-recognize-btn:hover{opacity:0.9;}
.code-identify-toggle{height:32px;padding:0 14px;border:1px solid #d6dce6;border-radius:6px;background:#fff;color:#4d5e73;font-size:13px;cursor:pointer;white-space:nowrap;}
.code-identify-toggle.active{border-color:var(--primary);color:var(--primary);background:#f0f6ff;}

/* Fix scan buttons in right panel bottom */
.code-scan-row{margin-top:auto;padding-top:8px;}
.code-left-panel .code-pagination{justify-content:flex-start;}

/* Code recognize results */
.code-result-list{margin-top:0;max-height:none;overflow-y:auto;border:1px solid #d6dce6;border-radius:6px;padding:10px 12px;min-height:200px;background:#f9fafb;font-family:monospace;line-height:1.8;}
.code-result-item{padding:0;font-size:13px;font-family:monospace;display:flex;flex-direction:column;gap:1px;}
.code-result-item+.code-result-item{margin-top:2px;}
.code-result-item.success .code-result-text{color:#3b82f6;}
.code-result-item.error .code-result-text{color:#ef4444;border:1px solid #ef4444;border-radius:3px;padding:1px 4px;display:inline-block;}
.code-result-text{font-weight:500;}
.code-result-hint{font-size:12px;color:#ef4444;font-family:sans-serif;}

/* Code result editable items */
.code-result-item{flex-direction:row;flex-wrap:wrap;align-items:center;gap:0;}
.code-result-input-wrap{display:flex;align-items:center;gap:6px;width:100%;}
.code-result-input{flex:1;height:30px;border:1px solid #d6dce6;border-radius:4px;padding:0 8px;font-size:13px;font-family:monospace;color:#2f4259;outline:none;}
.code-result-input:focus{border-color:var(--primary);}
.code-result-item.error .code-result-input{border-color:#ef4444;color:#ef4444;}
.code-result-delete{width:24px;height:24px;border:1px solid #ef4444;border-radius:4px;background:#fff;color:#ef4444;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.code-result-delete:hover{background:#fef2f2;}
.code-result-hint{width:100%;padding-left:0;margin-top:2px;}

/* Transfer add row wrap layout */
.transfer-add-row-wrap{display:flex;align-items:center;justify-content:center;gap:16px;}
.transfer-code-identify-btn{color:var(--primary);border-color:var(--primary);}

/* Batch recognition panel */
.code-right-panel{
  width:300px;
  flex:0 0 300px;
  min-width:0;
  gap:0;
  padding:2px 0 0;
}
.code-right-header{
  padding:0 2px 10px;
}
.code-right-title{
  margin:0;
  color:#2f4259;
  font-size:14px;
  font-weight:600;
  line-height:22px;
}
.code-right-desc{
  margin:4px 0 0;
  color:#8c97a7;
  font-size:12px;
  line-height:18px;
}
.code-paste-area{
  flex:0 0 178px;
  min-height:178px;
  height:178px;
  padding:12px;
  border:1px solid #dbe3ed;
  border-radius:6px;
  background:#fbfcfe;
  color:#31455d;
  font-family:inherit;
  font-size:13px;
  line-height:22px;
}
.code-paste-area:focus{
  border-color:var(--primary);
  background:#fff;
  box-shadow:0 0 0 3px rgba(59,130,246,.10);
}
.code-paste-area::placeholder{
  color:#a7b0bf;
  font-family:inherit;
  line-height:22px;
}
.code-recognize-actions{
  display:flex;
  justify-content:flex-end;
  padding:10px 0 14px;
}
.code-recognize-actions .primary-button{
  min-width:94px;
  height:32px;
  padding:0 14px;
  font-size:13px;
}
#codeRecognizeResults{
  min-height:0;
}
.code-error-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 2px 7px;
  border-top:1px solid #eef2f7;
}
.code-error-title{
  color:#4d5e73;
  font-size:13px;
  font-weight:600;
}
.code-error-count{
  color:#ef5b5b;
  font-size:12px;
}
.code-result-list{
  max-height:190px;
  min-height:0;
  overflow-y:auto;
  padding:8px;
  border:1px solid #f2d5d5;
  border-radius:6px;
  background:#fffafa;
  font-family:inherit;
  line-height:1.4;
}
.code-result-item{
  padding:8px 0;
  display:block;
}
.code-result-item + .code-result-item{
  margin-top:0;
  border-top:1px solid #f6e2e2;
}
.code-result-input-wrap{
  width:100%;
}
.code-result-input{
  flex:1;
  width:0;
  height:30px;
  border:1px solid #ef9a9a;
  border-radius:4px;
  padding:0 8px;
  color:#c94c4c;
  background:#fff;
  font-family:inherit;
  font-size:13px;
  outline:none;
}
.code-result-input:focus{
  border-color:#ef5b5b;
  box-shadow:0 0 0 2px rgba(239,91,91,.10);
}
.code-result-retry{
  height:28px;
  padding:0 8px;
  border:1px solid #b8cfff;
  border-radius:4px;
  background:#fff;
  color:var(--primary);
  cursor:pointer;
  font-size:12px;
  white-space:nowrap;
}
.code-result-retry:hover{
  background:#f0f6ff;
  border-color:var(--primary);
}
.code-result-delete{
  width:26px;
  height:26px;
  border:1px solid #ef9a9a;
  border-radius:4px;
  background:#fff;
  color:#ef5b5b;
  cursor:pointer;
  font-size:16px;
  line-height:1;
}
.code-result-delete:hover{
  background:#fff1f1;
}
.code-result-hint{
  display:block;
  width:auto;
  margin-top:5px;
  padding-left:0;
  color:#ef5b5b;
  font-family:inherit;
  font-size:12px;
}

/* Keep batch input and exception maintenance as separate columns. */
.code-select-dialog.expanded{
  width:min(1040px,calc(100vw - 40px));
}
.code-select-dialog.expanded.has-code-errors{
  width:min(1180px,calc(100vw - 40px));
}
.code-right-panel{
  width:300px;
  flex:0 0 300px;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  height:100%;
  align-self:stretch;
  align-content:start;
  gap:14px;
}
.code-right-panel.has-errors{
  width:620px;
  flex-basis:620px;
  grid-template-columns:minmax(240px,1fr) minmax(260px,1fr);
  gap:14px;
}
.code-entry-column,
.code-error-panel{
  min-width:0;
}
.code-entry-column{
  height:100%;
  display:flex;
  flex-direction:column;
}
.code-entry-column .code-paste-area{
  flex:1 1 auto;
  width:100%;
  height:auto;
  min-height:0;
}
.code-entry-column .code-recognize-actions{
  flex:0 0 auto;
}
.code-input-box{
  flex:0 0 420px;
  height:420px;
  margin-top:12px;
  min-height:0;
  width:100%;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid #dbe3ed;
  border-radius:6px;
  background:#fbfcfe;
}
.code-input-box .code-paste-area{
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.code-input-box .code-paste-area:focus{
  border:0;
  background:#fff;
  box-shadow:none;
}
.code-input-box .code-recognize-actions{
  justify-content:flex-end;
  padding:10px 12px 12px;
  background:transparent;
}
.code-error-panel{
  display:none;
  min-height:0;
  padding-left:14px;
  border-left:1px solid #eef2f7;
}
.code-error-panel.visible{
  display:block;
  flex:0 0 462px;
  height:462px;
  position:relative;
  padding:0 0 0 14px;
  border-left:1px solid #eef2f7;
  background:transparent;
}
.code-error-panel .code-error-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  height:42px;
  box-sizing:border-box;
  padding:0 0 10px;
  border-top:0;
}
.code-error-panel .code-error-title{
  color:#2f4259;
  font-size:14px;
  font-weight:600;
  line-height:22px;
}
.code-error-panel .code-error-count{
  line-height:22px;
}
.code-error-panel .code-result-list{
  height:420px;
  max-height:420px;
  overflow-y:auto;
  box-sizing:border-box;
  border:1px solid #dbe3ed;
  border-radius:6px;
  padding:8px 12px;
  background:#fbfcfe;
}
.code-error-actions{
  position:absolute;
  right:12px;
  bottom:10px;
  z-index:2;
}
.code-error-retry-all{
  min-width:82px;
  height:32px;
  padding:0 14px;
  border:1px solid var(--primary);
  border-radius:4px;
  background:var(--primary);
  color:#fff;
  cursor:pointer;
  font-size:13px;
}
.code-error-retry-all:hover{
  opacity:.9;
}

/* Standalone transfer code recognition uses a balanced two-column layout. */
.transfer-identify-panel{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:16px;
  min-height:462px;
  padding:0 24px 18px;
  box-sizing:border-box;
}
.transfer-identify-input-column,
.transfer-identify-result-column{
  min-width:0;
}
.transfer-identify-panel .code-input-box{
  width:100%;
  height:420px;
  margin-top:0;
}
.transfer-identify-panel .code-paste-area{
  flex:1 1 auto;
  height:auto;
  min-height:0;
}
.transfer-identify-panel .primary-button:disabled{
  border-color:#cbd5e1;
  background:#cbd5e1;
  color:#fff;
  cursor:not-allowed;
}
.transfer-identify-panel .code-recognize-actions .primary-button,
#transferIdentifyResults .code-result-list > .primary-button{
  height:32px;
  padding:0 14px;
  font-family:inherit;
  font-size:13px;
  font-weight:500;
  line-height:1;
  letter-spacing:0;
}
.transfer-identify-result-title{
  height:42px;
  display:flex;
  align-items:flex-start;
  padding-bottom:10px;
  box-sizing:border-box;
  color:#2f4259;
  font-size:14px;
  font-weight:600;
  line-height:22px;
}
#transferIdentifyResults{
  height:420px;
  overflow-y:auto;
  box-sizing:border-box;
  border:1px solid #dbe3ed;
  border-radius:6px;
  padding:8px 12px;
  background:#fbfcfe;
}
#transferIdentifyResults .code-result-list{
  position:relative;
  height:100%;
  box-sizing:border-box;
  min-height:0;
  max-height:none;
  overflow:visible;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
}
#transferIdentifyResults .code-result-list > .primary-button{
  position:absolute;
  right:0;
  bottom:5px;
  margin:0 !important;
  border-color:var(--primary);
  background:#fff;
  color:var(--primary);
}
#transferIdentifyResults .code-result-list > .primary-button:hover{
  background:#f0f6ff;
}
@media (max-width:760px){
  .transfer-identify-panel{grid-template-columns:1fr;}
}
