.cutting-stock-panel {
  display: grid;
  gap: 14px;
  margin-block: 14px;
  padding: 14px;
  border: 1px solid var(--line, #d7dfd5);
  border-radius: 12px;
  background: #f5f7f2;
  color: var(--ink, #263b31);
}

.cutting-stock-panel[hidden],
.cutting-stock-panel [hidden] {
  display: none;
}

.cutting-stock-header,
.cutting-stock-actions,
.cutting-stock-footer,
.cutting-stock-pagination,
.cutting-stock-amounts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cutting-stock-header,
.cutting-stock-footer {
  justify-content: space-between;
}

.cutting-stock-header h3,
.cutting-stock-form h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.cutting-stock-header p,
.cutting-stock-footer p,
.cutting-stock-state,
.cutting-stock-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.cutting-stock-header p {
  margin-top: 4px;
}

.cutting-stock-header p,
.cutting-stock-state,
.cutting-stock-footer p {
  color: #465c50;
}

.cutting-stock-state:empty {
  display: none;
}

.cutting-stock-error {
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff0eb;
  color: #8c3124;
}

.cutting-stock-filters,
.cutting-stock-form-fields {
  display: grid;
  gap: 8px 12px;
}

.cutting-stock-filters {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.cutting-stock-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line, #d7dfd5);
  border-radius: 8px;
  background: var(--white, #fff);
}

.cutting-stock-form-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cutting-stock-wide {
  grid-column: span 2;
}

.cutting-stock-filters label,
.cutting-stock-form-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.cutting-stock-filters input,
.cutting-stock-filters select,
.cutting-stock-form-fields input,
.cutting-stock-form-fields select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--line, #cbd6ca);
  border-radius: 8px;
  background: var(--white, #fff);
  color: inherit;
  font: inherit;
  font-weight: 400;
}

.cutting-stock-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cutting-stock-list:empty {
  display: none;
}

.cutting-stock-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(6rem, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 8px 10px;
  border: 1px solid var(--line, #d7dfd5);
  border-radius: 8px;
  background: var(--white, #fff);
}

.cutting-stock-summary {
  display: grid;
  min-width: 0;
  gap: 3px;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cutting-stock-summary span,
.cutting-stock-amounts {
  color: #465c50;
}

.cutting-stock-amounts {
  gap: 4px 8px;
  font-size: 12px;
  line-height: 1.4;
}

.cutting-stock-available {
  color: #284f3b;
  font-weight: 600;
}

.cutting-stock-row-actions {
  justify-content: flex-end;
}

.cutting-stock-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  font-size: 13px;
  cursor: pointer;
}

.cutting-stock-panel .cutting-stock-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--green, #305b48);
}

.cutting-stock-check:has(input:disabled) {
  cursor: default;
  opacity: .7;
}

.cutting-stock-panel .button {
  min-height: 44px;
  white-space: normal;
}

.cutting-stock-panel .cutting-stock-delete,
.cutting-stock-delete-note {
  color: #8c3124;
}

.cutting-stock-delete-note {
  font-size: 13px;
}

.cutting-stock-pagination {
  justify-content: center;
  font-size: 13px;
}

.cutting-stock-footer {
  padding-top: 8px;
  border-top: 1px solid var(--line, #d7dfd5);
}

.cutting-stock-panel :focus-visible {
  outline: 2px solid var(--green, #305b48);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .cutting-stock-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .cutting-stock-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .cutting-stock-amounts {
    justify-content: flex-end;
  }
}

@media (max-width: 600px) {
  .cutting-stock-panel {
    padding: 10px;
  }

  .cutting-stock-filters,
  .cutting-stock-form-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cutting-stock-filters label:first-child,
  .cutting-stock-filters input,
  .cutting-stock-filters select,
  .cutting-stock-form-fields input,
  .cutting-stock-form-fields select {
    font-size: 16px;
  }

  .cutting-stock-filters label:first-child {
    grid-column: 1 / -1;
  }

  .cutting-stock-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .cutting-stock-amounts {
    justify-content: flex-start;
  }

  .cutting-stock-footer .button {
    flex: 1 1 100%;
  }
}
