/* ==========================================================================
   IPMCKart Merchant Design System — UI Component Library
   Scoped entirely under .mrx to beat legacy styles cleanly.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Resets & Utilities (Scoped under .mrx)
   -------------------------------------------------------------------------- */
.mrx,
.mrx * {
  box-sizing: border-box;
}

.mrx {
  font-family: var(--font-sys);
  font-size: var(--fs-15);
  line-height: var(--lh-body);
  color: var(--ink);
  background-color: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mrx div,
.mrx section,
.mrx article,
.mrx header,
.mrx footer,
.mrx main,
.mrx form,
.mrx fieldset,
.mrx label,
.mrx input,
.mrx select,
.mrx textarea,
.mrx button,
.mrx p,
.mrx span,
.mrx td,
.mrx th {
  min-width: 0;
}

/* Numeric & Text Wraps */
.mrx .m-num,
.mrx .m-price,
.mrx .m-table td,
.mrx .m-stat__value,
.mrx [data-tabular="true"] {
  font-variant-numeric: tabular-nums;
}

.mrx .m-wrap-anywhere,
.mrx .m-product-name,
.mrx .m-email,
.mrx .m-filename,
.mrx .m-mono {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mrx .m-mono {
  font-family: var(--font-mono);
}

/* Focus Visible Reset */
.mrx :focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Visually Hidden Pattern (for accessibility, accessible tables behind charts) */
.mrx .m-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Icon Sprite Slot */
.mrx .m-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
  flex-shrink: 0;
  fill: currentColor;
  stroke: currentColor;
}

.mrx .m-icon--sm {
  width: 18px;
  height: 18px;
}

.mrx .m-icon--lg {
  width: 32px;
  height: 32px;
}

/* --------------------------------------------------------------------------
   1. Buttons (m-btn)
   Primary buttons are ink (#16191d), NEVER red. Red is accent-only.
   -------------------------------------------------------------------------- */
.mrx .m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 42px;
  padding: 0 var(--s-5);
  font-family: var(--font-sys);
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background-color: var(--ink);
  color: var(--surface);
  transition: background-color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  user-select: none;
}

.mrx .m-btn:hover {
  background-color: var(--ink-2);
  color: var(--surface);
}

.mrx .m-btn:active {
  transform: scale(0.985);
}

.mrx .m-btn:focus-visible {
  box-shadow: var(--ring-ink);
}

/* Button Variants */
.mrx .m-btn--primary {
  background-color: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.mrx .m-btn--primary:hover {
  background-color: var(--ink-2);
  border-color: var(--ink-2);
}

.mrx .m-btn--secondary {
  background-color: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.mrx .m-btn--secondary:hover {
  background-color: var(--surface-2);
  border-color: var(--ink-3);
}

.mrx .m-btn--quiet {
  background-color: transparent;
  color: var(--ink-3);
  border-color: transparent;
}

.mrx .m-btn--quiet:hover {
  background-color: var(--canvas-2);
  color: var(--ink);
}

.mrx .m-btn--danger {
  background-color: var(--surface);
  color: var(--accent-ink);
  border-color: var(--accent-ring);
}

.mrx .m-btn--danger:hover {
  background-color: var(--accent-soft);
  border-color: var(--accent-ink);
}

.mrx .m-btn--danger:focus-visible {
  box-shadow: var(--ring);
}

/* Button Sizes */
/* Desktop-console-only sm size: 34px height, fs-13 */
.mrx .m-btn--sm {
  min-height: 34px;
  padding: 0 var(--s-3);
  font-size: var(--fs-13);
  border-radius: var(--r-xs);
}

.mrx .m-btn--md {
  min-height: 42px;
  padding: 0 var(--s-5);
  font-size: var(--fs-15);
  border-radius: var(--r-sm);
}

.mrx .m-btn--lg {
  min-height: 52px;
  padding: 0 var(--s-6);
  font-size: var(--fs-17);
  border-radius: var(--r-md);
}

/* Button States: Disabled & Loading */
/* NOTE: Disabled buttons MUST include title and aria-describedby attributes in HTML to explain why disabled */
.mrx .m-btn:disabled,
.mrx .m-btn.m-btn--disabled {
  background-color: var(--canvas-2);
  color: var(--muted-3);
  border-color: transparent;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.mrx .m-btn--loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.mrx .m-btn--loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-top: -9px;
  margin-left: -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: m-spin 0.6s linear infinite;
}

.mrx .m-btn--secondary.m-btn--loading::after,
.mrx .m-btn--quiet.m-btn--loading::after {
  border-color: rgba(22, 25, 29, 0.15);
  border-top-color: var(--ink);
}

.mrx .m-btn--danger.m-btn--loading::after {
  border-color: rgba(192, 5, 15, 0.15);
  border-top-color: var(--accent-ink);
}

@keyframes m-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   2. Status Pills & Badges (m-pill)
   -------------------------------------------------------------------------- */
.mrx .m-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: var(--font-sys);
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--r-pill);
  background-color: var(--quiet-soft);
  color: var(--quiet);
  white-space: nowrap;
}

.mrx .m-pill__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;
}

.mrx .m-pill--green {
  background-color: var(--green-soft);
  color: var(--green-ink);
}

.mrx .m-pill--green .m-pill__dot {
  background-color: var(--green);
}

.mrx .m-pill--gold {
  background-color: var(--gold-soft);
  color: var(--gold-ink);
}

.mrx .m-pill--gold .m-pill__dot {
  background-color: var(--gold);
}

.mrx .m-pill--blue {
  background-color: var(--blue-soft);
  color: var(--blue-ink);
}

.mrx .m-pill--blue .m-pill__dot {
  background-color: var(--blue);
}

.mrx .m-pill--accent {
  background-color: var(--accent-soft);
  color: var(--accent-ink);
}

.mrx .m-pill--accent .m-pill__dot {
  background-color: var(--accent);
}

.mrx .m-pill--quiet {
  background-color: var(--quiet-soft);
  color: var(--quiet);
}

.mrx .m-pill--quiet .m-pill__dot {
  background-color: var(--quiet);
}

/* --------------------------------------------------------------------------
   3. Cards & Containers (m-card)
   -------------------------------------------------------------------------- */
.mrx .m-card {
  background-color: var(--surface);
  border-radius: var(--r-md);
  padding: var(--card-pad);
  box-shadow: var(--e-1);
  display: flex;
  flex-direction: column;
  gap: var(--stack);
}

.mrx .m-card--primary {
  box-shadow: var(--e-2);
}

.mrx .m-card--flat {
  box-shadow: none;
  border: 1px solid var(--line);
}

.mrx .m-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line-soft);
}

.mrx .m-card__title {
  font-size: var(--fs-17);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  line-height: var(--lh-tight);
}

.mrx .m-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  flex: 1;
}

.mrx .m-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   4. Stat Blocks & Grid (m-stat, m-stat-row)
   Never horizontal scroll; 4/2/2 grid across desktop/tablet/mobile.
   -------------------------------------------------------------------------- */
.mrx .m-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  width: 100%;
}

@media (max-width: 900px) {
  .mrx .m-stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .mrx .m-stat-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mrx .m-stat {
  background-color: var(--surface);
  border-radius: var(--r-md);
  padding: var(--s-5);
  box-shadow: var(--e-1);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.mrx .m-stat__label {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--muted);
  line-height: var(--lh-tight);
}

.mrx .m-stat__value {
  font-size: var(--fs-30);
  font-weight: 700;
  color: var(--ink);
  line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}

.mrx .m-stat__sub {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-12);
  color: var(--muted-2);
}

