/* 盘点锁定开关（桌面 + 手机查货） */

.count-lock-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  vertical-align: middle;
  touch-action: manipulation;
}

.count-lock-switch:disabled {
  opacity: 0.55;
  cursor: wait;
}

.count-lock-switch[data-cl-busy="1"] {
  pointer-events: none;
}

.count-lock-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.45);
  transition: background 0.14s ease, border-color 0.14s ease;
  flex: 0 0 auto;
  will-change: background;
  transform: translateZ(0);
}

.count-lock-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  transform: translateZ(0);
}

.count-lock-switch.is-on .count-lock-track {
  background: rgba(34, 197, 94, 0.55);
  border-color: rgba(34, 197, 94, 0.75);
}

.count-lock-switch.is-on .count-lock-thumb {
  transform: translate3d(16px, 0, 0);
}

.count-lock-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  line-height: 1;
}

.count-lock-switch.is-on .count-lock-lbl {
  color: #4ade80;
}

.count-lock-switch.is-pending .count-lock-track {
  background: rgba(251, 191, 36, 0.45);
  border-color: rgba(251, 191, 36, 0.75);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.28);
}

.count-lock-switch.is-pending .count-lock-lbl {
  color: #fbbf24;
  font-weight: 800;
}

.count-lock-compact .count-lock-track {
  width: 34px;
  height: 20px;
}

.count-lock-compact .count-lock-thumb {
  width: 14px;
  height: 14px;
}

.count-lock-compact.is-on .count-lock-thumb {
  transform: translate3d(14px, 0, 0);
}

.count-lock-compact .count-lock-lbl {
  font-size: 10px;
}

/* 桌面：盘点列（单行紧凑） */
#dash-sheet col.dash-col-count {
  width: 56px;
}

#dash-sheet .col-count.dash-count-cell {
  vertical-align: middle;
  padding: 4px 3px !important;
  text-align: center;
}

.dash-count-cell {
  min-width: 52px;
}

.dash-count-single {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-count-cell .count-lock-lbl {
  display: none;
}

.dash-count-cell .count-lock-switch {
  gap: 0;
}

.dash-count-empty {
  font-size: 12px;
  line-height: 1.2;
}

.dash-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: default;
}

button.dash-count-pill {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
}

.dash-count-pill.none {
  color: var(--muted, #94a3b8);
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.1);
}

button.dash-count-pill.none:hover {
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(148, 163, 184, 0.16);
}

.dash-count-pill.partial {
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

button.dash-count-pill.partial:hover {
  background: rgba(251, 191, 36, 0.2);
}

.dash-count-pill.all {
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

button.dash-count-pill.all:hover {
  background: rgba(34, 197, 94, 0.2);
}

.count-lock-manage-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.25));
  background: var(--glass-strong, rgba(15, 23, 42, 0.35));
}

.count-lock-manage-row .count-lock-pick-code {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.count-lock-manage-row .count-lock-pick-qty {
  font-size: 12px;
  white-space: nowrap;
}

/* 旧堆叠布局（已弃用，保留 tag 供弹窗等） */
.dash-count-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #94a3b8);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.45);
}

.dash-count-tag.is-locked {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.12);
}

.loc-chip.count-locked,
.mloc-chip.count-locked {
  outline: 2px solid rgba(34, 197, 94, 0.45);
  outline-offset: 1px;
}

/* 批量选择弹窗 */
.count-lock-select-all-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
  font-weight: 700;
}

.count-lock-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
}

.count-lock-pick-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.25));
  background: var(--glass-strong, rgba(15, 23, 42, 0.35));
  cursor: pointer;
}

.count-lock-pick-code {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.count-lock-pick-state {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #94a3b8);
}

.count-lock-pick-item:has(input:checked) .count-lock-pick-state {
  color: #4ade80;
}

.mloc-count-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

/* 手机查货库位行：强制单行三列，防开关换行 */
body.mobile-query-mode .mq-loc-row {
  display: grid !important;
  grid-template-columns: minmax(3.2em, 28%) minmax(0, 1fr) auto !important;
  align-items: center;
  column-gap: 8px;
  flex-wrap: nowrap;
}

body.mobile-query-mode .mq-loc-lock {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

body.mobile-query-mode .mq-loc-row .count-lock-switch {
  flex: 0 0 auto;
  margin: 0;
  max-width: 100%;
}

body.mobile-query-mode .mq-loc-tile.mq-loc-locked {
  border-color: rgba(34, 197, 94, 0.45) !important;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.18);
}

body.mobile-query-mode .mq-loc-code {
  min-width: 0;
}

body.mobile-query-mode .mq-loc-qty {
  min-width: 0;
  text-align: right;
}

body.mobile-query-mode .mq-card-head-row .count-lock-switch {
  flex-shrink: 0;
}

/* 编辑型号弹窗 · 盘点锁定 */
#modal-product-edit .pe-modal-head {
  align-items: flex-start;
  gap: 10px;
}

#modal-product-edit .pe-modal-head-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

#modal-product-edit .pe-modal-head-row h3 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.pe-count-lock-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.pe-count-badge {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.pe-count-badge.partial {
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

.pe-count-badge.all {
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

#modal-product-edit .prod-edit-panel.pe-form-locked .prod-form-grid input:not([readonly]):disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#modal-product-edit #pe-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
