.rework-scan-page {
  min-width: 1180px;
}

.rework-scan-main {
  padding-bottom: 28px;
}

.rework-scan-card {
  min-height: calc(100vh - 96px);
}

.rework-scan-card__body {
  padding: 14px 20px 18px;
}

.rework-scan-panel {
  display: none;
}

.rework-scan-panel.is-active {
  display: block;
}

.scan-page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}

.scan-page-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-layout {
  display: grid;
  grid-template-columns: minmax(440px, 0.78fr) minmax(560px, 1fr);
  gap: 16px;
  align-items: start;
}

.scan-block,
.rules-block {
  border: 1px solid rgba(216, 223, 238, 0.96);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.scan-block + .scan-block {
  margin-top: 16px;
}

.scan-block__header,
.rules-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(226, 231, 242, 0.96);
  background: #f7f9fe;
}

.scan-block__header h2,
.rules-block__header h2 {
  margin: 0;
  font-size: 15px;
  color: #34405b;
}

.scan-block__header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-block__header p {
  margin: 5px 0 0;
  color: #68738d;
  font-size: 12px;
  line-height: 1.45;
}

.scan-field {
  display: grid;
  gap: 7px;
}

.scan-field span {
  color: #5c6680;
  font-size: 13px;
}

.scan-field--inline {
  grid-template-columns: auto 280px;
  align-items: center;
  gap: 10px;
}

.scan-field--toolbar {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.scan-field--toolbar span {
  color: #5f6b85;
  font-size: 12px;
  white-space: nowrap;
}

.scan-field--toolbar input,
.scan-field--toolbar select {
  min-height: 34px;
  padding: 7px 10px;
}

.scan-field--scan-code {
  min-width: min(430px, 100%);
}

.scan-field--product {
  flex: 1;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px 16px 12px;
}

.batch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f3;
  border-radius: 8px;
  background: #fbfcff;
}

.batch-item__title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #38445f;
  font-weight: 700;
  font-size: 13px;
}

.scan-result-shell {
  margin: 0 16px 12px;
  border: 1px solid #e0e6f1;
  border-radius: 8px;
  background: #fff;
  min-height: 176px;
  overflow: hidden;
}

.scan-result-shell.is-error {
  border-color: #f0b6b6;
  background: #fffafa;
}

.scan-empty {
  display: grid;
  place-items: center;
  min-height: 176px;
  color: #818ba3;
  font-size: 14px;
}

.scan-result-head {
  padding: 10px 16px 8px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
}

.scan-result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  color: #33405b;
}

