#dieBatchWorkspace {
  --die-batch-ink: #172235;
  --die-batch-muted: #64748b;
  --die-batch-border: #dbe5f2;
  --die-batch-blue: #1769d2;
  --die-batch-blue-soft: #eef6ff;
  --die-batch-green: #047857;
  --die-batch-warn: #b45309;
  --die-batch-danger: #b42318;
  color: var(--die-batch-ink);
}

#dieBatchWorkspace button,
#dieBatchWorkspace input,
#dieBatchWorkspace select {
  font: inherit;
}

#dieBatchWorkspace button {
  cursor: pointer;
}

#dieBatchWorkspace button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

#dieBatchWorkspace button:focus-visible,
#dieBatchWorkspace input:focus-visible,
#dieBatchWorkspace select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

#dieBatchSkuRows {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.die-batch-sku-row {
  display: grid;
  grid-template-columns: 36px minmax(170px, 1.45fr) repeat(3, minmax(110px, 0.75fr))
    minmax(120px, 0.85fr) minmax(110px, 0.75fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--die-batch-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(51, 75, 105, 0.05);
}

.die-batch-sku-row__number {
  align-self: center;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--die-batch-blue-soft);
  color: var(--die-batch-blue);
  font-size: 13px;
  font-weight: 800;
}

.die-batch-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.die-batch-field > span,
.die-batch-check > span {
  color: var(--die-batch-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.die-batch-field input,
.die-batch-field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #cfdae8;
  border-radius: 11px;
  background: #fff;
  color: var(--die-batch-ink);
}

.die-batch-field input::placeholder {
  color: #a1adbd;
}

.die-batch-check {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.die-batch-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--die-batch-blue);
}

.die-batch-check input:disabled + span {
  color: #a1adbd;
}

.die-batch-row-remove {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #f1c9c5;
  border-radius: 11px;
  background: #fff8f7;
  color: var(--die-batch-danger);
  font-weight: 750;
}

.die-batch-row-remove:hover {
  background: #fff0ee;
}

.die-batch-secondary-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #cddbea;
  border-radius: 12px;
  background: #fff;
  color: #165da8;
  font-weight: 750;
}

.die-batch-secondary-action:hover:not(:disabled) {
  border-color: #92b9e8;
  background: #f5f9ff;
}

#dieBatchCandidateList {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 12px;
}

.die-batch-candidate {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 13px 14px;
  text-align: left;
  border: 1px solid var(--die-batch-border);
  border-radius: 14px;
  background: #fff;
  color: var(--die-batch-ink);
}

.die-batch-candidate:hover {
  border-color: #9dc3ef;
}

.die-batch-candidate[aria-pressed="true"] {
  border-color: #74aef2;
  background: var(--die-batch-blue-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.die-batch-candidate strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.die-batch-candidate > span:last-child {
  color: var(--die-batch-muted);
  font-size: 12px;
}

.die-batch-candidate__rank {
  width: max-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf2f8;
  color: #526176;
  font-size: 11px;
  font-weight: 800;
}

.die-batch-candidate[aria-pressed="true"] .die-batch-candidate__rank {
  background: #dcecff;
  color: #145bab;
}

#dieBatchMetrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.die-batch-metric {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--die-batch-border);
  border-radius: 14px;
  background: #fff;
}

.die-batch-metric > span {
  overflow: hidden;
  color: var(--die-batch-muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.die-batch-metric strong {
  color: var(--die-batch-ink);
  font-size: 22px;
  line-height: 1;
}

.die-batch-metric small {
  font-size: 12px;
  font-weight: 700;
}

.die-batch-metric--good strong,
.die-batch-metric--saving strong {
  color: var(--die-batch-green);
}

.die-batch-metric--warn strong {
  color: var(--die-batch-warn);
}

.die-batch-metric--danger strong {
  color: var(--die-batch-danger);
}

.die-batch-sku-results {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--die-batch-border);
  border-radius: 14px;
  background: #fff;
}

.die-batch-sku-results__head,
.die-batch-sku-result {
  display: grid;
  grid-template-columns: minmax(180px, 1.8fr) repeat(4, minmax(70px, 0.6fr));
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
}

.die-batch-sku-results__head {
  background: #f5f8fc;
  color: var(--die-batch-muted);
  font-size: 12px;
  font-weight: 750;
}

.die-batch-sku-result + .die-batch-sku-result {
  border-top: 1px solid #edf1f6;
}

.die-batch-sku-result {
  font-size: 13px;
}

.die-batch-sku-result strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.die-batch-sku-result .is-shortage {
  color: var(--die-batch-danger);
  font-weight: 800;
}

#dieBatchPreview {
  min-height: 260px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--die-batch-border);
  border-radius: 16px;
  background: #f5f8fc;
}

