/* === XR R4C CLIENTS + CATALOG ON UI2 CORE START === */

.xr-ui2-runtime .xr2-clients-view,
.xr-ui2-runtime .xr2-catalog-view {
  display: grid;
  gap: 12px;
}

.xr-ui2-runtime .xr2-clients-view > .xr2-page-header,
.xr-ui2-runtime .xr2-catalog-view > .xr2-page-header {
  margin-bottom: 0;
}

.xr-ui2-runtime .xrcc-client-grid,
.xr-ui2-runtime .xrcc-catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.xr-ui2-runtime .xrcc-client-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border-left: 4px solid #7aa5ee;
}

.xr-ui2-runtime .xrcc-client-card.xrcc-client-legal {
  border-left-color: var(--xr2-success);
}

.xr-ui2-runtime .xrcc-client-card.xrcc-client-ip {
  border-left-color: var(--xr2-warning);
}

.xr-ui2-runtime .xrcc-client-card.has-debt {
  border-color: #efbbb7;
  border-left-color: var(--xr2-danger);
  background: #fffdfd;
}

.xr-ui2-runtime .xrcc-client-card-head,
.xr-ui2-runtime .xrcc-catalog-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.xr-ui2-runtime .xrcc-client-identity,
.xr-ui2-runtime .xrcc-catalog-title-row > div {
  min-width: 0;
}

.xr-ui2-runtime .xrcc-catalog-title-row > .xr2-badge {
  flex: 0 0 auto;
}

.xr-ui2-runtime .xrcc-client-identity h2,
.xr-ui2-runtime .xrcc-catalog-title-row h2 {
  overflow: hidden;
  margin: 0;
  color: var(--xr2-text);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-ui2-runtime .xrcc-client-identity p,
.xr-ui2-runtime .xrcc-catalog-title-row p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--xr2-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-ui2-runtime .xrcc-badge-stack {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 5px;
  flex-direction: column;
}

.xr-ui2-runtime .xrcc-client-facts,
.xr-ui2-runtime .xrcc-stock-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--xr2-border);
  border-radius: 7px;
  background: var(--xr2-border);
}

.xr-ui2-runtime .xrcc-client-facts > div,
.xr-ui2-runtime .xrcc-stock-grid > div {
  min-width: 0;
  padding: 8px 9px;
  background: var(--xr2-surface-soft);
}

.xr-ui2-runtime .xrcc-client-facts span,
.xr-ui2-runtime .xrcc-stock-grid span,
.xr-ui2-runtime .xrcc-client-last-order span,
.xr-ui2-runtime .xrcc-price-row small,
.xr-ui2-runtime .xrcc-lookup-grid span {
  display: block;
  color: var(--xr2-muted);
  font-size: 12px;
}

.xr-ui2-runtime .xrcc-client-facts strong,
.xr-ui2-runtime .xrcc-stock-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--xr2-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-ui2-runtime .xrcc-client-facts .is-danger {
  background: var(--xr2-danger-soft);
}

.xr-ui2-runtime .xrcc-client-facts .is-danger span,
.xr-ui2-runtime .xrcc-client-facts .is-danger strong {
  color: #a72e2e;
}