.scan-product-info {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.scan-product-field {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid #e2e8f2;
  border-radius: 8px;
  background: #fbfcff;
}

.scan-product-field span {
  color: #68738d;
  font-size: 12px;
}

.scan-product-field strong {
  color: #2f3b55;
  font-size: 13px;
}

.scan-alert {
  display: grid;
  grid-template-columns: minmax(96px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f1b8b8;
  border-radius: 8px;
  background: #fff4f4;
}

.scan-alert__title {
  display: flex;
  align-items: center;
  color: #b93f3f;
  font-size: 13px;
  font-weight: 800;
}

.scan-alert__body {
  display: grid;
  gap: 3px;
}

.scan-alert__body span {
  color: #8c5454;
  font-size: 12px;
}

.scan-alert__body strong {
  color: #b93f3f;
  font-size: 13px;
  line-height: 1.4;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f0f3f9;
  color: #52607a;
  font-size: 12px;
  white-space: nowrap;
}

.status-pill--ok {
  background: #eef8f0;
  color: #277246;
}

.status-pill--warn {
  background: #fff6e5;
  color: #986514;
}

.status-pill--danger {
  background: #fff0f0;
  color: #c14141;
}

.scan-method-list {
  display: grid;
  gap: 8px;
  padding: 10px 14px 12px;
}

.scan-method-item {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(190px, 1.2fr) minmax(130px, 0.9fr) minmax(150px, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 9px 12px;
  border: 1px solid #e2e8f2;
  border-radius: 8px;
  background: #ffffff;
}

.scan-method-item.is-warning {
  border-color: #f0cd8d;
  background: #fffaf0;
}

.scan-method-item__label {
  color: #69758e;
  font-size: 12px;
}

.scan-method-item__value {
  margin-top: 3px;
  color: #323e59;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.part-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.part-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf8f4;
  color: #2d7664;
  font-size: 12px;
  font-weight: 700;
}

.part-chip--empty {
  background: #f2f4f8;
  color: #667085;
}

.scan-block--pending {
  margin-top: 14px;
}

.scan-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pending-table-shell,
.scan-record-table-shell,
.rules-table-shell {
  border-width: 0;
  border-radius: 0;
}

.pending-table,
.scan-record-table,
.rules-table {
  min-width: 1080px;
}

.scan-record-table th:nth-child(1),
.scan-record-table td:nth-child(1) {
  width: 58px;
  text-align: center;
}

.pending-table th:nth-child(1),
.pending-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

.pending-table th:nth-child(2),
.pending-table td:nth-child(2) {
  width: 58px;
  text-align: center;
}

.scan-record-table th:nth-child(12),
.scan-record-table td:nth-child(12) {
  width: 90px;
  text-align: center;
}

.table-empty {
  padding: 34px 16px;
  text-align: center;
  color: #78849c;
}

.snapshot-list {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.snapshot-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #3b465f;
  font-size: 13px;
}

.snapshot-line.is-missing {
  color: #c14141;
  font-weight: 700;
}

.link-action {
  color: var(--color-primary);
  font-weight: 700;
}

.link-danger {
  color: #bf3f3f;
  font-weight: 700;
}

.record-filterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 14px;
}

.record-filterbar__left,
.record-filterbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.record-search {
  min-width: 260px;
}

.record-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.record-stat-item {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid #e1e8f3;
  border-radius: 8px;
  background: #fbfcff;
}

.record-stat-item span {
  color: #65718a;
  font-size: 12px;
}

.record-stat-item strong {
  color: #2f3b55;
  font-size: 22px;
  line-height: 1.1;
}

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

.record-detail-modal__panel {
  width: min(980px, calc(100vw - 36px));
}

.method-config-modal__panel {
  width: min(1320px, calc(100vw - 28px));
  margin-top: 4vh;
}

.config-list-modal__panel {
  width: min(760px, calc(100vw - 36px));
}

.config-edit-modal__panel {
  width: min(1040px, calc(100vw - 36px));
}

.record-detail-body {
  max-height: 68vh;
  overflow: auto;
}

.config-edit-body {
  max-height: 66vh;
  overflow: auto;
}

.method-config-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 620px;
  max-height: 74vh;
  padding: 0;
  overflow: hidden;
}

.method-process-pane {
  border-right: 1px solid #e1e6f1;
  background: #f7f9fe;
  overflow: hidden;
}

.method-process-pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #e3e8f2;
}

.method-process-pane__head h4,
.method-rule-pane__head h4,
.matrix-toolbar h4 {
  margin: 0;
  color: #34405b;
  font-size: 14px;
}

.method-process-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  max-height: calc(74vh - 70px);
  overflow: auto;
}

.method-process-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f2;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.method-process-item__select {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.method-process-item__edit {
  flex: 0 0 auto;
}

.method-process-item.is-active {
  border-color: rgba(85, 118, 255, 0.6);
  background: #edf3ff;
}

.method-process-item__name {
  color: #34405b;
  font-weight: 700;
}

.method-process-item__meta {
  color: #6f7a93;
  font-size: 12px;
}

.method-rule-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.method-rule-pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e6ebf4;
}

.method-rule-pane__head p {
  margin: 5px 0 0;
  color: #707b94;
  font-size: 12px;
}

.method-rule-base {
  display: none;
}