.mrx .m-stat__delta--up {
  color: var(--green-ink);
  font-weight: 600;
}

.mrx .m-stat__delta--down {
  color: var(--accent-ink);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   5. Form Controls & Fields (m-field)
   Sentence-case labels. Help text ABOVE input. Minimum 44px touch targets.
   -------------------------------------------------------------------------- */
.mrx .m-field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  width: 100%;
}

.mrx .m-field__label {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--ink);
  line-height: var(--lh-tight);
  text-transform: none; /* Enforce sentence-case */
}

.mrx .m-field__help {
  font-size: var(--fs-13);
  color: var(--muted);
  line-height: var(--lh-tight);
  margin-bottom: var(--s-1);
}

.mrx .m-field__input,
.mrx .m-field__select,
.mrx .m-field__textarea {
  min-height: 46px;
  width: 100%;
  padding: 0 var(--s-4);
  font-family: var(--font-sys);
  font-size: var(--fs-15);
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.mrx .m-field__textarea {
  padding: var(--s-3) var(--s-4);
  min-height: 100px;
  line-height: var(--lh-body);
  resize: vertical;
}

.mrx .m-field__input:focus,
.mrx .m-field__select:focus,
.mrx .m-field__textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--ring-ink);
}

/* Error State */
.mrx .m-field--error .m-field__input,
.mrx .m-field--error .m-field__select,
.mrx .m-field--error .m-field__textarea {
  border-color: var(--accent);
}

.mrx .m-field--error .m-field__input:focus,
.mrx .m-field--error .m-field__select:focus,
.mrx .m-field--error .m-field__textarea:focus {
  box-shadow: var(--ring);
}

.mrx .m-field__error {
  font-size: var(--fs-13);
  color: var(--accent-ink);
  font-weight: 500;
  margin-top: var(--s-1);
}

/* Money Input Variant (m-field--money) */
.mrx .m-field--money {
  position: relative;
}

.mrx .m-field--money .m-field__box {
  position: relative;
  display: flex;
  align-items: center;
}

.mrx .m-field--money .m-field__prefix {
  position: absolute;
  left: var(--s-4);
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.mrx .m-field--money .m-field__input {
  padding-left: 56px;
  font-variant-numeric: tabular-nums;
}

/* Stepper Variant (m-field--stepper) */
.mrx .m-field--stepper .m-field__box {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.mrx .m-field--stepper .m-field__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
  font-size: var(--fs-20);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--t-fast) var(--ease);
}

.mrx .m-field--stepper .m-field__btn:hover {
  background-color: var(--canvas-2);
}

.mrx .m-field--stepper .m-field__input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* OTP Box Variant (m-field--otp) */
.mrx .m-field--otp .m-field__boxes {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-start;
}

.mrx .m-field--otp .m-field__box-item {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-20);
  font-weight: 700;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.mrx .m-field--otp .m-field__box-item:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--ring-ink);
}

/* --------------------------------------------------------------------------
   6. Segmented Controls (m-segment)
   -------------------------------------------------------------------------- */
.mrx .m-segment {
  display: inline-flex;
  padding: 3px;
  background-color: var(--canvas-2);
  border-radius: var(--r-sm);
  gap: 2px;
}

.mrx .m-segment__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 var(--s-4);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
  user-select: none;
  text-decoration: none;
}

.mrx .m-segment__item:hover {
  color: var(--ink);
}

.mrx .m-segment__item--active,
.mrx .m-segment__item[aria-selected="true"] {
  background-color: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--e-1);
}

/* --------------------------------------------------------------------------
   7. Choice Lists (m-choice-list)
   -------------------------------------------------------------------------- */
.mrx .m-choice-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  width: 100%;
}

.mrx .m-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  padding: var(--s-4);
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.mrx .m-choice:hover {
  border-color: var(--ink-3);
}

.mrx .m-choice--selected,
.mrx .m-choice:has(input:checked) {
  border-color: var(--ink);
  box-shadow: var(--ring-ink);
}

.mrx .m-choice__radio,
.mrx .m-choice__checkbox {
  margin-top: 3px;
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
  cursor: pointer;
}

.mrx .m-choice__content {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.mrx .m-choice__title {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--ink);
}

.mrx .m-choice__desc {
  font-size: var(--fs-13);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   8. Toggle Switch (m-toggle)
   Exact size: 44px x 26px
   -------------------------------------------------------------------------- */
.mrx .m-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.mrx .m-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mrx .m-toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line-strong);
  transition: var(--t-fast) var(--ease);
  border-radius: var(--r-pill);
}

.mrx .m-toggle__slider::before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: var(--surface);
  transition: var(--t-fast) var(--ease);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(22, 25, 29, 0.2);
}

.mrx .m-toggle input:checked + .m-toggle__slider {
  background-color: var(--ink);
}

.mrx .m-toggle input:checked + .m-toggle__slider::before {
  transform: translateX(18px);
}

.mrx .m-toggle input:focus-visible + .m-toggle__slider {
  box-shadow: var(--ring-ink);
}

/* --------------------------------------------------------------------------
   9. Tables & Rows (m-table, m-rows)
   Sticky header, 44px row height, line dividers, tabular numeric right-aligned.
   Below 720px: transforms table into cards/rows layout.
   -------------------------------------------------------------------------- */
.mrx .m-table-wrap {
  width: 100%;
  overflow-x: auto;
  background-color: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--e-1);
}

.mrx .m-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--fs-14);
}

.mrx .m-table th {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 600;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  text-transform: none; /* Enforce sentence-case */
}

.mrx .m-table td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  min-height: 44px;
  vertical-align: middle;
}

.mrx .m-table tr:last-child td {
  border-bottom: none;
}

.mrx .m-table .m-cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mrx .m-table a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.mrx .m-table a:hover {
  text-decoration: underline;
}

/* Row-band Layout (m-rows) */
.mrx .m-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: 100%;
}

.mrx .m-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 76px;
  padding: var(--s-3) var(--s-4);
  background-color: var(--surface);
  border-radius: var(--r-sm);
  box-shadow: var(--e-1);
}

.mrx .m-row__thumb {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: var(--r-xs);
  object-fit: cover;
  background-color: var(--canvas-2);
  flex-shrink: 0;
}

.mrx .m-row__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.mrx .m-row__title {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--ink);
}

.mrx .m-row__sub {
  font-size: var(--fs-13);
  color: var(--muted);
}

.mrx .m-row__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* Below 720px Table-to-Rows Transformation */
@media (max-width: 720px) {
  .mrx .m-table-responsive th {
    display: none;
  }
  .mrx .m-table-responsive td {
    display: block;
    text-align: right;
    padding: var(--s-2) var(--s-3);
    border-bottom: none;
  }
  .mrx .m-table-responsive td::before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    color: var(--muted);
    font-size: var(--fs-12);
  }
  .mrx .m-table-responsive tr {
    display: block;
    padding: var(--s-3);
    border-bottom: 1px solid var(--line);
    background-color: var(--surface);
    margin-bottom: var(--s-2);
    border-radius: var(--r-sm);
    box-shadow: var(--e-1);
  }
}

/* --------------------------------------------------------------------------
   10. Empty State (m-empty)
   -------------------------------------------------------------------------- */
.mrx .m-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--section) var(--s-6);
  background-color: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--e-1);
  gap: var(--s-3);
}