.die-batch-pattern-toolbar {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--die-batch-border);
  background: #fff;
}

.die-batch-pattern-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 2px;
}

.die-batch-pattern-tabs button {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid #d4dfeb;
  border-radius: 10px;
  background: #fff;
  color: #3d4d61;
  font-size: 12px;
  font-weight: 750;
}

.die-batch-pattern-tabs button[aria-selected="true"] {
  border-color: #78aef0;
  background: var(--die-batch-blue-soft);
  color: #165da8;
}

.die-batch-pattern-tabs small {
  color: var(--die-batch-muted);
}

.die-batch-pattern-summary {
  color: var(--die-batch-muted);
  font-size: 13px;
}

.die-batch-svg-stage {
  display: grid;
  min-height: 400px;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%) 0 9px / 18px 18px,
    #f7f9fc;
}

.die-batch-svg-stage svg {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(38, 55, 80, 0.14));
}

.die-batch-svg-piece {
  transition: opacity 140ms ease;
}

.die-batch-svg-stage svg:hover .die-batch-svg-piece:not(:hover) {
  opacity: 0.48;
}

.die-batch-preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 14px 4px;
  border-top: 1px solid var(--die-batch-border);
  background: #fff;
}

.die-batch-preview-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #35465b;
  font-size: 12px;
  font-weight: 700;
}

.die-batch-preview-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--sku-color);
}

.die-batch-preview-legend small {
  color: var(--die-batch-muted);
  font-weight: 600;
}

.die-batch-pattern-explanation {
  margin: 0;
  padding: 9px 14px 14px;
  background: #fff;
  color: var(--die-batch-muted);
  font-size: 12px;
}

.die-batch-empty,
.die-batch-preview-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 90px;
  place-items: center;
  padding: 20px;
  color: #8290a3;
  text-align: center;
}

.die-batch-preview-empty {
  min-height: 260px;
}

#dieBatchVerification {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid #d8e2ed;
  border-radius: 14px;
  background: #f8fafc;
  color: #43536a;
}

#dieBatchVerification[data-state="success"] {
  border-color: #b7dfcf;
  background: #f0fbf6;
  color: #08634a;
}

#dieBatchVerification[data-state="warning"] {
  border-color: #f1d09d;
  background: #fff9ed;
  color: #8a4b05;
}

#dieBatchVerification[data-state="error"] {
  border-color: #efc5c0;
  background: #fff5f4;
  color: #9f2e26;
}

.die-batch-verification__icon {
  display: grid;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: currentColor;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

#dieBatchVerification strong {
  display: block;
  line-height: 1.5;
}

#dieBatchVerification ul {
  margin: 5px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.65;
}

.die-batch-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 12px;
}

.die-batch-export-actions > span {
  margin-right: 3px;
  color: var(--die-batch-muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1320px) {
  .die-batch-sku-row {
    grid-template-columns: 32px minmax(180px, 1.4fr) repeat(3, minmax(110px, 0.8fr));
  }

  .die-batch-field:nth-of-type(5),
  .die-batch-field--priority,
  .die-batch-check,
  .die-batch-row-remove {
    grid-row: 2;
  }

  .die-batch-field:nth-of-type(5) {
    grid-column: 2;
  }

  .die-batch-field--priority {
    grid-column: 3;
  }

  .die-batch-check {
    grid-column: 4;
  }

  .die-batch-row-remove {
    grid-column: 5;
  }

  #dieBatchMetrics {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 900px) {
  .die-batch-sku-row {
    grid-template-columns: 32px repeat(2, minmax(0, 1fr));
  }

  .die-batch-field,
  .die-batch-field:nth-of-type(5),
  .die-batch-field--priority,
  .die-batch-check,
  .die-batch-row-remove {
    grid-column: auto;
    grid-row: auto;
  }

  .die-batch-field--name {
    grid-column: 2 / -1;
  }

  .die-batch-row-remove {
    grid-column: 3;
  }

  #dieBatchCandidateList {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  #dieBatchMetrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .die-batch-sku-results {
    overflow-x: auto;
  }

  .die-batch-sku-results__head,
  .die-batch-sku-result {
    min-width: 620px;
  }
}

@media (max-width: 560px) {
  .die-batch-sku-row {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 12px;
  }

  .die-batch-field,
  .die-batch-field--name,
  .die-batch-check,
  .die-batch-row-remove {
    grid-column: 1 / -1;
  }

  .die-batch-sku-row__number {
    grid-column: 1;
  }

  .die-batch-field--name {
    grid-column: 2;
  }

  #dieBatchCandidateList,
  #dieBatchMetrics {
    grid-template-columns: 1fr;
  }

  .die-batch-svg-stage {
    min-height: 300px;
    padding: 12px;
  }
}