.method-base-field {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #e3e9f3;
  border-radius: 8px;
  background: #fff;
}

.method-base-field span {
  color: #71809b;
  font-size: 12px;
}

.method-base-field strong {
  color: #303b56;
  font-size: 13px;
}

.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

.method-matrix-shell {
  flex: 1;
  min-height: 0;
  border-width: 1px 0 0;
  border-radius: 0;
}

.method-matrix-table {
  min-width: 980px;
}

.method-matrix-table th:nth-child(1),
.method-matrix-table td:nth-child(1) {
  min-width: 150px;
}

.method-matrix-table th:nth-child(2),
.method-matrix-table td:nth-child(2) {
  min-width: 240px;
}

.method-matrix-table th:nth-child(3),
.method-matrix-table td:nth-child(3),
.method-matrix-table th:nth-child(4),
.method-matrix-table td:nth-child(4),
.method-matrix-table th:nth-child(5),
.method-matrix-table td:nth-child(5) {
  min-width: 150px;
}

.method-cell {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fbfcff;
  text-align: left;
}

.method-cell span {
  color: #33405b;
  font-size: 13px;
  font-weight: 700;
}

.method-cell em {
  color: #6c778f;
  font-size: 12px;
  font-style: normal;
}

.method-cell--missing {
  place-items: center;
  color: #bf3f3f;
  border-style: dashed;
  background: #fff8f8;
  font-weight: 700;
}

.method-edit-list {
  display: grid;
  gap: 12px;
}

.method-edit-row {
  display: grid;
  grid-template-columns: 92px minmax(210px, 0.72fr) minmax(430px, 1.28fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid #e4e9f3;
  border-radius: 8px;
  background: #fbfcff;
}

.method-edit-row__count {
  color: #33405b;
  font-size: 13px;
  font-weight: 700;
  line-height: 38px;
}

.condition-edit-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 88px minmax(120px, 0.8fr) 88px minmax(120px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid #e4e9f3;
  border-radius: 8px;
  background: #fbfcff;
}

.condition-edit-row__title {
  grid-column: 1 / -1;
  color: #33405b;
  font-size: 13px;
  font-weight: 700;
}

.condition-edit-row__parameter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #dfe6f2;
  border-radius: 8px;
  background: #fff;
  color: #34405b;
  font-size: 13px;
  font-weight: 700;
}

.config-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.config-list-table-shell {
  max-height: 420px;
}

.config-list-input {
  width: 100%;
  min-width: 180px;
}

.config-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.config-edit-grid__wide {
  grid-column: 1 / -1;
}

.config-readonly {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #e3e9f3;
  border-radius: 8px;
  background: #fbfcff;
}

.config-readonly span {
  color: #71809b;
  font-size: 12px;
}

.config-readonly strong {
  color: #303b56;
  font-size: 14px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-field {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e4e9f3;
  border-radius: 8px;
  background: #fbfcff;
}

.detail-field span {
  color: #71809b;
  font-size: 12px;
}

.detail-field strong {
  color: #303b56;
  font-size: 14px;
}

.checkbox-row {
  padding-top: 0;
}

.method-part-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid #d8e1ee;
  border-radius: 8px;
  background: #fff;
}

.method-part-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 148px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #e1e7f1;
  border-radius: 6px;
  background: #f8fafd;
  color: #35415c;
  font-size: 13px;
  font-weight: 700;
}

.method-part-check:has(input[data-method-part]:checked) {
  border-color: #6c86ff;
  background: #eef3ff;
  color: #1f3f91;
}

.method-part-check input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.method-part-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1260px) {
  .scan-layout {
    grid-template-columns: 1fr;
  }

  .method-config-body {
    grid-template-columns: 1fr;
  }

  .method-process-pane {
    border-right: 0;
    border-bottom: 1px solid #e1e6f1;
  }

  .method-process-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 220px;
  }

  .method-rule-base {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scan-product-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