.mrx .m-empty__icon {
  width: 56px;
  height: 56px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mrx .m-empty__title {
  font-size: var(--fs-17);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.mrx .m-empty__text {
  font-size: var(--fs-14);
  color: var(--muted);
  max-width: 400px;
  margin: 0;
}

/* --------------------------------------------------------------------------
   11. Skeleton Loaders (m-skel)
   -------------------------------------------------------------------------- */
.mrx .m-skel {
  background: linear-gradient(90deg, var(--canvas-2) 25%, var(--canvas) 50%, var(--canvas-2) 75%);
  background-size: 200% 100%;
  animation: m-shimmer 1.5s infinite;
  border-radius: var(--r-xs);
  display: inline-block;
  height: 1em;
  width: 100%;
}

.mrx .m-skel--text { height: 14px; width: 80%; }
.mrx .m-skel--title { height: 24px; width: 40%; }
.mrx .m-skel--thumb { height: 56px; width: 56px; border-radius: var(--r-xs); }
.mrx .m-skel--btn { height: 42px; width: 120px; border-radius: var(--r-sm); }

@keyframes m-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mrx .m-skel {
    animation: none;
    background: var(--canvas-2);
  }
}

/* --------------------------------------------------------------------------
   12. Banner / Callouts (m-banner)
   Soft-bg only; 20px icon; bold first line.
   -------------------------------------------------------------------------- */
.mrx .m-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-sm);
  background-color: var(--quiet-soft);
  color: var(--ink);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
}

.mrx .m-banner__icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.mrx .m-banner__content {
  flex: 1;
}

.mrx .m-banner__title {
  font-weight: 600;
  margin-bottom: 2px;
}

.mrx .m-banner--green {
  background-color: var(--green-soft);
  color: var(--green-ink);
}

.mrx .m-banner--gold {
  background-color: var(--gold-soft);
  color: var(--gold-ink);
}

.mrx .m-banner--blue {
  background-color: var(--blue-soft);
  color: var(--blue-ink);
}

.mrx .m-banner--accent {
  background-color: var(--accent-soft);
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   13. Modals & Bottom Sheets (m-modal, m-sheet)
   Modal: desktop centered 480px e-4.
   Sheet: mobile bottom sheet, top corners r-lg, t-slow travel transform.
   NOTE: Modal trigger elements must manage aria-expanded/aria-controls and trap focus.
   -------------------------------------------------------------------------- */
.mrx .m-scrim {
  position: fixed;
  inset: 0;
  background-color: var(--overlay);
  z-index: var(--z-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}

.mrx .m-scrim--open {
  opacity: 1;
  pointer-events: auto;
}

.mrx .m-modal {
  background-color: var(--surface);
  width: 100%;
  max-width: 480px;
  border-radius: var(--r-lg);
  box-shadow: var(--e-4);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: var(--stack);
  z-index: var(--z-modal);
  transform: scale(0.95);
  transition: transform var(--t-base) var(--ease);
}

.mrx .m-scrim--open .m-modal {
  transform: scale(1);
}

/* Mobile Bottom Sheet (m-sheet) */
@media (max-width: 640px) {
  .mrx .m-scrim--sheet {
    align-items: flex-end;
    padding: 0;
  }

  .mrx .m-sheet {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%);
    transition: transform var(--t-slow) var(--ease-out);
  }

  .mrx .m-scrim--open .m-sheet {
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   14. Toast Notifications (m-toast)
   Ink bg, white text, 4s duration, role="status".
   Mobile: bottom-center above nav/tab bar. Desktop: bottom-right.
   -------------------------------------------------------------------------- */
.mrx .m-toast {
  position: fixed;
  z-index: var(--z-toast);
  background-color: var(--ink);
  color: var(--surface);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-sm);
  font-size: var(--fs-14);
  font-weight: 500;
  box-shadow: var(--e-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  bottom: var(--s-6);
  right: var(--s-6);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}

.mrx .m-toast--show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .mrx .m-toast {
    right: 50%;
    transform: translate(50%, 20px);
    bottom: calc(var(--s-6) + 60px); /* Above mobile bottom tab bar */
    width: max-content;
    max-width: calc(100vw - 32px);
  }

  .mrx .m-toast--show {
    transform: translate(50%, 0);
  }
}

/* --------------------------------------------------------------------------
   15. Progress Steps (m-steps)
   -------------------------------------------------------------------------- */
.mrx .m-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  gap: var(--s-2);
}

.mrx .m-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  position: relative;
  z-index: 1;
  flex: 1;
}

.mrx .m-step__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-12);
  font-weight: 600;
  background-color: var(--surface);
  border: 2px solid var(--line-strong);
  color: var(--muted);
  transition: var(--t-fast) var(--ease);
}

.mrx .m-step--complete .m-step__dot {
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.mrx .m-step--current .m-step__dot {
  border-color: var(--accent);
  box-shadow: var(--ring);
  color: var(--accent-ink);
}

.mrx .m-step__label {
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.mrx .m-step--current .m-step__label {
  color: var(--ink);
  font-weight: 600;
}

.mrx .m-steps__connector {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--line);
  z-index: 0;
}

@media (max-width: 640px) {
  .mrx .m-step__label {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* --------------------------------------------------------------------------
   16. Error View Block (m-error)
   -------------------------------------------------------------------------- */
.mrx .m-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--section) var(--s-6);
  background-color: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--e-1);
  gap: var(--s-4);
}

.mrx .m-error__title {
  font-size: var(--fs-20);
  font-weight: 700;
  color: var(--accent-ink);
  margin: 0;
}

.mrx .m-error__text {
  font-size: var(--fs-14);
  color: var(--muted);
  max-width: 420px;
  margin: 0;
}

/* --------------------------------------------------------------------------
   17. Audit Log & Timeline (m-log)
   -------------------------------------------------------------------------- */
.mrx .m-log {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  position: relative;
  padding-left: var(--s-5);
}

.mrx .m-log::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background-color: var(--line);
}

.mrx .m-log__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.mrx .m-log__dot {
  position: absolute;
  left: -21px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--ink-3);
}

.mrx .m-log__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.mrx .m-log__actor {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink);
}

.mrx .m-log__time {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--muted-2);
}

.mrx .m-log__note {
  background-color: var(--surface-2);
  padding: var(--s-3);
  border-radius: var(--r-xs);
  font-size: var(--fs-13);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   18. Sparkline & Bar Chart Hooks (m-spark, m-bars)
   -------------------------------------------------------------------------- */
.mrx .m-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  height: 120px;
  padding-top: var(--s-4);
  width: 100%;
}

.mrx .m-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: var(--s-1);
}

.mrx .m-bar {
  width: 100%;
  background-color: rgba(22, 25, 29, 0.20);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  transition: height var(--t-base) var(--ease);
}

.mrx .m-bar--max,
.mrx .m-bar:hover {
  background-color: var(--ink);
}

.mrx .m-bar-label {
  font-size: var(--fs-11);
  color: var(--muted-2);
}

.mrx .m-spark {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  width: 60px;
}

.mrx .m-spark__bar {
  flex: 1;
  background-color: rgba(22, 25, 29, 0.25);
  border-radius: 1px 1px 0 0;
}

.mrx .m-spark__bar--highlight {
  background-color: var(--ink);
}

/* --------------------------------------------------------------------------
   19. Listing Preview Hooks (m-preview--card, m-preview--page)
   -------------------------------------------------------------------------- */
.mrx .m-preview--card {
  background-color: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  box-shadow: var(--e-1);
}

.mrx .m-preview--page {
  background-color: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--e-2);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* --------------------------------------------------------------------------
   20. Identity & Document Viewer (m-idview)
   -------------------------------------------------------------------------- */
.mrx .m-idview {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  width: 100%;
}

.mrx .m-idview__well {
  background-color: var(--canvas-2);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  overflow: hidden;
  position: relative;
}

