/* Products workspace: dense operational surface built on existing Ayutor data. */
.view[data-view-panel="products"] {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0 24px 18px;
  background: var(--ay-bg);
}

.products-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.products-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 20px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.products-heading h2 {
  margin: 3px 0 0;
  color: var(--ice);
  font-size: clamp(25px, 2vw, 32px);
  line-height: 1;
  letter-spacing: -0.035em;
}

.products-heading > .eyebrow {
  margin: 0;
  color: var(--purple-light);
  font-size: 9px;
  letter-spacing: 0.11em;
}

.products-context {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.product-modes {
  display: flex;
  gap: 30px;
  margin-top: 20px;
  padding: 0;
  border-bottom: 1px solid rgba(243, 245, 255, 0.09);
}

.product-modes .mode-chip {
  position: relative;
  min-height: 38px;
  padding: 0 0 12px;
  border: 0;
  border-radius: 0;
  color: rgba(243, 245, 255, 0.56);
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.product-modes .mode-chip::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--purple-light);
  opacity: 0;
  transform: scaleX(0.72);
  transition: opacity 160ms ease, transform 160ms ease;
}

.product-modes .mode-chip:hover,
.product-modes .mode-chip.is-active {
  color: var(--ice);
  background: transparent;
}

.product-modes .mode-chip.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.products-scope {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.products-scope label {
  display: grid;
  gap: 5px;
}

.products-scope label > span {
  color: var(--faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.products-scope select {
  min-width: 168px;
  height: 36px;
  padding: 0 34px 0 12px;
  border: 1px solid rgba(243, 245, 255, 0.12);
  border-radius: 8px;
  color: var(--ice);
  outline: none;
  background: var(--ay-surface-input);
  font-size: 11px;
  font-weight: 700;
}

.products-freshness {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.products-freshness::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: none;
}

.products-freshness.is-ok::before {
  background: var(--ay-profit);
  box-shadow: none;
}

.products-freshness.is-error::before {
  background: var(--danger);
}

.products-refresh {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(243, 245, 255, 0.12);
  border-radius: 50%;
  color: var(--muted);
  background: var(--ay-surface-input);
  font-size: 19px;
  transition: color 160ms ease, border-color 160ms ease, transform 180ms ease;
}

.products-refresh:hover {
  color: var(--ice);
  border-color: rgba(134, 134, 226, 0.55);
  transform: rotate(25deg);
}

.products-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  padding: 16px 0 12px;
}

.products-search-wrap {
  position: relative;
}

.products-search-wrap > span {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(243, 245, 255, 0.5);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.products-search-wrap > span::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1.5px;
  border-radius: 2px;
  background: rgba(243, 245, 255, 0.5);
  transform: rotate(45deg);
}

.products-search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 40px;
  border: 1px solid rgba(243, 245, 255, 0.12);
  border-radius: 8px;
  color: var(--ice);
  outline: none;
  background: var(--ay-surface-input);
  font-size: 11px;
}

.products-search-wrap input:focus {
  border-color: rgba(134, 134, 226, 0.62);
  box-shadow: var(--ay-focus-ring);
}

.products-tool-btn,
.products-bulk-action {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(243, 245, 255, 0.14);
  border-radius: 8px;
  color: var(--ice);
  background: var(--ay-surface);
  font-size: 11px;
  font-weight: 750;
}

.products-tool-btn:hover,
.products-tool-btn.is-active,
.products-bulk-action:hover {
  border-color: rgba(134, 134, 226, 0.54);
  background: rgba(97, 97, 172, 0.13);
}

.products-filter-panel {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: -2px 0 12px;
  padding: 12px;
  border: 1px solid rgba(134, 134, 226, 0.2);
  border-radius: 9px;
  background: var(--ay-surface);
}

.products-filter-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.products-filter-panel input {
  width: 150px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ice);
  outline: 0;
  background: var(--ay-surface-input);
}

.products-filter-panel .primary-btn {
  min-height: 34px;
  padding: 0 16px;
}

.products-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0 11px;
}

.products-list-head > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.products-list-head strong {
  color: var(--ice);
  font-size: 21px;
  letter-spacing: -0.02em;
}

.products-list-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.products-bulk-action {
  min-height: 34px;
  color: var(--ay-accent-text);
  border-color: color-mix(in srgb, var(--ay-violet) 32%, transparent);
}

.products-workbench {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(243, 245, 255, 0.11);
  border-radius: 10px;
  background: var(--ay-surface);
}

.products-workbench.has-inspector {
  grid-template-columns: minmax(0, 1fr) minmax(350px, 390px);
}

.products-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.products-table {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  scrollbar-width: thin;
}

.products-table-head,
.products-table-row {
  min-width: 1090px;
  display: grid;
  align-items: stretch;
}

.products-table-head.is-profitable,
.products-table-row.is-profitable {
  grid-template-columns: minmax(280px, 1.8fr) 96px 96px 100px 72px 84px 100px 94px 76px;
}

.products-table-head.is-drop,
.products-table-row.is-drop {
  grid-template-columns: minmax(260px, 1.7fr) 132px 70px 92px 92px 112px 80px 100px 76px;
}

.products-table-head {
  position: sticky;
  z-index: 3;
  top: 0;
  min-height: 42px;
  border-bottom: 1px solid rgba(243, 245, 255, 0.1);
  color: rgba(243, 245, 255, 0.45);
  background: var(--ay-surface-sunken);
  font-size: 9px;
  font-weight: 800;
}

.products-table-head > div,
.products-table-row > div {
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-right: 1px solid rgba(243, 245, 255, 0.055);
}

.products-table-head > div:last-child,
.products-table-row > div:last-child {
  border-right: 0;
}

