.commerce-shell {
  display: grid;
  min-width: 0;
  gap: 18px;
  padding: 22px 28px 44px;
}

.commerce-heading,
.commerce-results-heading,
.commerce-editor-header,
.commerce-aside-heading,
.commerce-form-actions,
.commerce-pagination,
.commerce-product-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.commerce-heading {
  align-items: flex-start;
}

.commerce-heading h1,
.commerce-heading p,
.commerce-results-heading h2,
.commerce-results-heading p,
.commerce-aside-heading h3,
.commerce-aside-heading p,
.commerce-editor-header h2,
.commerce-editor-header p,
.commerce-product-card h3,
.commerce-product-card p,
.commerce-preview p,
.commerce-lifecycle p,
.commerce-audit p {
  margin: 0;
}

.commerce-heading > div:first-child > p:last-child,
.commerce-editor-header > div > p:last-child {
  max-width: 760px;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.commerce-eyebrow,
.commerce-rail-label {
  margin: 0 0 4px;
  color: var(--cobalt-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.commerce-heading-actions,
.commerce-lifecycle-actions,
.commerce-link-check {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.commerce-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.commerce-summary-card {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 15px 17px;
  border-right: 1px solid var(--line);
}

.commerce-summary-card:last-child {
  border-right: 0;
}

.commerce-summary-card span,
.commerce-summary-card small {
  color: var(--muted);
}

.commerce-summary-card span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.commerce-summary-card strong {
  font-size: 25px;
  line-height: 1.1;
}

.commerce-summary-card small {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-alert,
.commerce-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(185, 28, 28, 0.24);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--red);
  background: #fff7f7;
}

.commerce-alert span {
  flex: 1;
}

.commerce-notice {
  border-color: rgba(21, 128, 61, 0.25);
  color: var(--green);
  background: #f3fbf5;
}

.commerce-workbench {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.commerce-program-rail {
  position: sticky;
  top: 86px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.commerce-rail-label {
  padding: 14px 14px 9px;
}

.commerce-program {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.commerce-program:hover,
.commerce-program.active {
  background: var(--mist);
}

.commerce-program.active {
  box-shadow: inset 4px 0 var(--cobalt);
}

.commerce-program span {
  font-weight: 800;
}

.commerce-program small,
.commerce-empty-small {
  color: var(--muted);
  font-size: 11px;
}

.commerce-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.commerce-dot.approved {
  background: var(--green);
}

.commerce-empty-small {
  padding: 12px 14px;
}

.commerce-catalog {
  display: grid;
  min-width: 0;
  gap: 15px;
}

.commerce-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 190px) minmax(150px, 210px) auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.commerce-filters label,
.commerce-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.commerce-filters label > span,
.commerce-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.commerce-filters .input,
.commerce-filters .select,
.commerce-field .input,
.commerce-field .select,
.commerce-field .textarea {
  width: 100%;
  min-width: 0;
}

.commerce-results-heading {
  align-items: end;
}

.commerce-results-heading h2 {
  font-size: 22px;
}

.commerce-results-heading > p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.commerce-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: min-content;
  align-content: start;
  gap: 12px;
}

.commerce-product-card {
  display: grid;
  min-width: 0;
  grid-template-rows: 148px 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(31, 41, 51, 0.04);
}

.commerce-product-media,
.commerce-preview-media {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: linear-gradient(145deg, #f1f5f2, #e3ede8);
  font-size: 12px;
  font-weight: 750;
}

.commerce-product-media img,
.commerce-preview-media img {
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.commerce-product-body {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 13px;
}

.commerce-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--amber);
  background: #fff7ed;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.commerce-status.published {
  color: var(--green);
  background: #effaf1;
}

.commerce-status.paused,
.commerce-status.retired {
  color: var(--muted);
  background: var(--mist);
}

.commerce-earning {
  overflow: hidden;
  color: var(--cobalt-dark);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-product-brand,
.commerce-gate-copy {
  color: var(--muted);
  font-size: 11px;
}

.commerce-product-card h3 {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.commerce-product-price {
  font-size: 14px;
  font-weight: 850;
}

.commerce-gate-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.commerce-gate-progress span {
  display: block;
  width: var(--gate-progress);
  height: 100%;
  background: var(--cobalt);
}

.commerce-loading,
.commerce-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 5px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.commerce-pagination {
  justify-content: center;
}

.commerce-editor-dialog,
.commerce-transition-dialog {
  width: min(1360px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.commerce-editor-dialog::backdrop,
.commerce-transition-dialog::backdrop {
  background: rgba(17, 24, 39, 0.56);
}

.commerce-editor-shell {
  display: grid;
  max-height: calc(100vh - 34px);
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.commerce-editor-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.commerce-editor-layout {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 370px;
  overflow: hidden;
}

.commerce-product-form,
.commerce-editor-aside {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.commerce-product-form {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px 20px 30px;
}

.commerce-form-section {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
}

.commerce-form-section legend {
  padding: 0 5px;
  font-weight: 850;
}

.commerce-form-section > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.commerce-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.commerce-field-grid .full {
  grid-column: 1 / -1;
}

.commerce-field b {
  color: var(--red);
}

.commerce-field .textarea {
  min-height: 88px;
  resize: vertical;
}

.commerce-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.commerce-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--cobalt);
}

.commerce-check span {
  display: grid;
  gap: 2px;
}

.commerce-check small {
  color: var(--muted);
  line-height: 1.35;
}

.commerce-link-result {
  color: var(--muted);
  font-size: 12px;
}

.commerce-link-result.valid {
  color: var(--green);
}

.commerce-link-result.invalid,
.commerce-link-result.unavailable,
.field-error {
  color: var(--red);
}

.field-error {
  font-size: 11px;
  font-weight: 750;
}

.commerce-form-actions {
  justify-content: flex-start;
  position: sticky;
  bottom: -30px;
  margin: 0 -20px -30px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.96);
}

.commerce-form-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.commerce-editor-aside {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: #f3f6f4;
}

.commerce-preview,
.commerce-gates,
.commerce-lifecycle,
.commerce-audit {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  background: var(--surface);
}

.commerce-preview-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.commerce-preview-card > div:last-child {
  display: grid;
  gap: 3px;
  align-content: center;
  min-width: 0;
  padding: 10px 10px 10px 0;
}

.commerce-preview-card small,
.commerce-preview-card span,
.commerce-preview > p,
.commerce-lifecycle > p,
.commerce-audit > p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.commerce-preview-card strong,
.commerce-preview-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commerce-gates ul,
.commerce-audit ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.commerce-gates li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.commerce-gates li > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--amber);
  font-size: 11px;
  font-weight: 900;
}

.commerce-gates li.passed > span {
  background: var(--green);
}

.commerce-gates li div,
.commerce-audit li {
  display: grid;
  gap: 2px;
}

.commerce-gates small,
.commerce-audit span {
  color: var(--muted);
  font-size: 10px;
}

.commerce-transition-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 20px;
}

.commerce-transition-dialog form {
  display: grid;
  gap: 14px;
}

.commerce-transition-dialog h2,
.commerce-transition-dialog p {
  margin: 0;
}

.commerce-transition-dialog > form > p:not(.commerce-eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .commerce-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commerce-editor-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
}

@media (max-width: 900px) {
  .commerce-shell {
    padding: 18px 18px 36px;
  }

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

  .commerce-summary-card:nth-child(2) {
    border-right: 0;
  }

  .commerce-summary-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .commerce-workbench {
    grid-template-columns: 1fr;
  }

  .commerce-program-rail {
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 8px;
    gap: 7px;
  }

  .commerce-rail-label {
    display: none;
  }

  .commerce-program {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px 10px;
  }

  .commerce-program.active {
    box-shadow: inset 0 -3px var(--cobalt);
  }

  .commerce-editor-layout {
    display: block;
    overflow-y: auto;
  }

  .commerce-product-form,
  .commerce-editor-aside {
    min-height: auto;
    overflow: visible;
  }

  .commerce-editor-aside {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .commerce-shell {
    gap: 14px;
    padding: 14px 12px 30px;
  }

  .commerce-heading {
    display: grid;
  }

  .commerce-heading h1 {
    font-size: 27px;
  }

  .commerce-heading-actions .button {
    flex: 1;
  }

  .commerce-summary-card {
    padding: 12px;
  }

  .commerce-summary-card strong {
    font-size: 21px;
  }

  .commerce-summary-card small {
    display: none;
  }

  .commerce-filters {
    grid-template-columns: 1fr 1fr;
  }

  .commerce-search,
  .commerce-filters button {
    grid-column: 1 / -1;
  }

  .commerce-product-grid {
    grid-template-columns: 1fr;
  }

  .commerce-product-card {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: 1fr;
  }

  .commerce-product-media {
    min-height: 190px;
  }

  .commerce-editor-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .commerce-editor-shell {
    max-height: 100dvh;
  }

  .commerce-editor-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 13px 14px;
  }

  .commerce-editor-header h2 {
    font-size: 21px;
  }

  .commerce-editor-header > div > p:last-child {
    display: none;
  }

  .commerce-product-form,
  .commerce-editor-aside {
    padding: 13px;
  }

  .commerce-field-grid {
    grid-template-columns: 1fr;
  }

  .commerce-field-grid .full {
    grid-column: auto;
  }

  .commerce-form-actions {
    bottom: -13px;
    margin: 0 -13px -13px;
    padding: 11px 13px;
  }
}