.mrx .m-idview__img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--r-xs);
  transition: transform var(--t-base) var(--ease);
}

.mrx .m-idview__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}

/* --------------------------------------------------------------------------
   21. Studio Shell — persistent left rail (desktop/tablet) + bottom tab bar (mobile)
   Spec §3.5: labels always visible, 44px targets, no burger on studio pages.
   -------------------------------------------------------------------------- */
.mrx .m-studio {
  display: flex;
  min-height: 100vh;
  background-color: var(--canvas);
}

/* Left rail */
.mrx .m-rail {
  width: 248px;
  flex: 0 0 248px;
  background-color: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: var(--z-nav);
}

.mrx .m-rail__brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
}

.mrx .m-rail__brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background-color: var(--ink);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-17);
  flex: 0 0 38px;
}

.mrx .m-rail__brand b {
  font-size: var(--fs-15);
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.mrx .m-rail__brand small {
  font-size: var(--fs-11);
  color: var(--muted-2);
  font-weight: 500;
}

.mrx .m-rail__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-3);
  gap: 2px;
  overflow-y: auto;
}

.mrx .m-rail__link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 11px var(--s-3);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--ink-3);
  font-size: var(--fs-15);
  font-weight: 500;
  min-height: 44px;
  position: relative;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.mrx .m-rail__link:hover {
  background-color: var(--canvas-2);
  color: var(--ink);
}

.mrx .m-rail__link[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  background-color: var(--canvas-2);
}

/* The one allowed red surface: the active-nav accent bar */
.mrx .m-rail__link[aria-current="page"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background-color: var(--accent);
}

.mrx .m-rail__link i {
  width: 18px;
  text-align: center;
  font-size: var(--fs-15);
  flex: 0 0 18px;
}

.mrx .m-rail__divider {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: var(--s-3) var(--s-2);
}

.mrx .m-rail__foot {
  padding: var(--s-4);
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.mrx .m-rail__who {
  font-size: var(--fs-13);
  color: var(--ink);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 20px;
}

.mrx .m-rail__who i {
  color: var(--green);
  font-size: var(--fs-11);
}

.mrx .m-rail__foot a {
  font-size: var(--fs-13);
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 0;
  min-height: 36px;
}

.mrx .m-rail__foot a:hover {
  color: var(--ink);
}

/* Tablet rail: narrowed, labels stay visible (11px under icon) */
@media (min-width: 720px) and (max-width: 1079px) {
  .mrx .m-rail {
    width: 88px;
    flex: 0 0 88px;
  }
  .mrx .m-rail__brand {
    justify-content: center;
    padding: var(--s-4) 0;
  }
  .mrx .m-rail__brand b,
  .mrx .m-rail__brand small {
    display: none;
  }
  .mrx .m-rail__link {
    flex-direction: column;
    gap: 2px;
    padding: 8px 2px;
    text-align: center;
    font-size: var(--fs-11);
    min-height: 52px;
  }
  .mrx .m-rail__link i {
    font-size: var(--fs-17);
    width: auto;
    flex: none;
  }
  .mrx .m-rail__link[aria-current="page"]::before {
    left: auto;
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 2px;
  }
  .mrx .m-rail__foot .m-rail__who,
  .mrx .m-rail__foot a span {
    display: none;
  }
  .mrx .m-rail__foot a {
    justify-content: center;
    font-size: var(--fs-15);
  }
}

/* Studio content column */
.mrx .m-studio__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mrx .m-studio__page {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--s-8) var(--page-pad) var(--s-20);
}

.mrx .m-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-8);
}

.mrx .m-page-head h1 {
  font-size: var(--fs-30);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  margin: 0 0 4px;
}

.mrx .m-page-head p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-15);
  max-width: 62ch;
}

/* Bottom tab bar — mobile only (<720px) */
.mrx .m-tabbar {
  display: none;
}

@media (max-width: 719px) {
  .mrx .m-rail {
    display: none;
  }
  .mrx .m-studio {
    flex-direction: column;
  }
  .mrx .m-studio__page {
    padding: var(--s-5) var(--s-4) calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .mrx .m-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background-color: var(--surface);
    border-top: 1px solid var(--line);
    z-index: var(--z-nav);
    align-items: stretch;
  }
  .mrx .m-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--muted-2);
    font-size: var(--fs-11);
    font-weight: 500;
    min-height: 56px;
  }
  .mrx .m-tabbar__item i {
    font-size: var(--fs-17);
  }
  .mrx .m-tabbar__item[aria-current="page"] {
    color: var(--accent-ink);
    font-weight: 600;
  }
  .mrx .m-tabbar__item--add {
    flex: 0 0 64px;
  }
  .mrx .m-tabbar__add {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--ink);
    color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-20);
    margin-top: -18px;
    border: 4px solid var(--canvas);
    text-decoration: none;
    box-shadow: var(--e-2);
  }
  .mrx .m-page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-3);
  }
  .mrx .m-page-head h1 {
    font-size: var(--fs-24);
  }
}

/* --------------------------------------------------------------------------
   22. Console Shell — sticky top header, no sidebar (review pages)
   -------------------------------------------------------------------------- */
.mrx .m-console {
  min-height: 100vh;
  background-color: var(--canvas);
}

.mrx .m-console__top {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background-color: var(--surface);
  border-bottom: 1px solid var(--line);
  height: 64px;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 0 var(--page-pad);
}

.mrx .m-console__top a.m-console__back {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-13);
  font-weight: 500;
  min-height: 44px;
}

.mrx .m-console__top a.m-console__back:hover {
  color: var(--ink);
}

.mrx .m-console__wordmark {
  font-size: var(--fs-17);
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.mrx .m-console__wordmark > i {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-size: var(--fs-13);
}
.mrx .m-console__wordmark span {
  font-size: var(--fs-15);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
}

.mrx .m-console__tabs {
  display: flex;
  gap: var(--s-1);
  margin-left: var(--s-4);
}

.mrx .m-console__tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--r-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-14);
  font-weight: 500;
}

.mrx .m-console__tab:hover {
  color: var(--ink);
  background-color: var(--canvas-2);
}

.mrx .m-console__tab[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  background-color: var(--canvas-2);
  position: relative;
}

.mrx .m-console__tab[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: var(--s-4);
  right: var(--s-4);
  bottom: -1px;
  height: 2px;
  background-color: var(--accent);
  border-radius: 2px;
}

.mrx .m-console__tab-count {
  background-color: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-11);
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 1px 7px;
}

.mrx .m-console__search {
  flex: 1;
  max-width: 320px;
  margin-left: auto;
}

.mrx .m-console__who {
  font-size: var(--fs-13);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.mrx .m-console__page {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--s-8) var(--page-pad) var(--s-16);
}

@media (max-width: 719px) {
  .mrx .m-console__top {
    height: auto;
    flex-wrap: wrap;
    padding: var(--s-2) var(--s-4);
    gap: var(--s-2);
  }
  .mrx .m-console__wordmark {
    font-size: var(--fs-15);
  }
  .mrx .m-console__tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .mrx .m-console__who {
    display: none;
  }
}

/* Studio page header action row */
.mrx .m-page-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* Section label used above grouped blocks */
.mrx .m-section-label {
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--muted);
  margin: var(--s-6) 0 var(--s-3);
}