.xr-ui2-runtime .xrcc-client-last-order {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.xr-ui2-runtime .xrcc-client-last-order strong {
  overflow: hidden;
  color: var(--xr2-text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-ui2-runtime .xrcc-note,
.xr-ui2-runtime .xrcc-neutral-empty {
  display: grid;
  gap: 2px;
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid var(--xr2-border);
  border-radius: 7px;
  background: var(--xr2-surface-soft);
  color: var(--xr2-text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.xr-ui2-runtime .xrcc-note strong {
  color: var(--xr2-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.xr-ui2-runtime .xrcc-note--terms {
  border-color: #ead18e;
  background: var(--xr2-warning-soft);
  color: #765212;
}

.xr-ui2-runtime .xrcc-neutral-empty {
  border-style: dashed;
  color: var(--xr2-muted);
}

.xr-ui2-runtime .xrcc-card-actions,
.xr-ui2-runtime .xrcc-form-actions,
.xr-ui2-runtime .xrcc-cabinet-actionbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.xr-ui2-runtime .xrcc-card-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--xr2-border);
}

.xr-ui2-runtime .xrcc-form-actions {
  margin-top: 12px;
}

.xr-ui2-runtime .xrcc-cabinet-actionbar {
  min-height: 48px;
  justify-content: flex-end;
  padding: 6px 8px;
  border: 1px solid var(--xr2-border);
  border-radius: var(--xr2-radius);
  background: var(--xr2-surface);
  box-shadow: var(--xr2-shadow-xs);
}

.xr-ui2-runtime .xrcc-cabinet-metrics .xr2-metric-value {
  font-size: 20px;
}

.xr-ui2-runtime .xrcc-cabinet-grid {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 12px;
  align-items: start;
}

.xr-ui2-runtime .xrcc-cabinet-grid > .xr2-panel {
  margin-top: 0;
}

.xr-ui2-runtime .xrcc-lookup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.xr-ui2-runtime .xrcc-lookup-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--xr2-border);
  border-radius: 7px;
  background: var(--xr2-surface-soft);
  box-shadow: inset 3px 0 0 var(--xr2-border-strong);
}

.xr-ui2-runtime .xrcc-lookup-grid strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 3px;
  color: var(--xr2-text);
  font-size: 13px;
}

.xr-ui2-runtime .xrcc-lookup-grid .is-danger {
  border-color: var(--xr2-danger);
  background: var(--xr2-danger-soft);
  box-shadow: inset 3px 0 0 var(--xr2-danger);
}

.xr-ui2-runtime .xrcc-lookup-grid .is-danger span,
.xr-ui2-runtime .xrcc-lookup-grid .is-danger strong {
  color: var(--xr2-danger);
}

.xr-ui2-runtime .xrcc-detail-section {
  margin-top: 14px;
}

.xr-ui2-runtime .xrcc-detail-section h3 {
  margin: 0 0 6px;
  color: var(--xr2-text);
  font-size: 13px;
}

.xr-ui2-runtime .xrcc-detail-section .xrcc-note,
.xr-ui2-runtime .xrcc-detail-section .xrcc-neutral-empty {
  margin-top: 0;
}

.xr-ui2-runtime .xrcc-order-history {
  display: grid;
  gap: 8px;
}

.xr-ui2-runtime .xrcc-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--xr2-border);
  border-radius: 7px;
  background: var(--xr2-surface);
}

.xr-ui2-runtime .xrcc-history-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.xr-ui2-runtime .xrcc-history-main strong {
  color: var(--xr2-text);
  font-size: 13px;
}

.xr-ui2-runtime .xrcc-history-main span,
.xr-ui2-runtime .xrcc-table-note {
  color: var(--xr2-muted);
  font-size: 12px;
}

.xr-ui2-runtime .xrcc-history-statuses {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.xr-ui2-runtime .xrcc-history-total {
  color: var(--xr2-text);
  font-size: 13px;
  white-space: nowrap;
}

.xr-ui2-runtime .xrcc-check {
  display: flex;
  min-height: var(--xr2-control-h);
  align-items: center;
  gap: 8px;
  align-self: end;
  color: var(--xr2-text-soft);
  font-size: 12px;
  font-weight: 600;
}

.xr-ui2-runtime .xrcc-check input {
  width: 17px;
  height: 17px;
}

.xr-ui2-runtime .xrcc-catalog-toolbar .xr2-toolbar-left {
  flex: 1 1 520px;
}

.xr-ui2-runtime .xrcc-catalog-toolbar .xr2-toolbar-right {
  flex: 0 1 auto;
  justify-content: flex-end;
}

.xr-ui2-runtime .xrcc-search {
  flex: 1 1 300px;
  width: auto;
  min-width: 220px;
}

.xr-ui2-runtime .xrcc-active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: -4px;
  padding: 0 2px;
}

.xr-ui2-runtime .xrcc-filter-panel {
  margin-top: 0 !important;
}

