/* Design tokens */
:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-muted: #f1f3f5;
  --color-text: #1f2933;
  --color-muted: #657080;
  --color-soft: #8a94a3;
  --color-border: #d9dee5;
  --color-border-strong: #b8c0cc;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-accent: var(--color-primary);
  --color-success: #15803d;
  --color-success-bg: #e8f5ee;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-warning: #b45309;
  --color-warning-bg: #fff7ed;
  --color-info: #0369a1;
  --color-info-bg: #e0f2fe;
  --color-card-bg: var(--color-surface);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
  --table-row-height: 44px;
  --topbar-height: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout */
.header {
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  min-height: var(--topbar-height);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.header a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
}

.header a.active {
  color: var(--color-primary);
  box-shadow: inset 0 -2px 0 var(--color-primary);
  padding-bottom: 3px;
}

.header-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
  margin-right: 0.5rem;
}

.auth-identity {
  color: var(--color-muted);
  font-size: 0.85rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-header h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  margin-bottom: var(--space-1);
}

.eyebrow {
  color: var(--color-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Cards */
.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.import-card:hover,
.metric-card:hover {
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.help-panel {
  background: var(--color-info-bg);
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  color: var(--color-info);
  font-size: 0.9rem;
  padding: var(--space-3) var(--space-4);
}

.danger-panel {
  background: var(--color-danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--color-danger);
  padding: var(--space-3) var(--space-4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card-bg);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-hover);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface-muted);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
}

.production-report-header {
  align-items: end;
}

.production-report-header h2 {
  margin: 0.2rem 0;
}

.production-report-filters {
  display: flex;
  align-items: end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.production-report-year {
  align-self: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.production-report-filters label {
  display: grid;
  gap: 0.25rem;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.production-report-filters input,
.production-report-filters select {
  min-height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0.45rem 0.6rem;
}

.production-report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.production-report-stats .metric-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.production-report-stats .metric-card span {
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.production-report-stats .metric-card strong {
  color: var(--color-text);
  font-size: 1.35rem;
}

.production-report-card {
  padding: 0.75rem;
}

.production-report-table {
  min-width: 940px;
  table-layout: fixed;
}

.production-report-table th:nth-child(1) { width: 4.5%; }
.production-report-table th:nth-child(2) { width: 16%; }
.production-report-table th:nth-child(3) { width: 23%; }
.production-report-table th:nth-child(4) { width: 8.5%; }
.production-report-table th:nth-child(5) { width: 12%; }
.production-report-table th:nth-child(6) { width: 18%; }
.production-report-table th:nth-child(7) { width: 18%; }

.production-report-table th,
.production-report-table td {
  vertical-align: middle;
}

.production-report-table th {
  white-space: nowrap;
}

.production-report-number {
  width: 42px;
  color: var(--color-muted);
  text-align: center;
}

.production-report-photo-cell {
  width: 122px;
  min-width: 122px;
  padding: 0.6rem;
  text-align: center;
}

.production-report-photo {
  display: block;
  width: auto;
  height: auto;
  max-width: 110px;
  max-height: 146px;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  object-fit: contain;
}

.production-report-photo-placeholder {
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 146px;
  margin: 0 auto;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-soft);
  font-size: 0.65rem;
  text-align: center;
}

.production-report-name {
  width: 230px;
  min-width: 210px;
  max-width: 250px;
}

.production-report-name a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}

.production-report-name a:hover {
  color: var(--color-primary);
}

.production-report-name small {
  display: block;
  margin-top: 0.2rem;
  color: var(--color-muted);
  font-size: 0.75rem;
}

.production-report-table .number-cell {
  text-align: right;
  white-space: nowrap;
}

.production-report-total-row td {
  border-bottom: 2px solid var(--color-border-strong);
  background: var(--color-surface-muted);
  font-weight: 700;
}

.production-report-total-label {
  color: var(--color-muted);
  text-align: right;
}

.production-report-total-value {
  color: var(--color-text);
}

.production-report-note {
  margin: 0.75rem 0;
}

@media (max-width: 760px) {
  .production-report-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .production-report-header {
    display: block;
  }

  .production-report-filters {
    margin-top: var(--space-4);
  }
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.marking-page-header,
.marking-invoice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marking-page-header {
  margin-bottom: 1rem;
}

.marking-page-header p {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
}

.marking-period-form {
  display: grid;
  gap: 1rem;
}

.marking-period-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 1rem;
  align-items: end;
}

.marking-period-form label {
  display: grid;
  gap: 0.25rem;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.marking-period-form input {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  background: var(--color-card-bg);
}

.marking-invoice-search {
  max-width: none;
}

.marking-invoice-search span {
  color: var(--color-muted);
}

.marking-search-empty {
  margin: 1rem 0 0;
  color: var(--color-muted);
}

.marking-invoice-header {
  align-items: flex-start;
}

.marking-invoice-date {
  margin-left: 0.4rem;
  color: var(--color-muted);
  font-size: 0.8em;
  font-weight: 400;
  white-space: nowrap;
}

.marking-product + .marking-product {
  margin-top: 1.25rem;
}

.marking-product h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.marking-product-name {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: copy;
}

.marking-product-name:hover {
  color: var(--color-primary);
}

.marking-product-name:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.marking-product-name.is-copied {
  color: var(--color-success);
}

.marking-codes-table {
  min-width: 760px;
}

.marking-code-copy-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 350px;
}

.marking-code-value {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  overflow-wrap: anywhere;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--color-text);
  background: transparent;
  font: 0.85rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: left;
  cursor: copy;
}

.marking-code-value:hover,
.marking-code-value:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-surface-muted);
  outline: none;
}

.marking-copy-button {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  justify-content: center;
  padding: 0.35rem;
}

.marking-copy-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.marking-copy-check-icon {
  display: none;
}

.marking-code-copy-field.is-copied .marking-code-value {
  border-color: var(--color-success);
  background: var(--color-success-bg);
}

.marking-code-copy-field.is-copied .marking-copy-button {
  color: var(--color-success);
  border-color: var(--color-success);
  background: var(--color-success-bg);
}

.marking-code-copy-field.is-copied .marking-copy-icon {
  display: none;
}

.marking-code-copy-field.is-copied .marking-copy-check-icon {
  display: block;
}

.marking-copy-status {
  display: none;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  margin: 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: 0.85rem;
  box-shadow: var(--shadow-hover);
}

.marking-copy-status:not(:empty) {
  display: block;
}

