/* Sales intake / reconciliation / health workbench. Reuses the tokens from
   app.css and the list/detail/form primitives of catalog.css (cat-*). */
.sx-source {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto auto;
  gap: 8px 12px;
  align-items: end;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sx-scope-field {
  min-width: 0;
}

.sx-scope-field span {
  font-size: 0.84rem;
  font-weight: 600;
}

.sx-scope-info {
  grid-column: 1 / -1;
  min-width: 0;
}

.sx-scope-info:empty {
  display: none;
}

.sx-scope-info p {
  margin: 0 0 8px;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.sx-scope-line {
  color: var(--ink);
}

.sx-single {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 22px 28px;
  display: grid;
  gap: 16px;
  min-width: 0;
  align-content: start;
}

.sx-single > h2 {
  margin: 0;
}

.sx-single .detail-top {
  margin-bottom: 0;
}

/* Tables scroll inside their own region; the page never scrolls sideways. */
.sx-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.sx-table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 640px;
}

.sx-table th,
.sx-table td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.sx-table th {
  position: sticky;
  top: 0;
  background: var(--soft);
  color: var(--muted);
  font-weight: 650;
  font-size: 0.78rem;
  white-space: nowrap;
}

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

.sx-table small {
  display: block;
}

.sx-num {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Unknown is visibly different from zero. */
.sx-unknown {
  color: var(--warn);
  font-style: italic;
  font-weight: 500;
}

.sx-neg {
  color: var(--danger);
  font-weight: 650;
}

.sx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.sx-form-ctx {
  padding: 10px 12px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sx-form-ctx .cat-kv {
  margin-top: 6px;
}

.sales .cat-item .sx-row {
  margin: 2px 0;
}

.sales .cat-list-plain > li {
  min-width: 0;
}

.sales .cat-event > small {
  overflow-wrap: anywhere;
}

.sales .cat-results {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.sales .cat-results:empty {
  border: 0;
}

.sales .cat-radio-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 22px;
  flex: none;
  accent-color: var(--accent);
}

.sales .cat-radio-row.cat-field {
  display: flex;
}

.sales .cat-detail,
.sales .cat-list-panel {
  min-width: 0;
}

@media (max-width: 900px) {
  .sx-source {
    grid-template-columns: minmax(0, 1fr);
  }

  .sx-single {
    padding: 16px 14px 24px;
  }
}

@media (max-width: 650px) {
  .sx-table {
    min-width: 560px;
  }

  .sales .detail-top {
    flex-direction: column;
  }
}