.xr-ui2-runtime .xrcc-catalog-card {
  position: relative;
  overflow: hidden;
}

.xr-ui2-runtime .xrcc-catalog-card.is-busy {
  border-color: #e4c17b;
}

.xr-ui2-runtime .xrcc-catalog-card.is-archived {
  opacity: .78;
}

.xr-ui2-runtime .xrcc-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--xr2-border-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.xr-ui2-runtime .xrcc-select input {
  width: 16px;
  height: 16px;
}

.xr-ui2-runtime .xrcc-catalog-photo {
  position: relative;
  display: grid;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  place-items: center;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--xr2-border);
  border-radius: 0;
  background: #f6f5f1;
  cursor: pointer;
}

.xr-ui2-runtime .xrcc-catalog-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 10px;
}

.xr-ui2-runtime .xrcc-catalog-photo--empty,
.xr-ui2-runtime .xrcc-photo-fallback {
  color: #8b929d;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: .02em;
}

.xr-ui2-runtime .xrcc-catalog-photo .xrcc-photo-fallback {
  display: none;
}

.xr-ui2-runtime .xrcc-catalog-photo.is-photo-error img {
  display: none;
}

.xr-ui2-runtime .xrcc-catalog-photo.is-photo-error .xrcc-photo-fallback {
  display: block;
}

.xr-ui2-runtime .xrcc-catalog-card-body {
  padding: 12px;
}

.xr-ui2-runtime .xrcc-price-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.xr-ui2-runtime .xrcc-price-row > span {
  padding: 8px 9px;
  border: 1px solid var(--xr2-border);
  border-radius: 7px;
  background: #fff;
}

.xr-ui2-runtime .xrcc-price-row strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--xr2-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-ui2-runtime .xrcc-catalog-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.xr-ui2-runtime .xrcc-catalog-table .xrcc-catalog-photo,
.xr-ui2-runtime .xrcc-photo-table .xrcc-catalog-photo {
  width: 64px;
  height: 48px;
  border: 1px solid var(--xr2-border);
  border-radius: 6px;
}

.xr-ui2-runtime .xrcc-catalog-table .xrcc-catalog-photo img,
.xr-ui2-runtime .xrcc-photo-table .xrcc-catalog-photo img {
  padding: 3px;
}

.xr-ui2-runtime .xrcc-table-note {
  margin-top: 4px;
}

.xr-ui2-runtime .xrcc-focused-editor > .form-panel,
.xr-ui2-runtime .xrcc-focused-editor > .equipment-editor-v5 {
  margin-top: 0;
}

.xr-ui2-runtime .xr2-clients-view > .embedded-import-panel,
.xr-ui2-runtime .xr2-catalog-view > .embedded-import-panel,
.xr-ui2-runtime .xr2-clients-view > .trash-panel {
  margin: 0;
}

@media (max-width: 1380px) {
  .xr-ui2-runtime .xrcc-client-grid,
  .xr-ui2-runtime .xrcc-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .xr-ui2-runtime .xrcc-cabinet-grid {
    grid-template-columns: 1fr;
  }

  .xr-ui2-runtime .xrcc-catalog-toolbar .xr2-toolbar-right {
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .xr-ui2-runtime .xrcc-client-grid,
  .xr-ui2-runtime .xrcc-catalog-grid,
  .xr-ui2-runtime .xrcc-lookup-grid {
    grid-template-columns: 1fr;
  }

  .xr-ui2-runtime .xrcc-client-facts,
  .xr-ui2-runtime .xrcc-stock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xr-ui2-runtime .xrcc-history-row {
    grid-template-columns: 1fr;
  }

  .xr-ui2-runtime .xrcc-cabinet-actionbar,
  .xr-ui2-runtime .xrcc-client-card .xrcc-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .xr-ui2-runtime .xrcc-cabinet-actionbar .xr2-btn,
  .xr-ui2-runtime .xrcc-client-card .xrcc-card-actions .xr2-btn {
    width: 100%;
  }

}

/* === XR R4C CLIENTS + CATALOG ON UI2 CORE END === */
