/* b2b-admin: the admin tab "Geschäftskunden", the B2B part of the product editor and the B2B badge in the product list */

/* ---------- the company table ---------- */

#b2b-table td {
  vertical-align: top;
}

.b2b-line {
  display: block;
  color: var(--color-charcoal-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-ui);
  overflow-wrap: anywhere;
}

/* phone: the table is a stack of cards (styles.css); the small lines under a value take a row of their own, like the dates in the order list */
@media (max-width: 40rem) {
  .orders-table td .b2b-line {
    flex: 1 0 100%;
    text-align: right;
  }
}

#b2b-table td .badge {
  margin-top: 0.25rem;
}

#b2b-table td .text-button {
  min-height: var(--touch);
}

/* ---------- the decision under a row ---------- */

.b2b-detail-row > td {
  padding: var(--space-3) var(--space-2);
  background: color-mix(in srgb, var(--color-charcoal) 4%, var(--color-porcelain));
  text-align: left;
}

.b2b-decision {
  display: grid;
  gap: var(--space-3);
  max-width: 44rem;
}

.b2b-partners {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.b2b-partners legend {
  padding: 0;
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.b2b-options {
  display: grid;
  gap: var(--space-1);
}

.b2b-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: var(--border-hairline);
  font-size: var(--text-sm);
  line-height: var(--leading-ui);
}

.b2b-choice-label {
  flex: 1 1 14rem;
  min-width: 0;
  align-items: center;
  overflow-wrap: anywhere;
}

.b2b-choice-label input {
  margin-top: 0;
  flex: none;
}

.b2b-choice .text-button {
  min-height: var(--touch);
}

.b2b-choice .field-hint {
  flex-basis: 100%;
  margin: 0 0 var(--space-1);
}

.b2b-id-input {
  width: 9rem;
  min-height: var(--touch);
  padding: 0 0.6rem;
  font: inherit;
  color: var(--color-charcoal);
  background: var(--color-porcelain);
  border: var(--border-hairline);
}

.b2b-preview:empty {
  display: none;
}

.b2b-preview {
  padding: var(--space-2);
  border: var(--border-hairline);
  background: var(--color-porcelain);
}

.b2b-preview-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.b2b-warnings {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
  font-size: var(--text-sm);
  line-height: var(--leading-ui);
  color: var(--color-error);
}

.b2b-warnings li {
  padding-left: var(--space-2);
  border-left: 3px solid currentColor;
}

.b2b-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  align-items: center;
}

.b2b-reject {
  display: grid;
  gap: var(--space-1);
  padding-top: var(--space-3);
  border-top: var(--border-hairline);
}

.b2b-reject .field {
  margin: 0;
}

.b2b-reject textarea {
  width: 100%;
}

/* ---------- the B2B part of the product editor ---------- */

.editor-b2b-sizes {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.editor-b2b-size {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2);
  border: var(--border-hairline);
  background: var(--color-field);
}

.editor-b2b-size-name {
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.editor-b2b-size-fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}

.editor-b2b-size-fields label {
  display: grid;
  gap: 0.25rem;
  font-size: var(--text-sm);
}

.editor-b2b-size-fields input {
  width: 7rem;
  min-height: var(--touch);
  padding: 0 0.6rem;
  font: inherit;
  color: var(--color-charcoal);
  background: var(--color-porcelain);
  border: var(--border-hairline);
}

.editor-b2b-size-fields input[aria-invalid="true"] {
  border-color: var(--color-error);
}

.editor-b2b-size-hint {
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--leading-ui);
  color: var(--color-charcoal-muted);
}

.editor-b2b-size-hint.is-bad {
  color: var(--color-error);
}

/* ---------- the B2B badge in the product list ---------- */

.badge-b2b {
  margin-left: 0.4rem;
  vertical-align: middle;
  color: var(--color-charcoal-muted);
}

/* ---------- purchase on invoice: the switch, the open invoices, the hold ---------- */

.b2b-invoice-choice,
.b2b-invoice-switch {
  display: grid;
  gap: var(--space-1);
  padding-top: var(--space-2);
}

.b2b-invoice-choice .field-hint,
.b2b-invoice-switch .field-hint,
.b2b-invoice-state {
  margin: 0;
}

.b2b-invoice-state {
  font-weight: var(--weight-medium);
}

#b2b-invoices {
  margin-top: var(--space-4);
}

#b2b-invoices-table td {
  vertical-align: top;
}

#b2b-invoices-table td.num {
  text-align: right;
}

#b2b-invoices-table .badge {
  margin-right: 0.4rem;
}

#b2b-invoices-table td .b2b-line {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-charcoal-muted);
}

.order-no .badge {
  margin-left: 0.4rem;
  vertical-align: middle;
}

.od-hold {
  display: grid;
  gap: var(--space-1);
  justify-items: start;
  margin-top: var(--space-2);
}

.od-hold p {
  margin: 0;
}
