.ml-promotions-view {
  --ml-blue: #3483fa;
  --ml-green: #00a650;
  --ml-soft-gray: #f5f5f5;
  --ml-border: #dedede;
  color: #222;
}

.ml-promotions-view .section-heading {
  align-items: center;
  margin-bottom: 8px;
}

.ml-promotions-view .section-heading h2 {
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
}

.ml-promotions-view .notice {
  margin: 0 0 12px;
  border-left: 3px solid var(--ml-blue);
  padding: 8px 11px;
  background: #eef5ff;
  color: #36536f;
  font-size: 12px;
}

.ml-promotions-view-switch {
  margin: 8px 0 10px;
  border-color: #d6d6d6;
}

.ml-promotions-view-switch button {
  min-height: 36px;
  padding: 0 18px;
}

.ml-promotions-view-switch button.is-active {
  background: var(--ml-blue);
}

.ml-promotions-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
  border: 1px solid var(--ml-border);
  border-radius: 6px;
  padding: 11px;
  background: #fff;
}

.ml-promotions-filters button {
  white-space: nowrap;
}

.ml-promotions-view .integration-diagnostics {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 6px 0;
}

.ml-account-health {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: #666;
  font-size: 11px;
}

.ml-account-health::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  content: "";
}

.ml-account-health.is-online::before { background: var(--ml-green); }
.ml-account-health.is-error::before { background: #d93025; }

.ml-promotions-view .table-note {
  margin: 7px 0;
  color: #777;
  font-size: 12px;
}

.ml-promotion-catalog {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--ml-border);
  border-radius: 6px;
  background: #fff;
}

.ml-promotion-column-head,
.ml-listing-block {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(0, 4.75fr);
}

.ml-promotion-column-head {
  grid-template-columns: minmax(220px, 1.25fr) minmax(145px, 1.05fr) minmax(115px, .8fr) minmax(100px, .7fr) minmax(90px, .65fr) minmax(95px, .7fr) minmax(105px, .75fr) minmax(110px, .8fr);
  min-width: 1120px;
  border-bottom: 1px solid #b8b8b8;
  background: #eee;
}

.ml-promotion-column-head span {
  padding: 13px 12px;
  border-right: 1px solid #ddd;
  font-size: 12px;
  font-weight: 700;
}

.ml-promotion-list {
  background: var(--ml-soft-gray);
}

.ml-listing-block {
  min-width: 1120px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ml-border);
  background: #fff;
}

.ml-listing-block:last-child { margin-bottom: 0; }

.ml-listing-product {
  padding: 14px 12px;
  border-right: 1px solid #e1e1e1;
}

.ml-store-label {
  display: inline-block;
  margin-bottom: 10px;
  border-radius: 3px;
  padding: 2px 6px;
  background: #e8f1ff;
  color: #2864b1;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.ml-listing-product-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
}

.ml-listing-media {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid #eee;
  background: #fff;
}

.ml-listing-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ml-listing-image-placeholder {
  color: #999;
  font-size: 10px;
  text-align: center;
}

.ml-listing-title {
  display: block;
  margin-bottom: 5px;
  line-height: 1.35;
}

.ml-listing-product small,
.ml-promotion-line small {
  display: block;
  margin-top: 3px;
  color: #777;
  font-size: 10px;
  line-height: 1.35;
}

.ml-listing-original-price {
  display: block;
  margin-top: 5px;
  font-size: 13px;
}

.ml-listing-opportunities {
  min-width: 0;
}

.ml-promotion-line {
  display: grid;
  grid-template-columns: minmax(145px, 1.05fr) minmax(115px, .8fr) minmax(100px, .7fr) minmax(90px, .65fr) minmax(95px, .7fr) minmax(105px, .75fr) minmax(110px, .8fr);
  min-height: 90px;
  border-bottom: 1px solid #e4e4e4;
}

.ml-promotion-line:last-child { border-bottom: 0; }

.ml-promotion-line > div {
  min-width: 0;
  padding: 13px 10px;
}

.ml-promotion-name strong,
.ml-promotion-final strong,
.ml-promotion-net strong,
.ml-promotion-discount strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.ml-promotion-final strong { font-size: 15px; }

