.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.line-head,
.po-line {
  grid-template-columns: minmax(240px, 1fr) 58px 62px 78px 78px 76px 104px 62px 62px 88px 28px;
  gap: 10px;
  min-width: 1050px;
}

#editor-lines {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.product-cell > div {
  min-width: 0;
  overflow: hidden;
}

.product-cell strong,
.product-cell small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-head > span {
  text-align: center;
}

.line-head > * + *,
.po-line > * + * {
  position: relative;
}

.line-head > * + *::before,
.po-line > * + *::before {
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: -5px;
  width: 1px;
  background: #e3e8e5;
  content: "";
  pointer-events: none;
}

.po-line > * + *::before {
  top: -14px;
  bottom: -14px;
}

.po-line > :not(.product-cell):not(.remove-line) {
  font-size: 13px;
}

.line-qty-cell {
  display: flex;
  align-items: center;
}

.line-qty {
  text-align: center;
}

.commercial-value,
.commercial-percent {
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
}

.line-cost {
  text-align: center;
}

.line-total {
  text-align: center;
}

.commercial-percent.negative {
  color: #a33b31;
}

.product-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.editor-bottom {
  display: grid;
  grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: start;
}

.editor-bottom .summary-card,
.editor-bottom .details-card {
  margin: 0;
}

.editor-bottom .details-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
}

.editor-bottom .details-card h2,
.editor-bottom .details-card label:nth-of-type(3),
.editor-bottom .details-card .detail-row {
  grid-column: 1 / -1;
}

.inline-product-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 86px;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-top: 1px solid #e3e9e6;
  background: #fafbfa;
  border-radius: 0 0 11px 11px;
}

.inline-product-search {
  position: relative;
  min-width: 0;
}

.inline-field-label,
.inline-quantity {
  display: block;
  margin-bottom: 7px;
  color: #68756f;
  font-size: 12px;
  font-weight: 700;
}

.inline-product-search .search-field {
  height: 42px;
}

.inline-quantity {
  margin: 0;
}

.inline-quantity input {
  display: block;
  width: 100%;
  height: 42px;
  margin-top: 7px;
}

.inline-product-add > button {
  height: 42px;
}

.inline-catalog-results {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: 49px;
  left: 0;
  max-height: 370px;
  overflow: auto;
  border: 1px solid #cbd5d0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 40px #173d3226;
}

.inline-catalog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 74px 90px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #e8edea;
  border-radius: 0;
  text-align: left;
  font-weight: 400;
}

.inline-catalog-row:last-child {
  border-bottom: 0;
}

.inline-catalog-row:hover,
.inline-catalog-row:focus-visible {
  background: #f2f7f4;
}

.inline-catalog-product {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.inline-catalog-product > span:last-child {
  min-width: 0;
}

.inline-catalog-product strong,
.inline-catalog-product small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-catalog-product small {
  margin-top: 3px;
  color: #748078;
  font-size: 11px;
}

.inline-result-number {
  text-align: right;
  font-size: 12px;
}

.inline-catalog-message {
  padding: 28px 16px;
  color: #6e7a74;
  text-align: center;
}

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

@media (max-width: 700px) {
  .inline-product-add {
    grid-template-columns: 1fr 90px;
    min-width: 0;
  }

  .inline-product-search {
    grid-column: 1 / -1;
  }

  .inline-catalog-row {
    grid-template-columns: minmax(0, 1fr) 58px;
  }

  .inline-catalog-row > .inline-result-number:nth-last-child(2),
  .inline-catalog-row > .inline-result-number:nth-last-child(3) {
    display: none;
  }

  .editor-bottom .details-card {
    display: block;
  }
}
.delivery-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #223029;
  cursor: pointer;
}

.delivery-toggle input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #146c43;
}

.delivery-toggle span,
.delivery-toggle small {
  display: block;
}

.delivery-toggle strong {
  display: block;
  font-size: 15px;
  line-height: 20px;
}

.delivery-toggle small {
  margin-top: 2px;
  color: #718079;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
}

.dropship-address label {
  color: #68756f;
  font-size: 12px;
  font-weight: 700;
}

.dropship-address input {
  display: block;
  width: 100%;
  margin-top: 7px;
}

.dropship-address {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e9e7;
}

.dropship-address[hidden] {
  display: none;
}

.dropship-address .wide {
  grid-column: 1 / -1;
}

@media(max-width:700px) {
  .dropship-address { grid-template-columns: 1fr; }
  .dropship-address .wide { grid-column: auto; }
}