.product-list {
  display: block;
  padding: 0;
}

.products-table-row {
  position: relative;
  min-height: 70px;
  border: 0;
  border-bottom: 1px solid rgba(243, 245, 255, 0.07);
  color: var(--ice);
  background: rgba(255, 255, 255, 0.008);
  transition: background 140ms ease, box-shadow 140ms ease;
}

.products-table-row:hover,
.products-table-row:focus-visible {
  outline: 0;
  background: rgba(134, 134, 226, 0.055);
}

.products-table-row.is-selected {
  background: rgba(97, 97, 172, 0.12);
  box-shadow: inset 2px 0 0 var(--purple-light);
}

.products-product-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.products-product-cell .product-thumb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(243, 245, 255, 0.12);
  border-radius: 7px;
  color: var(--purple-light);
  background: rgba(243, 245, 255, 0.94);
  font-size: 14px;
  font-weight: 900;
}

.products-product-cell .product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.products-product-cell .product-title {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.products-product-cell .product-title b {
  overflow: hidden;
  color: var(--ice);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.products-product-cell .product-title small {
  overflow: hidden;
  color: var(--faint);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.products-value {
  flex-direction: column;
  justify-content: center;
  align-items: flex-start !important;
  gap: 4px;
}

.products-value b {
  color: rgba(243, 245, 255, 0.92);
  font-size: 11px;
  font-weight: 800;
}

.products-value small {
  color: var(--faint);
  font-size: 8px;
}

.products-value.is-profit b {
  color: var(--ay-profit-text);
}

.products-value.is-drop b {
  color: var(--ay-accent-text);
}

.products-price-move {
  flex-wrap: wrap;
  align-content: center;
  gap: 5px;
}

.products-price-move s {
  color: rgba(243, 245, 255, 0.42);
  font-size: 9px;
}

.products-price-move b {
  color: var(--ay-accent-text);
  font-size: 11px;
}

.products-row-actions {
  display: flex;
  gap: 5px;
}

.products-row-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(243, 245, 255, 0.12);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 14px;
}

.products-row-actions button:hover {
  color: var(--ay-accent-text);
  border-color: color-mix(in srgb, var(--ay-violet) 38%, transparent);
  background: color-mix(in srgb, var(--ay-violet) 6%, transparent);
}

.products-pagination {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 12px;
  border-top: 1px solid rgba(243, 245, 255, 0.08);
  color: var(--faint);
  font-size: 9px;
}

.products-pagination nav {
  display: flex;
  align-items: center;
  gap: 5px;
}

.products-pagination button {
  min-width: 28px;
  height: 28px;
  border: 1px solid rgba(243, 245, 255, 0.1);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 10px;
}

.products-pagination button.is-active {
  color: var(--ay-text);
  border-color: rgba(134, 134, 226, 0.55);
  background: rgba(97, 97, 172, 0.24);
}

.products-panel .workbench-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.product-inspector {
  position: relative;
  min-width: 0;
  max-height: none;
  height: 100%;
  overflow: auto;
  border: 0;
  border-left: 1px solid rgba(243, 245, 255, 0.1);
  border-radius: 0;
  background: var(--ay-surface);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.product-inspector::before {
  display: none;
}

.product-inspector .inspector-workspace {
  min-height: 100%;
}

.inspector-close {
  position: absolute;
  z-index: 8;
  top: 11px;
  right: 11px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(243, 245, 255, 0.05);
  font-size: 19px;
}

.inspector-close:hover {
  color: var(--ay-text);
  background: rgba(243, 245, 255, 0.1);
}

.product-inspector .inspector-sticky-head {
  padding: 18px 16px 14px;
  background: var(--ay-surface);
}

.product-inspector .inspector-identity {
  padding-right: 30px;
  grid-template-columns: 54px minmax(0, 1fr);
}

.product-inspector .inspector-thumb {
  width: 54px;
  height: 54px;
}

.product-inspector .inspector-identity h2 {
  font-size: 14px;
}

.product-inspector .inspector-decision {
  margin-top: 12px;
}

.inspector-drop-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--ay-violet) 22%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ay-violet) 6%, transparent);
}

.inspector-drop-summary small,
.inspector-drop-summary span {
  color: var(--muted);
  font-size: 9px;
}

.inspector-drop-summary strong {
  color: var(--ice);
  font-size: 12px;
}

.inspector-drop-summary b {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--ay-accent-text);
  font-size: 16px;
}

@media (max-width: 1180px) {
  .view[data-view-panel="products"] {
    padding-inline: 16px;
  }

  .products-intro {
    gap: 16px;
  }

  .products-scope label > span {
    display: none;
  }

  .products-scope select {
    min-width: 145px;
  }

  .products-workbench.has-inspector {
    grid-template-columns: minmax(0, 1fr) 350px;
  }
}

@media (max-width: 820px) {
  .view[data-view-panel="products"] {
    overflow: auto;
    padding: 0 12px 14px;
  }

  .products-shell {
    height: auto;
    min-height: 100%;
  }

  .products-intro {
    flex-direction: column;
  }

  .products-scope {
    width: 100%;
    flex-wrap: wrap;
  }

  .products-scope label {
    min-width: 150px;
    flex: 1 1 150px;
  }

  .products-scope select {
    width: 100%;
  }

  .products-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .products-search-wrap {
    grid-column: 1 / -1;
  }

  .products-workbench,
  .products-workbench.has-inspector {
    min-height: 560px;
    grid-template-columns: minmax(0, 1fr);
  }

  .product-inspector {
    position: fixed;
    z-index: 90;
    inset: 58px 0 0 72px;
    border-left: 0;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .products-table-row,
  .products-refresh,
  .product-modes .mode-chip::after {
    transition: none;
  }
}