.ml-status-badge,
.ml-policy-badge {
  display: inline-block;
  margin-top: 6px;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.ml-status-badge.is-active { background: #dff7e7; color: #087b3b; }
.ml-status-badge.is-planned { background: #e8f1ff; color: #2864b1; }
.ml-policy-badge.is-ok { background: #dff7e7; color: #087b3b; }
.ml-policy-badge.is-warn { background: #fff0d5; color: #9c5e00; }
.ml-policy-badge.is-muted { background: #eee; color: #666; }

.ml-net-unavailable {
  color: #777;
  font-weight: 600;
}

.ml-promotion-action {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
}

.ml-promotion-action button {
  width: auto;
  min-height: 30px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ml-blue);
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
}

.ml-promotion-action button.is-primary {
  border-radius: 5px;
  padding: 0 12px;
  background: var(--ml-blue);
  color: #fff;
}

.ml-action-unavailable {
  color: #999;
  font-size: 10px;
}

.ml-sku-group {
  margin-bottom: 14px;
  background: #fff;
}

.ml-sku-group > header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid #cfd8e3;
  padding: 12px 14px;
  background: #edf4ff;
}

.ml-sku-group > header div {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 8px;
}

.ml-sku-group > header div span { color: #386ba8; font-size: 10px; font-weight: 700; }
.ml-sku-group > header div small { grid-column: 1 / -1; color: #65758a; }
.ml-sku-group > header > span { color: #65758a; font-size: 11px; }
.ml-sku-group .ml-listing-block { margin-bottom: 0; }

#mlPromotionOperationDialog {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}

#mlPromotionOperationForm {
  gap: 0;
  padding: 0;
}

#mlPromotionOperationForm .dialog-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 20px 24px 14px;
  background: #fff;
}

#mlPromotionOperationForm .dialog-head h2 {
  margin-top: 4px;
  font-size: 22px;
}

.ml-operation-context {
  display: grid;
  gap: 0;
  padding: 0 24px;
}

.ml-operation-product {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-radius: 6px;
  padding: 12px;
  background: #f5f5f5;
}

.ml-operation-product .ml-listing-media { width: 50px; height: 50px; }
.ml-operation-product small { display: block; margin-top: 4px; color: #666; }

.ml-operation-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--ml-border);
}

.ml-operation-facts div { display: grid; gap: 5px; }
.ml-operation-facts span,
.ml-operation-analysis span { color: #666; font-size: 11px; }

.ml-operation-price-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid var(--ml-border);
}

.ml-operation-analysis {
  display: grid;
  gap: 5px;
  margin: 16px 0;
  border-left: 3px solid var(--ml-blue);
  padding: 10px 12px;
  background: #f5f9ff;
}

#mlPromotionOperationFields {
  grid-template-columns: 1fr;
  padding: 0 24px 16px;
}

#mlPromotionOperationFields label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid var(--ml-border);
}

#mlPromotionOperationFields input,
#mlPromotionOperationFields select {
  height: 44px;
  border: 1px solid #999;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
}

.promotion-operation-preview {
  margin: 0 24px;
}

.promotion-operation-preview h3 { font-size: 14px; }
.promotion-technical-payload { display: none !important; }

.ml-operation-confirmation {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  border-radius: 5px;
  padding: 10px 12px;
  background: #f5f5f5;
}

#mlPromotionOperationStatus { margin: 10px 24px; }

#mlPromotionOperationForm .dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  justify-content: flex-start;
  border-top: 1px solid var(--ml-border);
  padding: 14px 24px;
  background: #fff;
}

#mlPromotionOperationForm .dialog-actions button:not(.ghost) { background: var(--ml-blue); }

@media (max-width: 1180px) {
  .ml-promotions-filters { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
  .ml-promotion-catalog { overflow-x: auto; }
}

@media (max-width: 760px) {
  .ml-promotions-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ml-promotions-view .integration-diagnostics { flex-wrap: wrap; }
  .ml-promotion-column-head { display: none; }
  .ml-promotion-catalog { overflow: visible; border: 0; background: transparent; }
  .ml-listing-block { display: block; min-width: 0; margin-bottom: 12px; border: 1px solid var(--ml-border); border-radius: 6px; overflow: hidden; }
  .ml-listing-product { border-right: 0; border-bottom: 1px solid var(--ml-border); }
  .ml-promotion-line { grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 0; padding: 8px; }
  .ml-promotion-line > div { padding: 8px; }
  .ml-promotion-name { grid-column: 1 / -1; }
  .ml-promotion-action { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .ml-sku-group > header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  .ml-promotions-filters { grid-template-columns: 1fr; }
  .ml-promotions-filters button { width: 100%; }
  .ml-listing-product-main { grid-template-columns: 58px minmax(0, 1fr); }
  .ml-listing-media { width: 58px; height: 58px; }
  .ml-promotion-line { grid-template-columns: 1fr; }
  .ml-promotion-name,
  .ml-promotion-action { grid-column: auto; }
  .ml-operation-facts { grid-template-columns: 1fr; }
  #mlPromotionOperationFields label { grid-template-columns: 1fr; padding: 12px 0; }
  #mlPromotionOperationFields input { width: 100%; }
  #mlPromotionOperationForm .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #mlPromotionOperationForm .dialog-actions button { width: 100%; }
}