.mrx .m-section-label:first-child {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   23. Studio JS-generated fragments (sp-* / ms-banner)
   The studio pages share one JS module that renders product rows, sales rows,
   the revenue chart, banners and status chips. These styles dress that
   generated markup in the light premium system so the shared JS stays intact.
   -------------------------------------------------------------------------- */
.mrx .ms-banner {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
  margin-bottom: var(--s-5);
  border: 1px solid var(--line);
  background-color: var(--surface);
  box-shadow: var(--e-1);
}
.mrx .ms-banner > i {
  margin-top: 2px;
  font-size: var(--fs-15);
  flex: 0 0 auto;
}
.mrx .ms-banner b {
  font-weight: 600;
  color: var(--ink);
}
.mrx .ms-banner a {
  color: var(--accent-ink);
  font-weight: 600;
}
.mrx .ms-banner.success > i { color: var(--green); }
.mrx .ms-banner.info > i { color: var(--blue); }
.mrx .ms-banner.warn > i { color: var(--gold); }
.mrx .ms-banner.error > i { color: var(--accent); }

/* Status chip (sales rows) */
.mrx .sp-sale-status {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background-color: var(--quiet-soft);
  color: var(--quiet);
  white-space: nowrap;
}
.mrx .sp-sale-status.placed { background-color: var(--blue-soft); color: var(--blue-ink); }
.mrx .sp-sale-status.paid { background-color: var(--green-soft); color: var(--green-ink); }
.mrx .sp-sale-status.shipped { background-color: var(--gold-soft); color: var(--gold-ink); }
.mrx .sp-sale-status.delivered { background-color: var(--green-soft); color: var(--green-ink); }
.mrx .sp-sale-status.cancelled { background-color: var(--quiet-soft); color: var(--quiet); }

/* Empty states */
.mrx .sp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  text-align: center;
  color: var(--muted-2);
  font-size: var(--fs-13);
  padding: var(--s-10) var(--s-5);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background-color: var(--surface-2);
}
.mrx .sp-empty i { font-size: var(--fs-24); color: var(--muted-3); }
.mrx .sp-empty.sm {
  padding: var(--s-6) var(--s-4);
  font-size: var(--fs-12);
  border: none;
  background: transparent;
}

/* Product rows (catalog + overview limited list) */
.mrx .sp-subrow {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-subrow:last-child { border-bottom: none; }
.mrx .sp-sub-thumb {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: var(--r-sm);
  background-color: var(--canvas-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted-3);
}
.mrx .sp-sub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mrx .sp-subinfo { flex: 1; min-width: 0; }
.mrx .sp-subinfo b { display: block; font-size: var(--fs-14); font-weight: 600; color: var(--ink); }
.mrx .sp-subinfo small { font-size: var(--fs-12); color: var(--muted-2); }
.mrx .sp-sub-note {
  display: block;
  margin-top: 2px;
  color: var(--gold-ink);
  font-size: var(--fs-12);
}
.mrx .sp-sub-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
  flex: 0 0 auto;
  /* The overview rows carry an Edit link plus a status badge; wrapping keeps
     both readable in a narrow column instead of clipping the badge. */
  flex-wrap: wrap;
  max-width: 60%;
}
@media (max-width: 520px) {
  .mrx .sp-sub-right { max-width: 100%; align-items: flex-start; }
}
.mrx .sp-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.mrx .sp-badge.approved { background-color: var(--green-soft); color: var(--green-ink); }
.mrx .sp-badge.pending, .mrx .sp-badge.under_review { background-color: var(--blue-soft); color: var(--blue-ink); }
.mrx .sp-badge.changes_requested, .mrx .sp-badge.rejected { background-color: var(--accent-soft); color: var(--accent-ink); }
.mrx .sp-badge.archived, .mrx .sp-badge.draft { background-color: var(--quiet-soft); color: var(--quiet); }
.mrx .sp-edit {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mrx .sp-edit:hover { text-decoration: underline; }

/* Sales rows */
.mrx .sp-sale-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-sale-row:last-child { border-bottom: none; }
.mrx .sp-sale-img {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background-color: var(--canvas-2);
}
.mrx .sp-sale-main { flex: 1; min-width: 0; }
.mrx .sp-sale-name { display: block; font-size: var(--fs-14); font-weight: 600; color: var(--ink); }
.mrx .sp-sale-meta { font-size: var(--fs-12); color: var(--muted-2); }
.mrx .sp-sale-cust { color: var(--muted); }
.mrx .sp-sale-time { display: block; font-size: var(--fs-11); color: var(--muted-3); margin-top: 2px; }
.mrx .sp-sale-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-1);
  flex: 0 0 auto;
}
.mrx .sp-sale-total { font-size: var(--fs-14); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Top products */
.mrx .sp-top-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-top-row:last-child { border-bottom: none; }
.mrx .sp-top-rank {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background-color: var(--canvas-2);
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mrx .sp-top-img {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: var(--r-xs);
  object-fit: cover;
  background-color: var(--canvas-2);
}
.mrx .sp-top-main { flex: 1; min-width: 0; }
.mrx .sp-top-main b { display: block; font-size: var(--fs-13); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrx .sp-top-main span { font-size: var(--fs-12); color: var(--muted-2); }
.mrx .sp-top-rev { font-size: var(--fs-13); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Low stock rows */
.mrx .sp-low-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-low-row:last-child { border-bottom: none; }
.mrx .sp-low-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--gold);
  flex: 0 0 8px;
}
.mrx .sp-low-row b { flex: 1; font-size: var(--fs-13); font-weight: 500; color: var(--ink); }
.mrx .sp-low-n { font-size: var(--fs-12); color: var(--gold-ink); font-weight: 600; }

/* Insight rows */
.mrx .sp-ins-row {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-ins-row:last-child { border-bottom: none; }
.mrx .sp-ins-ic {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: var(--r-sm);
  background-color: var(--blue-soft);
  color: var(--blue-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-13);
}
.mrx .sp-ins-row p { margin: 0; font-size: var(--fs-13); color: var(--ink-3); line-height: var(--lh-snug); }

/* Revenue bar chart */
.mrx .sp-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding: var(--s-3) 0 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.mrx .sp-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 0 0;
  background-color: var(--ink);
  min-height: 4px;
  transition: height var(--t-base) var(--ease);
}
.mrx .sp-bar-day {
  font-size: var(--fs-10);
  color: var(--muted-3);
  white-space: nowrap;
  transform: rotate(-30deg);
  transform-origin: top center;
  margin-top: 2px;
}

/* Message line (form feedback) */
.mrx .sp-msg {
  font-size: var(--fs-13);
  color: var(--muted);
  padding: var(--s-2) 0;
}
.mrx .sp-msg.ok { color: var(--green-ink); }
.mrx .sp-msg.error { color: var(--accent-ink); }

/* Workspace status / mono list */
.mrx .stu-status-mono {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
}
.mrx .stu-status-mono span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-13);
}
.mrx .stu-status-mono em { font-style: normal; color: var(--muted); }
.mrx .stu-status-mono b { font-weight: 600; color: var(--ink); }
.mrx .stu-status-mono b.ok { color: var(--green-ink); }
.mrx .stu-status-mono b.bad { color: var(--accent-ink); }

/* Steps */
.mrx .stu-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.mrx .stu-step {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  color: var(--muted);
}
.mrx .stu-step > i {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-10);
  margin-top: 1px;
  color: var(--muted-3);
}
.mrx .stu-step.done > i {
  background-color: var(--green-soft);
  border-color: transparent;
  color: var(--green-ink);
}
.mrx .stu-step b { display: block; font-size: var(--fs-13); font-weight: 600; color: var(--ink); }
.mrx .stu-step span { font-size: var(--fs-12); color: var(--muted-2); }