.marking-copy-status.is-error {
  border-color: #fecaca;
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

@media (max-width: 720px) {
  .marking-page-header,
  .marking-invoice-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .marking-invoice-date {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .marking-period-controls {
    grid-template-columns: 1fr;
  }
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

/* OpenCart duplicate review */
.duplicate-review-header {
  align-items: center;
}

.duplicate-review-guide {
  display: grid;
  gap: var(--space-3);
}

.duplicate-review-steps {
  display: grid;
  gap: var(--space-2);
  padding-left: 1.25rem;
}

.duplicate-review-readonly {
  margin-bottom: 0;
}

.duplicate-review-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.duplicate-review-stat {
  display: grid;
  gap: 0.15rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}

.duplicate-review-stat strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

.duplicate-review-stat span {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.duplicate-review-groups {
  display: grid;
  gap: var(--space-3);
}

.duplicate-review-group {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.duplicate-review-group > summary {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(190px, 0.8fr) minmax(280px, 1.8fr) auto;
  gap: var(--space-4);
  align-items: center;
  cursor: pointer;
  list-style: none;
  padding: var(--space-4);
}

.duplicate-review-group > summary::-webkit-details-marker {
  display: none;
}

.duplicate-review-group > summary::after {
  color: var(--color-primary);
  content: '+';
  font-size: 1.5rem;
  font-weight: 300;
  justify-self: end;
  line-height: 1;
}

.duplicate-review-group[open] > summary {
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
}

.duplicate-review-group[open] > summary::after {
  content: '−';
}

.duplicate-review-article,
.duplicate-review-summary-meta,
.duplicate-review-item-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.duplicate-review-article {
  align-content: center;
}

.duplicate-review-article code {
  font-size: 1rem;
  font-weight: 700;
}

.duplicate-review-summary-meta {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.duplicate-review-summary-action {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  font-size: 0.85rem;
}

.duplicate-review-summary-action span {
  color: var(--color-muted);
}

.duplicate-review-group-body {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: var(--space-4);
  padding: var(--space-4);
}

.duplicate-review-panel {
  min-width: 0;
}

.duplicate-review-panel-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-2);
}

.duplicate-review-panel h3 {
  font-size: 1.05rem;
}

.duplicate-review-pim-list,
.duplicate-review-site-list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.duplicate-review-pim-item,
.duplicate-review-site-item {
  display: grid;
  gap: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.duplicate-review-pim-item {
  background: #f8fbff;
}

.duplicate-review-site-item {
  background: #fffdf8;
}

.duplicate-review-item-header {
  justify-content: space-between;
}

.duplicate-review-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.duplicate-review-channel {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  min-width: 0;
}

.duplicate-review-decision {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  border-top: 1px solid var(--color-border);
  background: #fff;
  padding: var(--space-3) var(--space-4);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .duplicate-review-group > summary {
    grid-template-columns: minmax(150px, 0.9fr) minmax(170px, 0.8fr) auto;
  }

  .duplicate-review-summary-action {
    grid-column: 1 / -1;
  }

  .duplicate-review-group-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .duplicate-review-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .duplicate-review-stats,
  .duplicate-review-channel-grid {
    grid-template-columns: 1fr;
  }

  .duplicate-review-group > summary {
    grid-template-columns: 1fr auto;
    gap: var(--space-3);
  }

  .duplicate-review-article,
  .duplicate-review-summary-meta,
  .duplicate-review-summary-action {
    grid-column: 1 / -1;
  }

  .duplicate-review-group-body {
    padding: var(--space-3);
  }

  .duplicate-review-item-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  color: var(--color-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  min-height: var(--table-row-height);
}

tr:hover { background: #f8fafc; }

.variant-list {
  display: grid;
  gap: 0.45rem;
  min-width: 360px;
}

.variant-line {
  display: grid;
  gap: 0.2rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}

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

.variant-line strong {
  margin-right: 0.35rem;
}

.variant-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #eef1f5; color: #53606f; }
.channel-wb { background: #ede9fe; color: #5b21b6; }
.channel-ozon { background: #e0f2fe; color: #075985; }
.channel-site { background: #dcfce7; color: #166534; }

/* Alert messages */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #bbf7d0; }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--color-warning-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--color-info-bg); color: var(--color-info); border: 1px solid #bae6fd; }

.product-toast {
  align-items: flex-start;
  animation: product-toast-lifecycle 5.8s ease forwards;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.16);
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin: 0;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  position: fixed;
  inset: auto 1rem 1rem auto;
  width: max-content;
  z-index: 1000;
}

.product-toast:not([open]) { display: none; }

.product-toast::backdrop { display: none; }

.product-toast form { margin: -0.25rem -0.4rem 0 0; }

.product-toast-close {
  background: transparent;
  border: 0;
  color: currentColor;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}

@keyframes product-toast-lifecycle {
  0%, 88% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-0.25rem); visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .product-toast { animation-name: product-toast-reduced-lifecycle; }
}

@keyframes product-toast-reduced-lifecycle {
  0%, 95% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

@media (max-width: 600px) {
  .product-toast {
    left: 1rem;
    max-width: none;
    width: auto;
  }
}

.logout-form {
  margin: 0;
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
}

.auth-form input {
  width: 100%;
}

.auth-separator {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 1.25rem 0;
}

.auth-alt-action {
  margin-top: var(--space-3);
}

.user-form-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(140px, 0.7fr) minmax(160px, 0.8fr) auto;
  gap: var(--space-3);
  align-items: end;
}

.user-form-grid label,
.checkbox-line {
  display: grid;
  gap: var(--space-1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
}

.user-form-grid label {
  min-width: 0;
}

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

.form-actions {
  display: flex;
  align-items: end;
}

.copy-line {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-telegram-fields {
  display: grid;
  gap: var(--space-2);
  min-width: 150px;
}

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

  .user-form-grid .form-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .user-form-grid .form-actions {
    grid-column: auto;
  }
}

/* Import grid */
.import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.import-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.import-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.import-card-desc {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

/* HTMX indicators */
.htmx-request .btn { opacity: 0.7; pointer-events: none; }

.import-result {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.inline-form input {
  min-width: 220px;
  flex: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.field {
  display: grid;
  gap: var(--space-1);
  min-width: 220px;
}

.field span {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field small {
  color: var(--color-muted);
  font-size: 0.78rem;
  margin-top: 0.2rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font: inherit;
  min-height: 38px;
  padding: 0.45rem 0.6rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
}

.detail-item {
  padding: 0.5rem 0;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 0.95rem;
  font-family: var(--font-mono);
  word-break: break-all;
}

/* Master card editor */
.master-card-page {
  max-width: 1280px;
  margin: 0 auto;
  overflow-x: clip;
}

.master-card-page-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.master-card-header-media {
  aspect-ratio: 3 / 4;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  flex-shrink: 0;
  height: 120px;
  overflow: hidden;
  place-items: center;
  width: 90px;
}

.master-card-header-media img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.master-card-header-main {
  flex: 1;
  min-width: 0;
}

.master-card-page-header h2 {
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.2;
  margin: var(--space-1) 0 var(--space-2);
  max-width: 720px;
}

.master-card-back-link {
  color: var(--color-primary);
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
  text-decoration: none;
}

.master-card-back-link:hover {
  text-decoration: underline;
}

.master-card-page-subtitle,
.master-card-section-head p {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.master-card-page-meta {
  align-items: flex-end;
  color: var(--color-muted);
  display: grid;
  font-size: 0.82rem;
  gap: var(--space-1);
  justify-items: end;
  white-space: nowrap;
}

.master-card-page-meta strong {
  color: var(--color-text);
  font-size: 1rem;
}

/* Master card tabs navigation */
.master-card-tabs {
  border-bottom: 2px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: 0;
}

.master-card-tab {
  align-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--color-muted);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 500;
  gap: var(--space-2);
  margin-bottom: -2px;
  padding: var(--space-2) var(--space-4);
  position: relative;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.master-card-tab:hover {
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.master-card-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  z-index: 3;
}

.master-card-tab.is-active,
.master-card-tab[aria-selected="true"] {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
  font-weight: 600;
  z-index: 2;
}

.master-card-tab-title {
  display: inline-block;
}

.master-card-tab-badge {
  align-items: center;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: 0;
  font-weight: 600;
  height: 1.45rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 1.45rem;
}

.master-card-tab-badge::before {
  content: '!';
  font-size: 1rem;
  font-weight: 800;
}

.master-card-tab-badge.is-danger::before {
  content: '×';
}

.master-card-tab-badge.is-success::before {
  content: '✓';
}

.master-card-tab-badge.is-muted::before {
  content: '·';
}

.master-card-tab-badge.is-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.master-card-tab-badge.is-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.master-card-tab-badge.is-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.master-card-tab-badge.is-muted {
  background: var(--color-surface-muted);
  color: var(--color-muted);
}

.master-card-media {
  min-width: 0;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.master-card-media-legend {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.78rem;
  gap: var(--space-2);
  justify-content: flex-end;
}

.master-card-media-add {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.master-card-media-add input {
  flex: 1;
  min-width: 0;
}

.master-card-media-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.master-card-media-item {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2);
}

.master-card-channel-media-item[draggable="true"] {
  cursor: grab;
}

.master-card-media-preview {
  aspect-ratio: 3 / 4;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.master-card-media-preview img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.master-card-media-item-meta {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  font-size: 0.76rem;
  gap: var(--space-2);
  justify-content: space-between;
}

.master-card-media-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.master-card-media-controls .btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.42rem;
}

.master-card-media-controls .is-media-selected,
.master-card-media-legend .is-media-selected {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
}

.master-card-media-controls .is-media-unselected,
.master-card-media-legend .is-media-unselected {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-muted);
}

.master-card-channel-media {
  border-top: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
  padding-top: var(--space-4);
}

.master-card-channel-media-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.master-card-channel-media-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
}

.master-card-channel-media-position {
  align-items: center;
  color: var(--color-muted);
  display: inline-flex;
  font-size: 0.8rem;
  gap: var(--space-1);
}

.master-card-channel-media-position input {
  max-width: 4.5rem;
  padding: 0.28rem 0.4rem;
}

.master-card-media-help,
.master-card-media-empty {
  color: var(--color-muted);
  font-size: 0.86rem;
  margin: var(--space-3) 0 0;
}

@media (max-width: 700px) {
  .master-card-media-add {
    align-items: stretch;
    flex-direction: column;
  }

  .master-card-media-legend {
    justify-content: flex-start;
  }
}

.master-card-field-inline-hint[hidden] {
  display: none !important;
}

.master-card-field-inline-hint {
  background: var(--color-warning-bg);
  border-radius: var(--radius-sm);
  color: var(--color-warning);
  display: inline-flex;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1;
  margin-left: 0.25rem;
  padding: 0.12rem 0.3rem;
  text-transform: none;
  letter-spacing: normal;
  vertical-align: middle;
  white-space: nowrap;
}

.master-card-field-inline-hint[hidden] {
  display: none !important;
}

.master-card-channel-row[hidden],
.master-card-channels[hidden],
.master-card-editor[hidden],
.master-card-missing-note[hidden],
.master-card-form-actions[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .master-card-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .master-card-tab {
    flex-shrink: 0;
  }
}

.master-card-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.32rem 0.6rem;
  white-space: nowrap;
}

.master-card-status-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.master-card-status-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.master-card-status-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.master-card-source,
.master-card-editor,
.master-card-channels {
  padding: var(--space-5);
}

.master-card-section-head {
  align-items: flex-start;
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.master-card-section-head.compact {
  margin-bottom: var(--space-3);
}

.master-card-section-head h2,
.master-card-section-head h3 {
  font-size: 1.1rem;
  line-height: 1.25;
  margin-bottom: var(--space-1);
}

.master-card-section-head h3 {
  font-size: 1rem;
}

.master-card-source-tag,
.master-card-section-tag {
  background: var(--color-surface-muted);
  border-radius: 999px;
  color: var(--color-muted);
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
}

.master-card-facts {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.master-card-fact {
  background: var(--color-surface-muted);
  border-radius: var(--radius-sm);
  display: grid;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-3);
}

.master-card-fact span,
.master-card-fact small {
  color: var(--color-muted);
  font-size: 0.76rem;
}

.master-card-fact strong {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.master-card-missing-note,
.master-card-complete-note {
  background: var(--color-warning-bg);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  color: #7c2d12;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin-top: var(--space-4);
  padding: var(--space-3);
}

.master-card-page-missing-note {
  margin-bottom: var(--space-4);
  margin-top: 0;
}

.master-card-complete-note {
  background: var(--color-success-bg);
  border-color: #bbf7d0;
  color: var(--color-success);
}

.master-card-editor {
  gap: 0;
}

.master-card-form-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.master-card-logistics-grid {
  gap: var(--space-3);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.master-card-field {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

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

.master-card-field textarea {
  resize: vertical;
}

.master-card-field-wide {
  grid-column: 1 / -1;
}

.master-card-field.is-empty input,
.master-card-field.is-empty select,
.master-card-field.is-empty textarea {
  background: #fffaf3;
  border-color: #fed7aa;
}

.master-card-form-section {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
}

.master-card-conformity-list {
  display: grid;
  gap: var(--space-2);
}

.master-card-conformity-code,
.master-card-conformity-item {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.master-card-conformity-item {
  align-items: flex-start;
  flex-direction: column;
  gap: var(--space-1);
}

.master-card-conformity-item-main {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.master-card-conformity-link {
  align-items: center;
  display: inline-flex;
  font-size: 1.1em;
  line-height: 1;
  text-decoration: none;
}

.master-card-conformity-item + .master-card-conformity-item {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
}

.master-card-channel-field {
  max-width: 520px;
}

.master-card-channel-field select {
  width: 100%;
}

.master-card-form-actions {
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
}

.master-card-save-status {
  align-items: center;
  background: var(--color-surface-subtle, #f8fafc);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  display: inline-flex;
  font-size: 0.82rem;
  min-height: 2.35rem;
  padding: 0 var(--space-3);
}

.master-card-save-status.is-saving {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-bg);
  color: var(--color-warning);
}

.master-card-save-status.is-saved {
  background: var(--color-success-bg);
  border-color: var(--color-success-bg);
  color: var(--color-success);
}

.master-card-save-status.is-error {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-bg);
  color: var(--color-danger);
}

.master-card-save-alert {
  position: sticky;
  top: var(--space-2);
  z-index: 2;
}

.master-card-channel-list {
  display: grid;
  gap: var(--space-5);
}

.master-card-channel-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-3) var(--space-4);
  grid-template-columns: minmax(0, 1fr);
  justify-self: stretch;
  max-width: 960px;
  padding: var(--space-5);
  width: 100%;
}

.master-card-channel-row[data-channel="opencart"] {
  border-left-color: #22c55e;
}

.master-card-channel-row[data-channel="ozon"] {
  border-left-color: #0ea5e9;
}

.master-card-channel-row[data-channel="wb"] {
  border-left-color: #8b5cf6;
}

.master-card-channel-row:hover {
  box-shadow: var(--shadow-hover);
}

.master-card-channel-heading {
  grid-column: 1;
  grid-row: auto;
  min-width: 0;
}

.master-card-channel-heading strong {
  font-size: 1.05rem;
}

.master-card-channel-status-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  grid-column: auto;
  grid-row: auto;
  gap: var(--space-2);
  justify-content: flex-start;
}

.master-card-channel-counts {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-start;
}

.master-card-channel-category {
  color: var(--color-muted);
  display: grid;
  font-size: 0.78rem;
  gap: 0.1rem;
  margin-top: var(--space-2);
  text-align: right;
}

.master-card-channel-category strong {
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.master-card-channel-category-editor {
  align-self: stretch;
  display: grid;
  gap: 0.35rem;
  grid-column: auto;
  grid-row: auto;
  justify-items: stretch;
  margin-top: var(--space-2);
  max-width: 520px;
  min-width: min(100%, 22rem);
  position: relative;
  text-align: left;
}

.master-card-channel-category-editor label {
  color: var(--color-muted);
  font-size: 0.78rem;
}

.master-card-channel-category-editor input:not([type="hidden"]) {
  width: 100%;
}

.master-card-category-control {
  display: flex;
  position: relative;
}

.master-card-category-control input {
  min-width: 0;
  padding-right: 2.7rem;
}

.master-card-category-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  font-size: 1.15rem;
  height: 100%;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.master-card-category-toggle:hover {
  color: var(--color-text);
}

.master-card-category-options {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, 0.12));
  display: grid;
  left: 0;
  max-height: 16rem;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 5;
}

.master-card-category-options[hidden] {
  display: none !important;
}

.master-card-category-option {
  background: transparent;
  border: 0;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  padding: 0.65rem 0.75rem;
  text-align: left;
}

.master-card-category-option:hover,
.master-card-category-option:focus-visible {
  background: var(--color-surface-subtle, #f8fafc);
  outline: 0;
}

.master-card-category-status {
  color: var(--color-muted);
  font-size: 0.84rem;
  padding: 0.65rem 0.75rem;
}

.master-card-category-status.is-error {
  color: var(--color-danger);
}

.master-card-category-mapping-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.master-card-category-mapping-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.82rem;
  margin-top: var(--space-1);
}

.master-card-pim-category-info {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: 0.88rem;
}

.master-card-category-reference {
  align-items: baseline;
  color: var(--color-muted);
  display: inline-flex;
  flex-wrap: wrap;
  font-size: 0.78rem;
  gap: 0.35rem;
  margin-top: 0.05rem;
}

.master-card-category-reference-label {
  color: var(--color-soft);
  font-weight: 600;
}

.master-card-category-reference strong {
  color: var(--color-muted);
  font-weight: 600;
}

.master-card-pim-category-info.is-missing {
  background: var(--color-warning-bg);
  border-color: #fde68a;
  color: var(--color-warning);
}

.master-card-channel-description-editor {
  display: grid;
  gap: 0.35rem;
  grid-column: 1 / -1;
  margin-top: var(--space-1);
}

.master-card-channel-description {
  border-top: 1px solid var(--color-border);
  grid-column: 1 / -1;
  margin-top: var(--space-1);
  padding-top: var(--space-3);
}

.master-card-channel-description > h3 {
  color: var(--color-text);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
}

.master-card-channel-description .master-card-channel-description-editor {
  margin-top: var(--space-3);
}

.master-card-channel-description-editor textarea {
  min-height: 7rem;
  resize: vertical;
  width: 100%;
}

.master-card-channel-category-editor small {
  color: var(--color-muted);
  font-size: 0.78rem;
}

.master-card-channel-category-editor.is-invalid {
  border-left: 3px solid var(--color-danger);
  margin-left: -0.75rem;
  padding-left: 0.75rem;
}

.master-card-channel-category-editor.is-invalid label {
  color: var(--color-danger);
  font-weight: 700;
}

.master-card-channel-category-editor input[aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 1px var(--color-danger);
}

.master-card-channel-category-editor.is-pim-mismatch {
  border-left: 3px solid var(--color-warning);
  margin-left: -0.75rem;
  padding-left: 0.75rem;
}

.master-card-channel-category-editor.is-pim-mismatch input:not([type="hidden"]) {
  border-color: var(--color-warning);
  box-shadow: 0 0 0 1px var(--color-warning);
}

.master-card-category-warning {
  color: var(--color-warning);
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 0;
}

.master-card-channel-details {
  border-top: 1px solid var(--color-border);
  grid-column: 1 / -1;
  padding-top: var(--space-3);
}

.master-card-channel-issues {
  display: grid;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.master-card-channel-issues + .master-card-channel-issues {
  margin-top: var(--space-2);
}

.master-card-channel-issues li {
  font-size: 0.84rem;
  line-height: 1.4;
  padding-left: 1.15rem;
  position: relative;
}

.master-card-channel-issues li::before {
  content: '•';
  left: 0.25rem;
  position: absolute;
}

.master-card-channel-issues .is-error {
  color: var(--color-danger);
}

.master-card-channel-issues .is-warning {
  color: var(--color-warning);
}

.master-card-channel-issue-link {
  color: inherit;
  display: inline-block;
  font-weight: 700;
  margin-left: var(--space-2);
  text-decoration: underline;
}

.master-card-channel-issue-help {
  color: var(--color-muted);
  display: block;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.master-card-channel-issue-details {
  flex-basis: 100%;
  margin-top: 0.15rem;
}

.master-card-channel-issue-details summary {
  color: var(--color-muted);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  list-style: none;
}

.master-card-channel-issue-details summary::-webkit-details-marker {
  display: none;
}

.master-card-channel-issue-details summary::before {
  content: '›';
  display: inline-block;
  font-weight: 700;
  margin-right: 0.25rem;
}

.master-card-channel-issue-details[open] summary::before {
  content: '⌄';
}

.master-card-channel-issue-details code {
  background: var(--color-surface-muted);
  border-radius: var(--radius-sm);
  color: var(--color-soft);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
  padding: 0.15rem 0.35rem;
}

.master-card-channel-action {
  color: var(--color-muted);
  font-size: 0.84rem;
  line-height: 1.45;
  margin: var(--space-3) 0 0;
}

.master-card-channel-next-step {
  color: var(--color-muted);
  font-size: 0.84rem;
  grid-column: auto;
  grid-row: auto;
  line-height: 1.45;
  margin: 0;
}

.master-card-channel-next-step strong {
  color: var(--color-text);
}

.master-card-channel-action.is-success {
  color: var(--color-success);
  grid-column: 1 / -1;
  margin: 0;
}

.master-card-channel-publish-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.master-card-channel-publish-form span {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.master-card-channel-publish-btn[hidden] {
  display: none !important;
}

.master-card-channel-checklist {
  background: var(--color-surface-subtle, #f8fafc);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--space-3);
}

.master-card-channel-checklist-summary {
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 var(--space-2);
}

.master-card-channel-checklist-steps {
  display: grid;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.master-card-channel-checklist-steps li {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.84rem;
  gap: 0 var(--space-2);
  line-height: 1.45;
  padding-left: 1.15rem;
  position: relative;
}

.master-card-channel-checklist-steps li::before {
  content: '☐';
  left: 0;
  position: absolute;
  top: 0;
}

.master-card-channel-checklist-steps li.is-error {
  color: var(--color-danger);
}

.master-card-channel-checklist-steps li.is-warning {
  color: var(--color-warning);
}

.master-card-channel-checklist-steps li.is-error::before,
.master-card-channel-checklist-steps li.is-warning::before {
  content: '!';
  font-weight: 700;
}

.master-card-channel-checklist-action {
  background: transparent;
  border: 0;
  color: var(--color-primary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

.master-card-channel-checklist-action:hover {
  color: var(--color-text);
}

.master-card-channel-checklist .master-card-channel-issue-link {
  margin-left: 0;
}

.master-card-channel-checklist .master-card-channel-issue-help {
  flex-basis: 100%;
}

.master-card-channel-empty {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  padding: var(--space-4);
}

.master-card-channel-result {
  align-items: flex-start;
  display: grid;
  gap: var(--space-2);
  grid-column: 1;
  grid-row: auto;
  justify-items: start;
}

.master-card-channel-row {
  align-items: start;
  gap: var(--space-4);
}

.master-card-channel-row + .master-card-channel-row {
  border-top: 1px solid var(--color-border);
}

.master-card-channel-meta,
.master-card-channel-result > span:last-child {
  color: var(--color-muted);
  display: block;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

/* Sticky page action bar */
.master-card-sticky-actions {
  align-items: center;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-strong);
  bottom: 0;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  left: 0;
  max-width: 100%;
  min-width: 0;
  padding: var(--space-3) var(--space-5);
  position: sticky;
  z-index: 20;
}

.master-card-sticky-actions-left {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: var(--space-2);
  min-width: 0;
}

.master-card-sticky-actions-right {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-2);
  max-width: 100%;
  min-width: 0;
}

.master-card-sticky-actions .btn[disabled] {
  cursor: not-allowed;
  opacity: 0.75;
}

.master-card-sticky-actions-right .btn {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 720px) {
  .product-workspace-work {
    min-width: 0;
    width: 100%;
  }

  .master-card-page {
    min-width: 0;
    width: 100%;
  }

  .master-card-sticky-actions {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    width: 100%;
  }

  .master-card-sticky-actions-right {
    flex: 1 1 100%;
    width: 100%;
  }

  .master-card-sticky-actions-right .btn {
    justify-content: center;
    width: 100%;
  }
}

/* Section header */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

/* Utilities */
.text-muted { color: var(--color-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.ml-1 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.diff-positive { color: var(--color-success); font-weight: 600; }
.diff-negative { color: var(--color-danger); font-weight: 600; }
.readback-mismatch { cursor: help; }
.stock-not-ready { background: #f1f5f9; color: #64748b; }

/* Design system preview */
.ds-section {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-4);
  padding: var(--space-5);
}

.ds-section h3 {
  font-size: 1rem;
  margin-bottom: var(--space-3);
}

.token-grid,
.metric-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.token-swatch {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  gap: var(--space-1);
  min-height: 92px;
  padding: var(--space-3);
}

.token-swatch span {
  font-weight: 700;
}

.token-swatch code {
  font-size: 0.75rem;
}

.bg-surface { background: var(--color-surface); }
.bg-muted { background: var(--color-surface-muted); }
.bg-accent { background: var(--color-accent); color: #fff; }
.bg-success { background: var(--color-success-bg); color: var(--color-success); }
.bg-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.bg-danger { background: var(--color-danger-bg); color: var(--color-danger); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.metric-label {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 750;
  line-height: 1.2;
}

.metric-note {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Ozon card editor */
.ozon-editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-4);
  align-items: start;
}

.ozon-editor-main,
.ozon-editor-side {
  display: grid;
  gap: var(--space-4);
}

.ozon-hero,
.ozon-section,
.ozon-side-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ozon-hero {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
}

.ozon-hero h2 {
  font-size: 1.25rem;
  line-height: 1.25;
  margin: var(--space-1) 0 var(--space-2);
}

.ozon-meta-line {
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 0.85rem;
}

.ozon-meta-line span {
  background: var(--color-surface-muted);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

.ozon-status-box {
  align-self: flex-start;
  border-radius: var(--radius);
  display: grid;
  gap: 0.15rem;
  min-width: 150px;
  padding: var(--space-3);
}

.ozon-status-box.is-ready {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.ozon-status-box.is-blocked {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.ozon-status-box span {
  font-size: 0.82rem;
}

.ozon-issue-strip {
  background: var(--color-warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  color: #92400e;
  display: grid;
  gap: 0.25rem;
  padding: var(--space-3) var(--space-4);
}

.ozon-issue-strip span {
  font-size: 0.88rem;
}

.ozon-section {
  padding: var(--space-5);
}

.ozon-section-head {
  align-items: baseline;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
}

.ozon-section-head h3,
.ozon-side-title {
  font-size: 1rem;
  font-weight: 700;
}

.ozon-section-head span {
  color: var(--color-muted);
  font-size: 0.84rem;
}

.ozon-field-grid {
  display: grid;
  gap: var(--space-3);
}

.ozon-field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ozon-field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ozon-field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.ozon-content-facts-grid {
  align-items: start;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ozon-content-facts-grid .field {
  min-width: 0;
}

.ozon-subsection {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.ozon-subsection:first-of-type {
  margin-top: 0;
}

.ozon-main-grid {
  align-items: end;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ozon-single-grid {
  grid-template-columns: minmax(0, 1fr);
}

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

.ozon-dimensions-grid {
  gap: var(--space-2);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ozon-media-grid {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
}

.ozon-main-grid input,
.ozon-main-grid select,
.ozon-single-grid input,
.ozon-price-grid input,
.ozon-dimensions-grid input,
.ozon-media-grid input,
.ozon-media-grid textarea {
  min-width: 0;
  width: 100%;
}

.ozon-main-grid .field,
.ozon-single-grid .field,
.ozon-price-grid .field,
.ozon-dimensions-grid .field,
.ozon-media-grid .field {
  min-width: 0;
}

.ozon-variant-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ozon-variant-panel {
  background: #fbfcfe;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.ozon-variant-head {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
}

.ozon-variant-head span {
  color: var(--color-muted);
  font-size: 0.82rem;
}

.ozon-color-field {
  max-width: 360px;
}

.ozon-source-badge {
  background: #eef2f7;
  border: 1px solid #d6dde8;
  border-radius: 999px;
  color: #53606f;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 0.35rem;
  padding: 0.08rem 0.42rem;
  vertical-align: middle;
}

.ozon-source-1c {
  background: #eef2f7;
  border-color: #d6dde8;
  color: #53606f;
}

.ozon-source-derived {
  background: #f7f3ea;
  border-color: #e4d7bf;
  color: #6d5a3f;
}

.ozon-source-ozon {
  background: #edf3fb;
  border-color: #cddbeb;
  color: #475d7a;
}

.ozon-source-manual {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}

.ozon-field-group-title {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  font-size: 0.84rem;
  font-weight: 700;
  gap: var(--space-1);
}

.field:has(.ozon-source-derived) input,
.field:has(.ozon-source-derived) select,
.field:has(.ozon-source-derived) textarea,
.field:has(.ozon-source-ozon) input,
.field:has(.ozon-source-ozon) select,
.field:has(.ozon-source-ozon) textarea,
.ozon-autofilled-field input,
.ozon-autofilled-field select,
.ozon-autofilled-field textarea {
  background: #f5f9ff;
  border-color: #9fc3ee;
}

.ozon-tnved-options {
  display: grid;
  gap: 0.4rem;
  max-width: 760px;
}

.ozon-tnved-option {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 0.48rem 0.65rem;
}

.ozon-tnved-option.is-selected {
  background: #f5f9ff;
  border-color: #8bb8ec;
}

.ozon-tnved-option input {
  margin-top: 0.18rem;
}

.ozon-tnved-option span {
  display: -webkit-box;
  line-height: 1.28;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ozon-run-items {
  display: grid;
  gap: 0.45rem;
}

.ozon-run-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
}

.ozon-run-item > div:first-child {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  justify-content: space-between;
}

.ozon-run-item.has-warnings {
  background: #fffaf0;
  border-color: #e4d7bf;
}

.ozon-run-item.has-errors {
  background: #fff5f5;
  border-color: #f1b7b7;
}

.ozon-size-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ozon-size-row {
  align-items: center;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: grid;
  gap: 0.45rem;
  grid-template-columns: minmax(84px, 0.45fr) minmax(160px, 1fr) minmax(150px, 0.85fr) 78px;
  padding: 0.35rem var(--space-2);
}

.ozon-size-row input {
  min-height: 34px;
  padding: 0.38rem 0.55rem;
}

.ozon-size-cell {
  display: block;
}

.ozon-size-cell > span,
.ozon-size-stock > span {
  display: none;
}

.ozon-size-stock {
  align-items: center;
  display: flex;
  justify-content: flex-end;
}

.ozon-size-row:last-child {
  border-bottom: 0;
}

.ozon-size-head {
  background: var(--color-surface-muted);
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ozon-size-row strong {
  color: var(--color-muted);
  font-size: 0.86rem;
  text-align: right;
}

.ozon-attribute-list {
  display: grid;
  gap: var(--space-2);
}

.ozon-attribute-row {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 90px minmax(150px, 0.8fr) minmax(180px, 1fr) 100px 74px;
}

.ozon-required-toggle {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  font-size: 0.78rem;
  gap: 0.35rem;
  min-height: 38px;
}

.ozon-required-toggle input {
  min-height: auto;
  width: auto;
}

.ozon-editor-side {
  position: sticky;
  top: var(--space-4);
}

.ozon-side-panel {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
}

.ozon-facts {
  display: grid;
  gap: var(--space-2);
}

.ozon-facts dt {
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ozon-facts dd {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .ozon-editor-shell {
    grid-template-columns: 1fr;
  }

  .ozon-editor-side {
    position: static;
  }
}

@media (max-width: 720px) {
  .ozon-hero {
    flex-direction: column;
    padding: var(--space-4);
  }

  .ozon-status-box {
    width: 100%;
  }

  .ozon-section {
    padding: var(--space-4);
  }

  .ozon-field-grid.two,
  .ozon-field-grid.three,
  .ozon-field-grid.four,
  .ozon-content-facts-grid,
  .ozon-main-grid,
  .ozon-single-grid,
  .ozon-price-grid,
  .ozon-dimensions-grid,
  .ozon-media-grid,
  .ozon-size-row,
  .ozon-attribute-row {
    grid-template-columns: 1fr;
  }

  .ozon-size-head {
    display: none;
  }

  .ozon-size-row strong {
    text-align: left;
  }

  .ozon-size-cell > span,
  .ozon-size-stock > span {
    color: var(--color-muted);
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
  }

  .ozon-size-stock {
    align-items: flex-start;
    display: grid;
    justify-content: start;
  }

  .ozon-variant-grid {
    grid-template-columns: 1fr;
  }
}

.pagination {
  padding-top: var(--space-2);
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
}

.pagination-summary {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pagination-current {
  background: var(--color-text);
  color: var(--color-surface);
}

.pagination-disabled {
  opacity: 0.45;
  pointer-events: none;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23657080'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center no-repeat;
  cursor: pointer;
}

/* Product list header */
.product-list-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.product-list-intro {
  display: grid;
  gap: 0.15rem;
}

.product-list-intro .eyebrow {
  color: var(--color-primary);
}

.product-list-intro p {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.product-stats {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.product-stat-item {
  align-items: baseline;
  border-right: 1px solid var(--color-border);
  color: var(--color-text);
  display: inline-flex;
  gap: 0.4rem;
  margin: 0.15rem 0;
  padding: 0 var(--space-4);
  text-decoration: none;
}

.product-stat-item:first-child {
  padding-left: 0;
}

.product-stat-item:last-child {
  border-right: 0;
}

.product-stat-label {
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.product-stat-value {
  font-size: 1.2rem;
  font-weight: 750;
  line-height: 1.2;
}

.product-stat-actionable {
  color: var(--color-primary);
}

.product-controls {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3);
}

.product-filter-primary {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.product-filter-secondary {
  align-items: flex-start;
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: var(--space-3) var(--space-4);
  padding-top: var(--space-3);
}

.product-filter-toggles {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  grid-column: 1 / -1;
}

.product-filter-group {
  align-items: center;
  border: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.product-filter-group legend {
  color: var(--color-muted);
  float: none;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  padding: 0;
  white-space: nowrap;
}

.product-filter-group-negative .platform-filter-option input:checked + span {
  background: var(--color-warning-bg, #fffbeb);
  border-color: var(--color-warning, #d97706);
  color: var(--color-warning, #b45309);
}

.product-card-filters,
.product-quick-filters {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.product-filter-label {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.filter-chip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  text-decoration: none;
}

.filter-chip:hover,
.filter-chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.product-filter-hint {
  margin: 0 0 var(--space-3);
  max-width: 900px;
}

.product-filter-status {
  color: var(--color-muted);
  min-height: 1.25rem;
  margin: var(--space-2) 0 0;
}

.channel-status-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.channel-status {
  border-radius: 9999px;
  display: inline-flex;
  font-size: 0.73rem;
  font-weight: 700;
  gap: 0.2rem;
  padding: 0.15rem 0.45rem;
}

.channel-status.is-missing {
  background: #f3f4f6;
  color: #6b7280;
}

.product-identity-channels {
  margin-bottom: 0;
  margin-top: 0.4rem;
}

.product-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.product-table {
  min-width: 760px;
}

.product-table thead th {
  background: #fbfcfd;
  white-space: nowrap;
}

.product-table tbody td {
  vertical-align: top;
}

.product-table tbody tr:last-child td {
  border-bottom: 0;
}

.product-identity-cell {
  min-width: 300px;
}

.product-identity-main {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.product-article {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.product-name {
  display: block;
  font-weight: 650;
  line-height: 1.35;
  max-width: 100%;
  min-width: 0;
}

.product-row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 120px;
}

.product-row-actions form {
  margin: 0;
}

.product-row-actions .btn {
  justify-content: center;
  white-space: nowrap;
}

.product-row-hidden {
  background: #fafafa;
}

.product-row-hidden .product-name {
  color: var(--color-muted);
}

.product-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.product-category-link {
  flex: none;
  white-space: nowrap;
}

.product-controls input:focus-visible,
.product-row-actions .btn:focus-visible,
.filter-chip:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

/* Price control */
.price-control-tabs {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: var(--space-3);
  padding: 0.25rem;
}

.price-control-tabs a {
  border-radius: calc(var(--radius) - 2px);
  color: var(--color-muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
}

.price-control-tabs a:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.price-control-tabs a.is-active {
  background: var(--color-primary);
  color: #fff;
}

.price-control-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.price-summary-main {
  display: grid;
  gap: var(--space-1);
}

.price-summary-main strong {
  font-size: 1.1rem;
  line-height: 1.1;
}

.price-summary-main em {
  color: var(--color-muted);
  font-size: 0.9rem;
  font-style: normal;
}

.price-summary-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.price-chip {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.5rem 0.7rem;
  white-space: nowrap;
}

.price-chip-warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.price-chip-success {
  background: var(--color-success-bg);
  border-color: #bbf7d0;
  color: var(--color-success);
}

.price-chip-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.price-chip-muted {
  color: var(--color-muted);
}

.mc-summary-chip {
  text-decoration: none;
}

.mc-summary-chip:hover {
  filter: brightness(0.97);
  text-decoration: none;
}

.mc-card-summary-panel {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

.mc-platform-switch {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: inline-flex;
  gap: 0;
  padding: 0.2rem;
}

.mc-platform-switch a {
  border-radius: calc(var(--radius) - 2px);
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
}

.mc-platform-switch a.is-active {
  background: var(--color-primary);
  color: #fff;
}

.mc-report-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.mc-report-tabs a {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
}

.mc-report-tabs a.is-active {
  background: #eff6ff;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.mc-card-metrics {
  align-items: center;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  gap: var(--space-3);
}

.mc-card-metrics span {
  white-space: nowrap;
}

.mc-card-metrics b {
  color: var(--color-text);
  font-size: 1rem;
}

.mc-technical-details summary {
  color: var(--color-primary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.mc-technical-details[open] {
  max-width: 34rem;
}

@media (max-width: 860px) {
  .price-control-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .price-summary-breakdown {
    justify-content: flex-start;
  }

  .mc-card-summary-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .mc-model-table {
    min-width: 0;
    table-layout: auto;
    width: 100%;
  }

  .mc-model-table.table-wrapper,
  .table-wrapper:has(.mc-model-table) {
    overflow-x: visible;
  }

  .mc-model-table,
  .mc-model-table thead,
  .mc-model-table tbody,
  .mc-model-table tr,
  .mc-model-table th,
  .mc-model-table td {
    display: block;
  }

  .mc-model-table thead {
    display: none;
  }

  .mc-model-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
    width: 100%;
  }

  .mc-model-table tr:hover {
    background: transparent;
  }

  .mc-model-table th:nth-child(n),
  .mc-model-table td:nth-child(n) {
    width: auto;
  }

  .mc-model-table td {
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(120px, 28%) minmax(0, 1fr);
    overflow-wrap: anywhere;
    padding: var(--space-2) var(--space-3);
  }

  .mc-model-table td:last-child {
    border-bottom: 0;
  }

  .mc-model-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .mc-model-actions .btn {
    width: auto;
  }
}

.price-delta-high {
  color: var(--color-warning);
  font-weight: 700;
}

.price-delta-low {
  color: var(--color-danger);
  font-weight: 700;
}

.price-control-table {
  table-layout: fixed;
}

.price-control-table th:first-child,
.price-control-table td:first-child {
  width: 26%;
}

.price-control-table th:nth-child(2),
.price-control-table td:nth-child(2) {
  width: 34%;
}

.mc-model-table {
  table-layout: fixed;
  min-width: 1040px;
}

.mc-model-table th,
.mc-model-table td {
  vertical-align: top;
}

.mc-model-table th:first-child,
.mc-model-table td:first-child {
  width: 28%;
}

.mc-model-table th:nth-child(2),
.mc-model-table td:nth-child(2) {
  width: 8%;
}

.mc-model-table th:nth-child(3),
.mc-model-table td:nth-child(3),
.mc-model-table th:nth-child(4),
.mc-model-table td:nth-child(4) {
  width: 13%;
}

.mc-model-table th:nth-child(5),
.mc-model-table td:nth-child(5) {
  width: 30%;
}

.mc-model-table th:nth-child(6),
.mc-model-table td:nth-child(6) {
  width: 8%;
}

.mc-model-table .price-chip {
  line-height: 1.25;
  max-width: 100%;
  white-space: normal;
}

.mc-coverage {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  min-width: 4.2rem;
  padding: 0.45rem 0.65rem;
  justify-content: center;
}

.mc-coverage-full {
  background: #dcfce7;
  color: #166534;
}

.mc-coverage-warning {
  background: #ffedd5;
  color: #9a3412;
}

.mc-coverage-muted {
  background: #f1f5f9;
  color: #64748b;
}

.mc-fix-list {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mc-fix-item {
  align-items: flex-start;
  display: flex;
  font-size: 0.86rem;
  gap: 0.35rem;
  justify-content: space-between;
  line-height: 1.3;
}

.mc-fix-item span {
  min-width: 0;
}

.mc-fix-item strong {
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0.25rem 0.45rem;
}

.mc-fix-item-warning strong {
  background: #fff7ed;
  color: #9a3412;
}

.mc-fix-item-danger {
  color: #991b1b;
}

.mc-fix-item-danger strong {
  background: #fef2f2;
  color: #991b1b;
}

.mc-model-actions {
  text-align: right;
}

.mc-model-actions .btn {
  justify-content: center;
  width: 100%;
}

@media (max-width: 860px) {
  .table-wrapper:has(.mc-model-table) {
    overflow-x: visible;
  }

  .mc-model-table {
    min-width: 0;
    table-layout: auto;
    width: 100%;
  }

  .mc-model-table,
  .mc-model-table thead,
  .mc-model-table tbody,
  .mc-model-table tr,
  .mc-model-table th,
  .mc-model-table td {
    display: block;
  }

  .mc-model-table thead {
    display: none;
  }

  .mc-model-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
    width: 100%;
  }

  .mc-model-table tr:hover {
    background: transparent;
  }

  .mc-model-table th:nth-child(n),
  .mc-model-table td:nth-child(n) {
    width: auto;
  }

  .mc-model-table td {
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(120px, 28%) minmax(0, 1fr);
    overflow-wrap: anywhere;
    padding: var(--space-2) var(--space-3);
  }

  .mc-model-table td:last-child {
    border-bottom: 0;
  }

  .mc-model-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .mc-model-actions .btn {
    width: auto;
  }
}

/* Marketplace Control operational tables */
.mc-op-table {
  table-layout: fixed;
}

.mc-op-table th,
.mc-op-table td {
  vertical-align: top;
}

.mc-op-table th:first-child,
.mc-op-table td:first-child,
.mc-op-table th:nth-child(2),
.mc-op-table td:nth-child(2) {
  width: auto;
}

.mc-op-table-external-unmapped th:nth-child(1),
.mc-op-table-external-unmapped td:nth-child(1) {
  width: 6%;
}

.mc-op-table-external-unmapped th:nth-child(2),
.mc-op-table-external-unmapped td:nth-child(2) {
  width: 22%;
}

.mc-op-table-external-unmapped th:nth-child(3),
.mc-op-table-external-unmapped td:nth-child(3) {
  width: 14%;
}

.mc-op-table-external-unmapped th:nth-child(4),
.mc-op-table-external-unmapped td:nth-child(4) {
  width: 18%;
}

.mc-op-table-external-unmapped th:nth-child(5),
.mc-op-table-external-unmapped td:nth-child(5) {
  width: 8%;
}

.mc-op-table-external-unmapped th:nth-child(6),
.mc-op-table-external-unmapped td:nth-child(6) {
  width: 32%;
}

.mc-op-table-card-issues th:nth-child(1),
.mc-op-table-card-issues td:nth-child(1) {
  width: 14%;
}

.mc-op-table-card-issues th:nth-child(2),
.mc-op-table-card-issues td:nth-child(2) {
  width: 25%;
}

.mc-op-table-card-issues th:nth-child(3),
.mc-op-table-card-issues td:nth-child(3) {
  width: 17%;
}

.mc-op-table-card-issues th:nth-child(4),
.mc-op-table-card-issues td:nth-child(4) {
  width: 23%;
}

.mc-op-table-card-issues th:nth-child(5),
.mc-op-table-card-issues td:nth-child(5) {
  width: 21%;
}

.mc-op-table-card-issues .price-chip {
  white-space: normal;
}

.mc-op-table-conflicts th:nth-child(1),
.mc-op-table-conflicts td:nth-child(1) {
  width: 5%;
}

.mc-op-table-conflicts th:nth-child(2),
.mc-op-table-conflicts td:nth-child(2) {
  width: 18%;
}

.mc-op-table-conflicts th:nth-child(3),
.mc-op-table-conflicts td:nth-child(3) {
  width: 30%;
}

.mc-op-table-conflicts th:nth-child(4),
.mc-op-table-conflicts td:nth-child(4) {
  width: 14%;
}

.mc-op-table-conflicts th:nth-child(5),
.mc-op-table-conflicts td:nth-child(5) {
  width: 18%;
}

.mc-op-table-conflicts th:nth-child(6),
.mc-op-table-conflicts td:nth-child(6) {
  width: 15%;
}

.mc-op-break,
.mc-op-cell {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mc-op-table .conflict-alias-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mc-op-table .conflict-alias-list li {
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

.mc-op-table .conflict-alias-list code {
  word-break: break-all;
}

.mc-op-table .conflict-alias-list .text-muted {
  overflow-wrap: anywhere;
}

.mc-op-actions {
  min-width: 0;
  vertical-align: top;
}

.mc-op-table .mc-op-actions .inline-form {
  align-items: flex-end;
  gap: 0.35rem 0.5rem;
}

.mc-op-table .mc-op-actions .mc-op-field {
  flex: 0 0 auto;
  min-width: 0;
}

.mc-op-table .mc-op-actions .mc-op-field span {
  font-size: 0.7rem;
}

.mc-op-table .mc-op-actions .mc-op-action-form input[type="number"] {
  flex: 0 0 auto;
  min-height: 32px;
  min-width: 0;
  padding: 0.3rem 0.45rem;
  width: 4.5rem;
}

.mc-op-table .mc-op-actions .mc-op-variant-field {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.mc-op-table .mc-op-actions .mc-op-variant-select {
  min-height: 32px;
  min-width: 0;
  width: 100%;
}

.mc-op-variant-search-hint {
  margin: 0 0 var(--space-3);
}

.mc-op-table .mc-op-inline-form {
  display: inline;
}

.mc-op-table .mc-op-review-actions {
  gap: 0.35rem;
}

.price-position-line,
.price-position-value {
  align-items: center;
  display: flex;
  min-height: 44px;
}

.price-position-line {
  gap: var(--space-2);
}

.price-position-line .badge {
  flex: 0 0 auto;
}

.price-position-line > span:last-child {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.price-position-value + .price-position-value,
.price-position-line + .price-position-line {
  border-top: 1px solid var(--color-border);
}

.price-control-filters {
  align-items: end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(260px, 1.35fr) minmax(140px, 0.65fr) minmax(170px, 0.8fr) auto auto auto;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.price-search-field {
  min-width: 0;
}

.price-control-filters .field {
  min-width: 0;
}

.price-control-filters input,
.price-control-filters select,
.price-filter-submit,
.price-toggle {
  height: 40px;
}

.price-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  gap: var(--space-2);
  justify-content: center;
  padding: 0 var(--space-2);
}

.price-toggle input {
  min-height: auto;
  margin: 0;
  width: auto;
}

.price-toggle span {
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.price-filter-submit {
  justify-content: center;
  min-width: 120px;
}

.price-control-filters-compact {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  grid-template-columns: none;
}

.price-control-filters-compact .product-search-input {
  height: 40px;
}

.price-control-filters-compact .price-status-field {
  min-width: 190px;
}

.price-control-filters-compact .price-status-field span {
  display: none;
}

.unit-economics-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: var(--space-4);
}

main.container:has(.unit-economics-page) {
  max-width: 1760px;
}

.unit-economics-wide {
  grid-column: 1 / -1;
}

.table-scroll {
  overflow-x: auto;
}

.unit-economics-table {
  min-width: 1380px;
  table-layout: auto;
}

.unit-economics-table th,
.unit-economics-table td {
  vertical-align: top;
}

.unit-economics-table th:first-child,
.unit-economics-table td:first-child {
  min-width: 250px;
  width: 250px;
}

.unit-economics-table th:nth-child(2),
.unit-economics-table td:nth-child(2) {
  min-width: 150px;
  width: 150px;
}

.unit-economics-table th:nth-child(n+3),
.unit-economics-table td:nth-child(n+3) {
  min-width: 96px;
  text-align: right;
  width: 96px;
}

.unit-economics-table th:last-child,
.unit-economics-table td:last-child {
  min-width: 130px;
  text-align: left;
  width: 130px;
}

.unit-economics-discount-summary {
  margin-bottom: var(--space-4);
}

.unit-economics-discount-table {
  min-width: 1120px;
}

.unit-economics-summary-table {
  min-width: 1080px;
}

.unit-economics-breakdown-table {
  font-size: 0.86rem;
  min-width: 1120px;
  table-layout: fixed;
}

.unit-economics-breakdown-table th {
  font-size: 0.72rem;
  letter-spacing: 0;
  line-height: 1.15;
  padding: 0.5rem 0.55rem;
  white-space: nowrap;
}

.unit-economics-breakdown-table td {
  line-height: 1.25;
  padding: 0.55rem;
  vertical-align: top;
}

.unit-economics-breakdown-table th:first-child,
.unit-economics-breakdown-table td:first-child {
  text-align: left;
  width: 31%;
}

.unit-economics-breakdown-table th:nth-child(n+2),
.unit-economics-breakdown-table td:nth-child(n+2) {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.unit-economics-breakdown-table .muted {
  display: block;
  margin-top: 0.2rem;
}

.unit-economics-drivers-table th:nth-child(2),
.unit-economics-drivers-table td:nth-child(2),
.unit-economics-drivers-table th:nth-child(6),
.unit-economics-drivers-table td:nth-child(6),
.unit-economics-drivers-table th:nth-child(8),
.unit-economics-drivers-table td:nth-child(8) {
  width: 7%;
}

.unit-economics-drivers-table th:nth-child(3),
.unit-economics-drivers-table td:nth-child(3),
.unit-economics-drivers-table th:nth-child(4),
.unit-economics-drivers-table td:nth-child(4),
.unit-economics-drivers-table th:nth-child(5),
.unit-economics-drivers-table td:nth-child(5),
.unit-economics-drivers-table th:nth-child(7),
.unit-economics-drivers-table td:nth-child(7) {
  width: 12%;
}

.unit-economics-losses-table th:first-child,
.unit-economics-losses-table td:first-child {
  width: 25%;
}

.unit-economics-losses-table th:nth-child(2),
.unit-economics-losses-table td:nth-child(2) {
  text-align: left;
  width: 12%;
}

.unit-economics-losses-table th:nth-child(3),
.unit-economics-losses-table td:nth-child(3),
.unit-economics-losses-table th:nth-child(9),
.unit-economics-losses-table td:nth-child(9),
.unit-economics-losses-table th:nth-child(10),
.unit-economics-losses-table td:nth-child(10) {
  width: 7%;
}

.unit-economics-losses-table th:nth-child(n+4):nth-child(-n+8),
.unit-economics-losses-table td:nth-child(n+4):nth-child(-n+8) {
  width: 8.4%;
}

.unit-economics-insight-list {
  display: grid;
  gap: var(--space-2);
}

.unit-economics-insight-item {
  border-bottom: 1px solid var(--color-border);
  display: grid;
  gap: 0.25rem;
  padding: 0 0 var(--space-2);
}

.unit-economics-insight-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.unit-economics-insight-item span {
  color: var(--color-muted);
}

.unit-economics-actions-list .unit-economics-insight-item {
  gap: 0.35rem;
}

.muted {
  color: var(--color-muted);
}

@media (max-width: 980px) {
  .price-control-filters {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.6fr);
  }

  .price-toggle {
    justify-content: flex-start;
  }

  .unit-economics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  main.container:has(.unit-economics-page) {
    padding: var(--space-3);
  }

  .unit-economics-table {
    min-width: 0;
    table-layout: auto;
  }

  .unit-economics-table thead {
    display: none;
  }

  .unit-economics-table,
  .unit-economics-table tbody,
  .unit-economics-table tr,
  .unit-economics-table td {
    display: block;
    width: 100%;
  }

  .unit-economics-table tr {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) 0;
  }

  .unit-economics-table tr:last-child {
    border-bottom: 0;
  }

  .unit-economics-table td {
    align-items: baseline;
    border-bottom: 0;
    display: grid;
    gap: var(--space-3);
    grid-template-columns: minmax(115px, 38%) minmax(0, 1fr);
    min-width: 0;
    overflow-wrap: anywhere;
    padding: var(--space-1) 0;
    text-align: right;
  }

  .unit-economics-table td:first-child {
    display: block;
    min-width: 0;
    padding-bottom: var(--space-2);
    text-align: left;
  }

  .unit-economics-table td:first-child::before {
    display: none;
  }

  .unit-economics-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
  }

  .unit-economics-table td:last-child {
    min-width: 0;
    text-align: right;
  }

  .table-scroll:has(.unit-economics-breakdown-table) {
    overflow-x: visible;
  }

  .unit-economics-breakdown-table,
  .unit-economics-breakdown-table thead,
  .unit-economics-breakdown-table tbody,
  .unit-economics-breakdown-table tr,
  .unit-economics-breakdown-table td {
    display: block;
    width: 100%;
  }

  .unit-economics-breakdown-table {
    min-width: 0;
  }

  .unit-economics-breakdown-table thead {
    display: none;
  }

  .unit-economics-breakdown-table tr {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0;
  }

  .unit-economics-breakdown-table tr:last-child {
    border-bottom: 0;
  }

  .unit-economics-breakdown-table td,
  .unit-economics-breakdown-table td:nth-child(n),
  .unit-economics-losses-table td:nth-child(2) {
    align-items: baseline;
    border-bottom: 0;
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    min-height: 0;
    padding: 0.22rem 0;
    text-align: right;
    white-space: normal;
    width: 100%;
  }

  .unit-economics-breakdown-table td:first-child {
    display: block;
    padding-bottom: var(--space-2);
    text-align: left;
  }

  .unit-economics-breakdown-table td:first-child::before {
    display: none;
  }

  .unit-economics-breakdown-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
  }
}

.platform-filter {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.platform-filter-option {
  cursor: pointer;
  display: inline-flex;
}

.platform-filter-option input {
  height: 1px;
  margin: 0;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.platform-filter-option span {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.65rem 0.85rem;
}

.platform-filter-option input:checked + span {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.platform-filter-option input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

/* Product detail */
.product-detail-header {
  align-items: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 160px minmax(0, 1fr);
  margin-bottom: var(--space-4);
  padding: var(--space-5);
}

.product-detail-media {
  aspect-ratio: 3 / 4;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  height: 220px;
  overflow: hidden;
  place-items: center;
}

.product-detail-media img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.product-image-placeholder {
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.product-detail-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.product-detail-actions {
  align-items: flex-start;
  gap: var(--space-4);
}

.product-updated-at {
  color: var(--color-muted);
  display: grid;
  flex: none;
  gap: 0.1rem;
  justify-items: end;
  line-height: 1.2;
  text-align: right;
}

.product-updated-at span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.product-updated-at strong {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 700;
}

.product-detail-actions h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  margin-top: var(--space-1);
}

.product-article-inline {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-top: var(--space-2);
}

.product-article-inline strong {
  color: var(--color-text);
}

.product-stock-overview {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}

details.product-data-context {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  margin-top: var(--space-4);
}

summary.product-data-context-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 600;
  justify-content: space-between;
  list-style: none;
  padding: var(--space-4) var(--space-5);
  user-select: none;
}

summary.product-data-context-summary::-webkit-details-marker {
  display: none;
}

summary.product-data-context-summary::after {
  color: var(--color-muted);
  content: "▸";
  font-size: 1.1rem;
  margin-left: var(--space-3);
  transition: transform 0.2s ease;
}

details.product-data-context[open] summary.product-data-context-summary::after {
  transform: rotate(90deg);
}

.product-data-context-title {
  color: var(--color-text);
  font-size: 1.1rem;
}

.product-data-context-hint {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: normal;
}

.product-data-context-body {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.publication-workbench {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.publication-workbench-head {
  align-items: center;
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
}

.publication-workbench-head h2 {
  font-size: 1.1rem;
  line-height: 1.25;
  margin-top: var(--space-1);
}

.publication-workbench-head p {
  color: var(--color-muted);
  font-size: 0.88rem;
  margin-top: var(--space-1);
}

.publication-channel-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.publication-channel-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  padding: var(--space-3);
}

.publication-channel-topline {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
}

.publication-channel-name {
  color: var(--color-muted);
  font-size: 0.82rem;
}

.publication-channel-link {
  color: var(--color-primary);
  font-size: 0.84rem;
  font-weight: 700;
  margin-top: var(--space-2);
  text-decoration: none;
}

.publication-channel-link:hover {
  text-decoration: underline;
}

.marketplace-empty-state {
  align-items: flex-start;
  background: var(--color-bg);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius);
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
}

.marketplace-empty-state p {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0;
}

.stock-ledger-head span {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stock-ledger {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stock-ledger-row {
  align-items: center;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(160px, 1fr) minmax(80px, auto);
  min-height: 42px;
  padding: 0.55rem 0.75rem;
}

.stock-ledger-row:last-child {
  border-bottom: 0;
}

.stock-ledger-row strong {
  font-size: 1rem;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

.stock-ledger-primary {
  background: var(--color-success-bg);
  font-weight: 700;
}

.stock-ledger-child {
  background: #f8fbff;
  position: relative;
}

.stock-ledger-child span:first-child {
  padding-left: 1.75rem;
}

.stock-ledger-child span:first-child::before {
  border-bottom: 1px solid var(--color-border-strong);
  border-left: 1px solid var(--color-border-strong);
  content: "";
  height: 1.1rem;
  left: 1.15rem;
  position: absolute;
  top: 0;
  width: 0.85rem;
}

.stock-ledger-warning {
  background: var(--color-info-bg);
}

.product-summary-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.product-summary-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  gap: var(--space-1);
  min-height: 78px;
  padding: var(--space-3);
}

.product-summary-item-note {
  background: var(--color-info-bg);
  border-color: #bae6fd;
}

.product-summary-item span,
.stock-location-values span,
.marketplace-facts span {
  color: var(--color-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.product-summary-item strong {
  font-size: 1.1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.product-summary-item em {
  color: var(--color-muted);
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.25;
}

.price-comparison-table {
  table-layout: fixed;
}

.price-comparison-table th:first-child,
.price-comparison-table td:first-child {
  width: 18%;
}

.price-comparison-table th:last-child,
.price-comparison-table td:last-child {
  width: 12%;
}

.price-comparison-table td {
  vertical-align: top;
}

.price-comparison-table td > strong,
.price-position-cell > strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

.price-status-inline {
  margin-top: var(--space-1);
}

.stock-accounting-note {
  align-items: flex-start;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
}

.stock-accounting-note strong {
  color: var(--color-text);
  flex: none;
}

.product-tabs > input {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  padding: 0;
  width: 1px;
  white-space: nowrap;
}

.product-tabs {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: var(--space-4);
  overflow: hidden;
}

.product-tab-list {
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0;
  padding: 0 var(--space-4);
}

.product-tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 -1px;
  padding: 0.8rem 1rem;
}

#reference-tab-1c:checked ~ .product-tab-list label[for="reference-tab-1c"],
#reference-tab-wb:checked ~ .product-tab-list label[for="reference-tab-wb"],
#reference-tab-ozon:checked ~ .product-tab-list label[for="reference-tab-ozon"] {
  background: var(--color-surface);
  border-color: var(--color-border);
  border-top-color: var(--color-primary);
  color: var(--color-primary);
}

.product-tab-panel {
  display: none;
  padding: var(--space-4);
}

#reference-tab-1c:checked ~ .product-tab-panel-1c,
#reference-tab-wb:checked ~ .product-tab-panel-wb,
#reference-tab-ozon:checked ~ .product-tab-panel-ozon {
  display: block;
}

.product-tab-panel > .card,
.product-tab-panel > .marketplace-card {
  border: 0;
  box-shadow: none;
  margin-bottom: 0;
  padding: 0;
}

.product-tab-panel > .card + .card {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
}

.detail-value-text {
  font-family: var(--font-sans);
  word-break: normal;
}

.stock-location-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stock-location-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.stock-location-name {
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.stock-location-values {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stock-location-values strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.2;
  margin-top: var(--space-1);
}

.unit-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.marketplace-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
}

.marketplace-card-head {
  align-items: flex-start;
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.marketplace-card-head h3 {
  font-size: 1.25rem;
  line-height: 1.25;
}

.marketplace-card-head p {
  color: var(--color-muted);
  margin-top: var(--space-1);
}

.marketplace-title-row {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.marketplace-open-link {
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  display: inline-flex;
  flex: none;
  font-size: 0.9rem;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
  width: 28px;
}

.marketplace-open-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.marketplace-section-title {
  margin-top: var(--space-5);
}

.marketplace-description {
  border-top: 1px solid var(--color-border);
  color: #334155;
  font-size: 0.95rem;
  margin-top: var(--space-4);
  max-height: 220px;
  overflow: auto;
  padding-top: var(--space-4);
  white-space: normal;
}

.marketplace-facts {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: var(--space-4);
}

.marketplace-facts div {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
}

.marketplace-facts strong {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.marketplace-gallery {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x proximity;
  scrollbar-gutter: stable;
}

.marketplace-gallery img {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: block;
  flex: 0 0 138px;
  object-fit: cover;
  scroll-snap-align: start;
  width: 138px;
}

/* Unified Product Workspace Layout (ADR-005) */
.product-workspace {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.product-workspace-work {
  min-width: 0;
}

.product-workspace-reference {
  min-width: 0;
  max-width: 100%;
}

.product-data-context {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.product-data-context-summary,
.product-data-context-title,
.product-data-context-hint {
  min-width: 0;
}

.product-data-context-hint {
  overflow-wrap: anywhere;
}

.product-data-context-body {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.product-reference-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.product-reference-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  padding: var(--space-1) 0;
}

.product-reference-title {
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.stock-ledger-reference .stock-ledger-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.stock-ledger-source {
  font-weight: 600;
  line-height: 1.25;
}

.stock-ledger-time {
  font-size: 0.78rem;
  line-height: 1.2;
  margin-top: 2px;
}

@media (min-width: 1100px) {
  .product-workspace {
    grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
  }

  .product-workspace-reference {
    position: sticky;
    top: var(--space-4);
    max-height: calc(100vh - var(--space-6));
    overflow-y: auto;
  }
}

@media (max-width: 1099px) {
  .product-workspace {
    display: flex;
    flex-direction: column;
  }

  .product-workspace-reference {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 720px) {
  .product-detail-header {
    gap: var(--space-4);
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }

  .product-detail-media {
    aspect-ratio: 4 / 5;
    height: 220px;
    min-height: 0;
  }

  .product-detail-actions {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-3);
  }

  .product-detail-actions h2 {
    font-size: 1.15rem;
  }

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

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

  .publication-workbench-head {
    align-items: stretch;
    flex-direction: column;
  }

  .publication-workbench-head .btn {
    justify-content: center;
  }

  .publication-channel-grid {
    grid-template-columns: 1fr;
  }

  .product-updated-at {
    justify-items: start;
    text-align: left;
  }

  .stock-ledger-head {
    display: none;
  }

  .stock-ledger-row {
    gap: var(--space-1);
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
  }

  .product-summary-item {
    min-height: 68px;
    padding: var(--space-2) var(--space-3);
  }

  .product-summary-item strong {
    font-size: 1rem;
  }

  .product-detail-actions .btn {
    justify-content: center;
  }

  .product-tab-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0;
  }

  .product-tab {
    align-items: center;
    display: flex;
    font-size: 0.78rem;
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 0.35rem;
    text-align: center;
  }

  .card,
  .marketplace-card {
    padding: var(--space-4);
  }

  .card-header,
  .marketplace-card-head {
    display: grid;
    gap: var(--space-2);
  }

  .stock-location-grid,
  .marketplace-facts,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .marketplace-description {
    max-height: 180px;
  }

  .price-comparison-table,
  .price-comparison-table thead,
  .price-comparison-table tbody,
  .price-comparison-table tr,
  .price-comparison-table th,
  .price-comparison-table td {
    display: block;
  }

  .price-comparison-table thead {
    display: none;
  }

  .price-comparison-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .price-comparison-table tr:hover {
    background: transparent;
  }

  .price-comparison-table td {
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(112px, 38%) minmax(0, 1fr);
    min-height: 0;
    overflow-wrap: anywhere;
    padding: var(--space-2) var(--space-3);
  }

  .price-comparison-table td:last-child {
    border-bottom: 0;
  }

  .price-comparison-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .product-tab-panel .table-wrapper {
    overflow-x: visible;
  }

  .product-tab-panel table,
  .product-tab-panel thead,
  .product-tab-panel tbody,
  .product-tab-panel tr,
  .product-tab-panel th,
  .product-tab-panel td {
    display: block;
  }

  .product-tab-panel thead {
    display: none;
  }

  .product-tab-panel tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
  }

  .product-tab-panel tr:hover {
    background: transparent;
  }

  .product-tab-panel td {
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    min-height: 0;
    overflow-wrap: anywhere;
    padding: var(--space-2) var(--space-3);
  }

  .product-tab-panel td:last-child {
    border-bottom: 0;
  }

  .product-tab-panel td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .price-comparison-table {
    table-layout: auto;
  }

  .price-comparison-table th:first-child,
  .price-comparison-table td:first-child,
  .price-comparison-table th:last-child,
  .price-comparison-table td:last-child {
    width: auto;
  }
}

.product-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.85rem;
}

.product-checkbox-label input[type="checkbox"] {
  flex: none;
  width: auto;
  min-height: auto;
}

@media (max-width: 1000px) {
  .product-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }
  .product-table th,
  .product-table td {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .product-table th:nth-child(4),
  .product-table td:nth-child(4),
  .product-table th:nth-child(5),
  .product-table td:nth-child(5) {
    display: none;
  }

  .product-table th:nth-child(1),
  .product-table td:nth-child(1) { width: 45%; }
  .product-table th:nth-child(2),
  .product-table td:nth-child(2) { width: 14%; }
  .product-table th:nth-child(3),
  .product-table td:nth-child(3) { width: 16%; }
  .product-table th:nth-child(4),
  .product-table td:nth-child(4) { width: 0; }
  .product-table th:nth-child(6),
  .product-table td:nth-child(6) { width: 25%; }

  .product-identity-cell,
  .product-name,
  .product-row-actions {
    min-width: 0;
  }

  .product-row-actions {
    flex-wrap: nowrap;
    gap: 0.25rem;
  }

  .product-row-actions .btn {
    font-size: 0.72rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .product-stats {
    gap: 0.35rem 0;
  }

  .product-stat-item {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .product-stat-item:first-child {
    padding-left: 0;
  }

  .product-filter-primary {
    align-items: center;
    flex-wrap: wrap;
  }

  .product-filter-primary .btn {
    flex: none;
  }

  .product-category-link {
    justify-content: center;
  }

  .product-filter-secondary {
    align-items: flex-start;
  }

  .product-filter-toggles {
    align-items: flex-start;
  }

  .product-quick-filters {
    align-items: flex-start;
  }

  .product-filter-hint {
    line-height: 1.4;
  }
}

@media (max-width: 480px) {
  .product-filter-secondary {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

@media (max-width: 760px) {
  .header {
    align-items: flex-start;
    height: auto;
    padding: var(--space-3);
  }

  .header nav {
    gap: var(--space-2);
  }

  .container {
    padding: var(--space-4);
  }

  .page-header {
    display: grid;
  }

  .mc-op-table-wrap.table-wrapper {
    overflow-x: visible;
  }

  .mc-op-table.mc-op-table-external-unmapped,
  .mc-op-table.mc-op-table-conflicts {
    table-layout: auto;
  }

  .mc-op-table.mc-op-table-external-unmapped th,
  .mc-op-table.mc-op-table-external-unmapped td,
  .mc-op-table.mc-op-table-external-unmapped th:nth-child(n),
  .mc-op-table.mc-op-table-external-unmapped td:nth-child(n),
  .mc-op-table.mc-op-table-conflicts th,
  .mc-op-table.mc-op-table-conflicts td,
  .mc-op-table.mc-op-table-conflicts th:nth-child(n),
  .mc-op-table.mc-op-table-conflicts td:nth-child(n) {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .mc-op-table,
  .mc-op-table thead,
  .mc-op-table tbody,
  .mc-op-table tr,
  .mc-op-table th,
  .mc-op-table td {
    display: block;
  }

  .mc-op-table thead {
    display: none;
  }

  .mc-op-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
  }

  .mc-op-table tr:hover {
    background: transparent;
  }

  .mc-op-table td {
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(104px, 34%) minmax(0, 1fr);
    min-height: 0;
    overflow-wrap: anywhere;
    padding: var(--space-2) var(--space-3);
    width: auto;
  }

  .mc-op-table td:last-child {
    border-bottom: 0;
  }

  .mc-op-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    grid-row: 1 / -1;
    text-transform: uppercase;
  }

  .mc-op-table td > * {
    grid-column: 2;
  }

  .mc-op-table td.mc-op-actions {
    grid-template-columns: 1fr;
  }

  .mc-op-table td.mc-op-actions > * {
    grid-column: 1;
  }

  .mc-op-table .mc-op-actions .inline-form {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-2);
  }

  .mc-op-table .mc-op-actions .mc-op-action-form {
    align-items: flex-end;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .mc-op-table .mc-op-actions .mc-op-review-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .mc-op-table .mc-op-actions .mc-op-field {
    flex: 1 1 6rem;
    min-width: 6rem;
  }

  .mc-op-table .mc-op-actions .mc-op-action-form input[type="number"] {
    width: 100%;
  }

  .mc-op-table .mc-op-actions .mc-op-variant-field {
    flex: 1 1 100%;
    min-width: 0;
  }

  .mc-op-table .mc-op-actions .mc-op-variant-select {
    width: 100%;
  }

  .mc-op-table .mc-op-actions .btn {
    flex: 0 0 auto;
  }

  .mc-op-table .conflict-alias-list .text-muted {
    display: block;
    margin-top: 0.2rem;
  }

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

@media (max-width: 1100px) {
  .mc-op-table-wrap.table-wrapper:has(.mc-op-table-card-issues) {
    overflow-x: visible;
  }

  .mc-op-table.mc-op-table-card-issues {
    table-layout: auto;
  }

  .mc-op-table.mc-op-table-card-issues th,
  .mc-op-table.mc-op-table-card-issues td,
  .mc-op-table.mc-op-table-card-issues th:nth-child(n),
  .mc-op-table.mc-op-table-card-issues td:nth-child(n) {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .mc-op-table-card-issues,
  .mc-op-table-card-issues thead,
  .mc-op-table-card-issues tbody,
  .mc-op-table-card-issues tr,
  .mc-op-table-card-issues th,
  .mc-op-table-card-issues td {
    display: block;
  }

  .mc-op-table-card-issues thead {
    display: none;
  }

  .mc-op-table-card-issues tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
  }

  .mc-op-table-card-issues tr:hover {
    background: transparent;
  }

  .mc-op-table-card-issues td {
    align-items: flex-start;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(132px, 28%) minmax(0, 1fr);
    min-height: 0;
    overflow-wrap: anywhere;
    padding: var(--space-2) var(--space-3);
    width: auto;
  }

  .mc-op-table-card-issues td:last-child {
    border-bottom: 0;
  }

  .mc-op-table-card-issues td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    grid-row: 1 / -1;
    text-transform: uppercase;
  }

  .mc-op-table-card-issues td > * {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  .master-card-page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-3);
  }

  .master-card-page-meta {
    align-items: flex-start;
    justify-items: start;
    white-space: normal;
  }

  .master-card-source,
  .master-card-editor,
  .master-card-channels {
    padding: var(--space-4);
  }

  .master-card-section-head {
    flex-direction: column;
    gap: var(--space-2);
  }

  .master-card-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-card-form-grid {
    grid-template-columns: 1fr;
  }

  .master-card-logistics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-card-field-wide {
    grid-column: auto;
  }

  .master-card-channel-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }

  .master-card-channel-heading,
  .master-card-channel-status-line,
  .master-card-channel-next-step,
  .master-card-channel-checklist,
  .master-card-channel-category-editor {
    grid-column: auto;
    grid-row: auto;
  }

  .master-card-channel-category-editor {
    margin-top: var(--space-2);
  }

  .master-card-channel-result {
    display: grid;
    gap: var(--space-1);
    grid-column: auto;
    grid-row: auto;
    justify-items: start;
  }

  .master-card-channel-result {
    align-items: flex-start;
    justify-items: start;
  }

  .master-card-channel-status-line,
  .master-card-channel-counts {
    justify-content: flex-start;
  }

  .master-card-channel-category {
    text-align: left;
  }

  .master-card-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .master-card-form-actions .btn {
    justify-content: center;
  }
}