/* Telemetry line (top summary) */
.mrx .stu-telem {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}
.mrx .stu-telem .tl {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-13);
  color: var(--muted);
  padding: var(--s-2) var(--s-3);
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.mrx .stu-telem .tl i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--muted-3);
  font-style: normal;
}
.mrx .stu-telem .tl.alive i { background-color: var(--green); }
.mrx .stu-telem .tl b { font-weight: 600; color: var(--ink); }

/* Composer wizard steps */
.mrx .sp-wstep {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background-color: var(--surface);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--muted);
  cursor: default;
}
.mrx .sp-wstep.active {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}
.mrx .sp-wstep.done { color: var(--green-ink); }
.mrx .sp-wstep i {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-11);
  color: var(--muted-2);
}
.mrx .sp-wstep.active i { background-color: var(--ink); color: var(--surface); border-color: var(--ink); }
.mrx .sp-wstep.done i { background-color: var(--green-soft); border-color: transparent; color: var(--green-ink); }

/* Spec rows (composer) */
.mrx .sp-spec-row {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.mrx .sp-spec-row input {
  flex: 1;
}

/* Upload status line */
.mrx .sp-upload-status { font-size: var(--fs-13); color: var(--muted); }

/* Pill in the rail footer */
.mrx .stu-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--ink);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background-color: var(--canvas-2);
}
.mrx .stu-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--gold);
  font-style: normal;
}

/* --------------------------------------------------------------------------
   24. Composer helpers (dropzone, help text, form actions, stat icon)
   -------------------------------------------------------------------------- */
.mrx .m-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-10) var(--s-5);
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-md);
  background-color: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.mrx .m-dropzone:hover,
.mrx .m-dropzone.drag {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}
.mrx .m-dropzone i {
  font-size: var(--fs-24);
  color: var(--muted-2);
}
.mrx .m-dropzone b {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--ink);
}
.mrx .m-dropzone span {
  font-size: var(--fs-13);
  color: var(--muted-2);
}
.mrx .m-help {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-13);
  color: var(--muted);
  line-height: var(--lh-snug);
  max-width: 62ch;
}
.mrx .m-form-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-soft);
}
.mrx .m-stat__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background-color: var(--canvas-2);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-17);
}
.mrx .m-stat__icon i { font-size: var(--fs-17); }

/* --------------------------------------------------------------------------
   25. Review console fragments (queue rows, inspector, badges, audit)
   Styling for the JS-generated review console markup in the light theme.
   -------------------------------------------------------------------------- */
.mrx .m-console__page .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.mrx .m-console__page .badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}
.mrx .m-console__page .badge-pending,
.mrx .m-console__page .badge-under_review { background-color: var(--blue-soft); color: var(--blue-ink); }
.mrx .m-console__page .badge-approved { background-color: var(--green-soft); color: var(--green-ink); }
.mrx .m-console__page .badge-changes_requested,
.mrx .m-console__page .badge-rejected,
.mrx .m-console__page .badge-suspended { background-color: var(--accent-soft); color: var(--accent-ink); }
.mrx .m-console__page .badge-archived,
.mrx .m-console__page .badge-draft { background-color: var(--quiet-soft); color: var(--quiet); }

/* Queue */
.mrx .m-console__page .queue {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mrx .m-console__page .queue-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background-color: var(--surface);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.mrx .m-console__page .queue-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--e-1);
}
.mrx .m-console__page .queue-row.selected {
  border-color: var(--ink);
  box-shadow: var(--ring-ink);
}
.mrx .m-console__page .q-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--r-sm);
  background-color: var(--canvas-2);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-13);
  font-family: var(--font-mono);
}
.mrx .m-console__page .q-main { flex: 1; min-width: 0; }
.mrx .m-console__page .q-name { font-size: var(--fs-14); font-weight: 600; color: var(--ink); }
.mrx .m-console__page .q-meta { font-size: var(--fs-12); color: var(--muted-2); }
.mrx .m-console__page .mono { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--muted-3); }

/* Inspector */
.mrx .m-console__page .inspector-body {
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.mrx .m-console__page .ins-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); }
.mrx .m-console__page .ins-title { font-size: var(--fs-20); font-weight: 700; color: var(--ink); }
.mrx .m-console__page .ins-sub { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-13); color: var(--muted); }
.mrx .m-console__page .section-label {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--muted);
  margin: var(--s-2) 0;
}
.mrx .m-console__page .facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-2) var(--s-4);
  background-color: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: var(--s-4);
}
.mrx .m-console__page .fact { display: flex; flex-direction: column; gap: 2px; }
.mrx .m-console__page .fact small { font-size: var(--fs-11); color: var(--muted-2); }
.mrx .m-console__page .fact b { font-size: var(--fs-13); font-weight: 600; color: var(--ink); word-break: break-word; }
.mrx .m-console__page .spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-2) var(--s-4);
  background-color: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: var(--s-4);
}

/* Verification rows */
.mrx .m-console__page .verification {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background-color: var(--green-soft);
  margin-bottom: var(--s-2);
}
.mrx .m-console__page .verification.pending {
  background-color: var(--gold-soft);
}
.mrx .m-console__page .verification svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-top: 1px;
  color: var(--green-ink);
}
.mrx .m-console__page .verification.pending svg { color: var(--gold-ink); }
.mrx .m-console__page .verification b { display: block; font-size: var(--fs-13); color: var(--ink); }
.mrx .m-console__page .verification span { font-size: var(--fs-12); color: var(--muted); }

/* ID card + docs */
.mrx .m-console__page .id-card {
  margin-top: var(--s-2);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: var(--surface);
}
.mrx .m-console__page .id-card small { display: block; font-size: var(--fs-11); color: var(--muted-2); }
.mrx .m-console__page .id-card b { font-size: var(--fs-14); font-weight: 600; color: var(--ink); }
.mrx .m-console__page .id-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.mrx .m-console__page .id-photos small { display: block; font-size: var(--fs-11); color: var(--muted-2); margin-bottom: 4px; }
.mrx .m-console__page .doc-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background-color: var(--surface-2);
}
.mrx .m-console__page .doc-photo img { width: 100%; max-height: 150px; object-fit: contain; display: block; }
.mrx .m-console__page .doc-photo.missing {
  border-style: dashed;
  color: var(--muted-3);
  font-size: var(--fs-11);
  padding: var(--s-2);
}
.mrx .m-console__page .document {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  margin-top: var(--s-2);
  font-size: var(--fs-13);
}
.mrx .m-console__page .document a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }

/* Product images */
.mrx .m-console__page .ins-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--s-2);
}
.mrx .m-console__page .ins-img-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background-color: var(--surface-2);
}
.mrx .m-console__page .ins-img { width: 100%; height: 90px; object-fit: cover; }
.mrx .m-console__page .img-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-10);
  color: var(--muted-3);
  text-align: center;
  padding: var(--s-2);
}
.mrx .m-console__page .feature-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.mrx .m-console__page .feature-list span {
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background-color: var(--canvas-2);
  color: var(--ink-3);
}
.mrx .m-console__page .ins-desc {
  font-size: var(--fs-14);
  color: var(--ink-3);
  line-height: var(--lh-body);
}

/* Note + audit */
.mrx .m-console__page .note-area {
  width: 100%;
  min-height: 84px;
  padding: var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  color: var(--ink);
  font-family: var(--font-sys);
  font-size: var(--fs-14);
  resize: vertical;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.mrx .m-console__page .note-area:focus { border-color: var(--ink); box-shadow: var(--ring-ink); }
.mrx .m-console__page .audit { display: flex; flex-direction: column; gap: 2px; }
.mrx .m-console__page .audit-row {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line-soft);
}
.mrx .m-console__page .audit-row:last-child { border-bottom: none; }
.mrx .m-console__page .audit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--muted-3);
  margin-top: 5px;
  flex: 0 0 8px;
}
.mrx .m-console__page .audit-row b { display: block; font-size: var(--fs-13); color: var(--ink); }
.mrx .m-console__page .audit-row small { font-size: var(--fs-12); color: var(--muted-2); }

/* Inspector actions */
.mrx .m-console__page .ins-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--line-soft);
  background-color: var(--surface-2);
}
.mrx .m-console__page .ins-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 42px;
  padding: 0 var(--s-4);
  border-radius: var(--r-sm);
  font-family: var(--font-sys);
  font-size: var(--fs-14);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.mrx .m-console__page .btn-approve { background-color: var(--ink); color: var(--surface); }
.mrx .m-console__page .btn-approve:hover { background-color: var(--ink-2); }
.mrx .m-console__page .btn-warn { background-color: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.mrx .m-console__page .btn-warn:hover { background-color: var(--canvas-2); }
.mrx .m-console__page .btn-danger { background-color: var(--surface); color: var(--accent-ink); border-color: var(--accent-ring); }
.mrx .m-console__page .btn-danger:hover { background-color: var(--accent-soft); }

/* Empty + placeholder */
.mrx .m-console__page .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  text-align: center;
  color: var(--muted-2);
  font-size: var(--fs-13);
  padding: var(--s-10) var(--s-5);
}
.mrx .m-console__page .empty-state svg { width: 30px; height: 30px; color: var(--muted-3); }
.mrx .m-console__page .hint { color: var(--muted-3); font-size: var(--fs-12); }
.mrx .m-console__page .inspector-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  text-align: center;
  color: var(--muted-2);
  font-size: var(--fs-14);
  padding: var(--s-6);
}
.mrx .m-console__page .inspector-placeholder svg { width: 34px; height: 34px; color: var(--muted-3); margin-bottom: var(--s-3); }

/* Toast */
.mrx .m-console__page .toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--ink);
  color: var(--surface);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-14);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  box-shadow: var(--e-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  z-index: var(--z-toast);
  max-width: 90vw;
}
.mrx .m-console__page .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mrx .m-console__page .toast.error { background-color: var(--accent-dark); }
.mrx .m-console__page .toast svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* Review page stats */
.mrx .m-console__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.mrx .m-console__stat {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  box-shadow: var(--e-1);
}
.mrx .m-console__stat span { font-size: var(--fs-12); color: var(--muted); font-weight: 500; display: block; }
.mrx .m-console__stat b {
  font-size: var(--fs-30);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  display: block;
  margin-top: 2px;
}
.mrx .m-console__stat small { font-size: var(--fs-11); color: var(--muted-3); }

/* Review workspace: queue + inspector split */
.mrx .m-console__workspace {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: var(--s-4);
  align-items: start;
}
@media (max-width: 960px) {
  .mrx .m-console__workspace { grid-template-columns: 1fr; }
}
.mrx .m-console__panel {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--e-1);
  overflow: hidden;
}
.mrx .m-console__panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
}
.mrx .m-console__panel-head h2 { font-size: var(--fs-15); font-weight: 600; color: var(--ink); margin: 0; display: flex; align-items: center; gap: var(--s-2); }
.mrx .m-console__panel-head h2 svg { width: 15px; height: 15px; color: var(--muted); }
.mrx .m-console__panel-head small { font-size: var(--fs-12); color: var(--muted-2); }
.mrx .m-console__queue-body { padding: var(--s-3); }
.mrx .m-console__controls {
  display: flex;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.mrx .m-console__controls .search-wrap {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0 var(--s-3);
}
.mrx .m-console__controls .search-wrap svg { width: 15px; height: 15px; color: var(--muted-2); flex: 0 0 15px; }
.mrx .m-console__controls .search-wrap input {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  font-family: var(--font-sys);
  font-size: var(--fs-14);
  color: var(--ink);
  outline: none;
}
.mrx .m-console__controls select {
  min-height: 44px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  font-family: var(--font-sys);
  font-size: var(--fs-14);
  color: var(--ink);
  outline: none;
}

/* ---------- Greeting banner (studio pages) ---------- */
.mrx .m-greet {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(560px 220px at 92% -20%, rgba(227,6,19,.07), transparent 62%),
    linear-gradient(120deg, #ffffff 0%, #fdfbf8 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  margin-bottom: var(--s-6);
  box-shadow: var(--e-1);
}
.mrx .m-greet::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(227,6,19,0));
}
.mrx .m-greet__mark {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: var(--fs-17);
  letter-spacing: .02em;
  box-shadow: 0 6px 16px -6px rgba(22,25,29,.4);
}
.mrx .m-greet__mark.ok {
  background: linear-gradient(135deg, var(--ink) 0%, #38404a 100%);
}
.mrx .m-greet__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mrx .m-greet__hello {
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mrx .m-greet__hello span { color: var(--ink); }
.mrx .m-greet__role {
  font-size: var(--fs-13);
  color: var(--muted);
}
.mrx .m-greet__spark {
  margin-left: auto;
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 17px;
}
@media (max-width: 719px) {
  .mrx .m-greet {
    padding: var(--s-4);
    border-radius: var(--r-md);
  }
  .mrx .m-greet__mark { width: 44px; height: 44px; border-radius: 13px; font-size: var(--fs-15); }
  .mrx .m-greet__hello { font-size: var(--fs-20); }
  .mrx .m-greet__spark { display: none; }
}

/* ---------- Page head flair ---------- */
.mrx .m-page-head h1 {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.mrx .m-page-head h1::before {
  content: '';
  flex: 0 0 auto;
  width: 8px; height: 30px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), #ff6b73);
}

/* ---------- Console command-center polish ---------- */
.mrx .m-console__top {
  box-shadow: 0 1px 0 var(--line-soft);
}
.mrx .m-console__wordmark::before {
  content: '';
  flex: 0 0 auto;
  width: 10px; height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #ff6b73);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.mrx .m-console__stat {
  position: relative;
  overflow: hidden;
}
.mrx .m-console__stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(227,6,19,0));
}
.mrx .m-console__stat b {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-24);
}
.mrx .m-console__page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.mrx .m-console__page-head h1 {
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  margin: 0 0 6px;
}
.mrx .m-console__page-head p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-14);
  max-width: 68ch;
}
.mrx .m-console__controls {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.mrx .m-console__controls .search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}
.mrx .m-console__controls .search-wrap svg {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: var(--muted-2);
  pointer-events: none;
}
.mrx .m-console__controls .search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-14);
  color: var(--ink);
}
.mrx .m-console__controls .search-wrap input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--ring-ink);
}
.mrx .m-console__controls select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.mrx .m-console__controls select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--ring-ink);
}
@media (max-width: 719px) {
  .mrx .m-console__page-head h1 { font-size: var(--fs-20); }
}

/* ═══════════════════════════════════════════════════════════════
   20. Composer wizard (multi-stage listing form)
   Only the active step is visible; steps slide+fade between.
   ═══════════════════════════════════════════════════════════════ */
.mrx .sp-step { display: none; }
.mrx .sp-step.active {
  display: block;
  animation: spStepIn 260ms var(--ease) both;
}
@keyframes spStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Step header row — a numbered kicker + hint that resets context per stage */
.mrx .sp-step-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line-soft);
}
.mrx .sp-step-head b {
  font-size: var(--fs-20);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: var(--tracking-tight);
}
.mrx .sp-step-head span {
  font-size: var(--fs-13);
  color: var(--muted);
}

/* Two-column intro row so the form never reads as a wall of boxes */
.mrx .sp-stage-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-5);
  margin-bottom: var(--s-5);
}
@media (max-width: 860px) {
  .mrx .sp-stage-intro { grid-template-columns: 1fr; }
}
.mrx .sp-stage-intro .m-field { margin-bottom: 0; }
.mrx .sp-stage-intro .sp-stage-tip {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  justify-content: center;
  padding: var(--s-5);
  background: var(--canvas-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}
.mrx .sp-stage-tip i {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-17);
}
.mrx .sp-stage-tip b { font-size: var(--fs-15); color: var(--ink); }
.mrx .sp-stage-tip p { margin: 0; font-size: var(--fs-13); color: var(--muted); line-height: var(--lh-snug); }

/* Stepper — keeps the numbered chips but firms up the active/complete states */
.mrx .sp-wstep { transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.mrx .sp-wstep.active { border-color: var(--ink); background: var(--surface); box-shadow: var(--ring-ink); }

/* Spec rows get a touch more breathing room */
.mrx .sp-spec-row { align-items: center; }
.mrx .sp-spec-row .spec-rm {
  width: 40px; height: 40px; flex: 0 0 40px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted-2);
  cursor: pointer;
}
.mrx .sp-spec-row .spec-rm:hover { color: var(--accent-ink); border-color: var(--accent-ring); }

/* Image previews — tidy strip that reads as a gallery */
.mrx .sp-img {
  position: relative;
  width: 96px; height: 96px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--canvas-2);
}
.mrx .sp-img img { width: 100%; height: 100%; object-fit: cover; }
.mrx .sp-img button {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;
  border: none; border-radius: 999px;
  background: rgba(22,25,29,.72); color: #fff;
  font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* Main-image control: the starred photo is imageUrls[0], i.e. the cover the
   shopper sees, so it gets a visible flag and the rest get a star button. */
.mrx .sp-img.is-main { border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--accent-soft); }
.mrx .sp-img button.sp-img-main {
  top: 4px; right: auto; left: 4px;
  color: #f7c948;
  font-size: 11px;
}
.mrx .sp-img button.sp-img-main:hover { background: rgba(22,25,29,.92); }
.mrx .sp-img-flag {
  position: absolute; bottom: 4px; left: 4px;
  padding: 3px 7px;
  border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
  pointer-events: none;
}
.mrx #imagePreviews { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-3); }

/* Feature tags */
.mrx .sp-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; margin: 0 6px 6px 0;
  background: var(--canvas-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); font-size: var(--fs-13); color: var(--ink-3);
}
.mrx .sp-tag button {
  border: none; background: none; color: var(--muted-2);
  font-size: 11px; cursor: pointer; padding: 2px;
}
.mrx .sp-tag button:hover { color: var(--accent-ink); }

/* Final step: side-by-side form + storefront-accurate preview */
.mrx .sp-finish {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 960px) {
  .mrx .sp-finish { grid-template-columns: 1fr; }
}
.mrx .m-preview--card {
  box-shadow: var(--e-3);
}
.mrx .m-preview--card .m-idview__well img {
  width: 100%; height: 100%; object-fit: cover;
}

/* Form action bar — pinned to the card footer, sticky on mobile */
.mrx .m-form-actions {
  display: flex; gap: var(--s-3); flex-wrap: wrap;
  margin-top: var(--s-6); padding-top: var(--s-5);
  border-top: 1px solid var(--line-soft);
}
.mrx .m-form-actions .m-btn { min-height: 46px; }

/* ═══════════════════════════════════════════════════════════════
   21. Catalog card grid (All listings)
   Each listing is a product-style card with photo, status and actions.
   ═══════════════════════════════════════════════════════════════ */
.mrx .sp-cat-grid {
  display: grid;
  /* 250px floor: a card narrower than that cannot show a badge and two actions
     on one line without squeezing them. */
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-5);
}
.mrx .sp-cat-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.mrx .sp-cat-card:hover {
  box-shadow: var(--e-2);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.mrx .sp-cat-link { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: inherit; }
.mrx .sp-cat-thumb {
  aspect-ratio: 4 / 3;
  background: var(--canvas-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-3); font-size: var(--fs-30);
  overflow: hidden;
}
.mrx .sp-cat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mrx .sp-cat-body { padding: var(--s-4); display: flex; flex-direction: column; gap: 4px; flex: 1; }
.mrx .sp-cat-cat { font-size: var(--fs-12); color: var(--muted-2); font-weight: 500; }
.mrx .sp-cat-name {
  font-size: var(--fs-14); font-weight: 600; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.6em; line-height: 1.3;
}
.mrx .sp-cat-price { font-size: var(--fs-17); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.mrx .sp-cat-meta {
  display: flex; justify-content: space-between; gap: var(--s-2);
  font-size: var(--fs-12); color: var(--muted-2); margin-top: 2px;
}
.mrx .sp-cat-note {
  margin: var(--s-3) 0 0; padding: var(--s-2) var(--s-3);
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: var(--fs-12); border-radius: var(--r-xs);
  line-height: var(--lh-snug);
}
.mrx .sp-cat-note i { margin-right: 4px; }
/* Card footer: status on the left, actions on the right.

   A merchant's listing now offers TWO actions (View and Edit) at every status,
   and the card is only ~250px wide. A single non-wrapping flex row pushed the
   buttons past the card's clipped edge, so "Edit & resubmit" came out cut in
   half — the complaint that prompted this. The row wraps instead, the actions
   drop onto their own line when they must, and each label is nowrap so it can
   never be sliced mid-word. */
.mrx .sp-cat-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.mrx .sp-cat-foot__actions {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mrx .sp-cat-foot__actions .m-btn {
  white-space: nowrap;
  flex: 0 0 auto;
}
/* Below ~300px of card width the two buttons stack, full width, so no label is
   ever reduced to an ellipsis. */
@media (max-width: 400px) {
  .mrx .sp-cat-foot__actions { width: 100%; justify-content: stretch; }
  .mrx .sp-cat-foot__actions .m-btn { flex: 1 1 0; justify-content: center; }
}
.mrx .sp-cat-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-12); font-weight: 500;
  padding: 4px 10px; border-radius: var(--r-pill);
}
.mrx .sp-cat-badge i { font-size: 5px; }
.mrx .sp-cat-badge.approved { background: var(--green-soft); color: var(--green-ink); }
.mrx .sp-cat-badge.pending, .mrx .sp-cat-badge.under_review { background: var(--blue-soft); color: var(--blue-ink); }
.mrx .sp-cat-badge.changes_requested, .mrx .sp-cat-badge.rejected { background: var(--accent-soft); color: var(--accent-ink); }
.mrx .sp-cat-badge.archived, .mrx .sp-cat-badge.draft { background: var(--quiet-soft); color: var(--quiet); }

/* ── Messages badge on the studio rail ───────────────────────────────
   The third child of a nav link, so it is pushed to the trailing edge
   with margin-left:auto rather than absolutely positioned — that keeps it
   aligned with the label at every rail width. */
.mrx .m-rail__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill, 999px);
  background: var(--accent, #e30613);
  color: #fff;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  flex: none;
}
.mrx .m-rail__badge[hidden] { display: none; }
.mrx .m-sheet__item .m-rail__badge { margin-left: auto; }

@media (max-width: 900px) {
  /* Icon-only rail: the count sits on the icon, so it must not reserve
     horizontal space and pull the icon off-centre. */
  .mrx .m-rail__link .m-rail__badge {
    position: absolute;
    top: 4px;
    right: 50%;
    margin-left: 0;
    transform: translateX(14px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 10px;
    line-height: 17px;
  }
}
