/* z-index 100 = Modal-Ebene, über dem Schleier `.scrim` (90). */
.cust-drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  bottom: 0;
  animation: cust-drawer-in var(--motion-slow) var(--ease-out);
}
@keyframes cust-drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: none;
  }
}
/* Die Reduktions-Regel des Systems hängt an `.ui`, das Dashboard trägt die Klasse nicht. */
@media (prefers-reduced-motion: reduce) {
  .cust-drawer {
    animation-duration: var(--motion-off);
  }
}
/* `[hidden]` ist UA-Stil und verliert gegen jede Klasse, die `display` setzt. */
.cust-drawer[hidden],
.cust-scrim[hidden],
.cust-modal[hidden] {
  display: none;
}
.cust-drawer .drawer__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-group);
}
.cust-drawer__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-inset);
  padding: var(--space-inset) var(--space-group);
  border-top: 1px solid var(--border-subtle);
}
/* Abgesetzt, damit der rote Knopf nicht neben Speichern steht. */
.cust-drawer__delete {
  margin-right: auto;
}
/* `[hidden]` verliert sonst gegen das `display` von `.btn`. */
.cust-drawer__delete[hidden] {
  display: none;
}
.cust-search {
  flex: 1;
  max-width: 320px;
  margin-right: auto;
}

/* Die Tabelle scrollt selbst und darf das Panel nie verbreitern. */
#customers .tbl-wrap {
  min-width: 0;
  max-width: 100%;
}

/* Lange Stammdaten dürfen nicht die gesamte Tabelle auf mehrere Bildschirmbreiten ziehen. */
#customers .table {
  table-layout: fixed;
  min-width: 0;
  width: 100%;
}
#customers .table th,
#customers .table td {
  padding: var(--space-inset);
  overflow-wrap: anywhere;
}
#customers .table th:nth-child(1) { width: 5%; }
#customers .table th:nth-child(2) { width: 13%; }
#customers .table th:nth-child(3) { width: 29%; }
#customers .table th:nth-child(4) { width: 17%; }
#customers .table th:nth-child(5) { width: 6%; }
#customers .table th:nth-child(6) { width: 18%; }
#customers .table th:nth-child(7) { width: 12%; }
.cust-contact { color: var(--muted-foreground); font-size: var(--text-1); margin-top: 4px; }
.cust-detail-consent { display: flex; flex-direction: column; gap: 8px; margin-block: 16px; }
#customers { container-type: inline-size; }
@container (max-width: 900px) {
  #customers .table :is(th, td):nth-child(4),
  #customers .table :is(th, td):nth-child(5) { display: none; }
  #customers .table th:nth-child(1) { width: 6%; }
  #customers .table th:nth-child(2) { width: 17%; }
  #customers .table th:nth-child(3) { width: 35%; }
  #customers .table th:nth-child(6) { width: 24%; }
  #customers .table th:nth-child(7) { width: 18%; }
}
#customers .table tbody tr { background: var(--surface); }
#customers .table tbody tr:hover { background: var(--surface-hover); }
#customers .table tbody tr[aria-selected="true"] { background: var(--surface-active); }
#customers .table td:last-child:not([colspan]) { background: inherit; }
#customers .table td:last-child .btn { white-space: nowrap; }

.cust-open {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  width: 100%;
  height: auto;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
#customers .cust-bulk,
#customers .cust-bulk__actions {
  flex-wrap: wrap;
}

.cust-wa {
  display: flex;
  flex-direction: column;
  gap: var(--space-stack);
}
.cust-wa[hidden] {
  display: none;
}
.cust-wa__add {
  display: flex;
  gap: var(--space-stack);
}
.cust-wa__add .input {
  flex: 1;
  min-width: 0;
}
.wa-row {
  display: flex;
  align-items: center;
  gap: var(--space-stack);
  padding: var(--space-stack) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.wa-row:last-child {
  border-bottom: none;
}
.wa-row__num {
  font-family: var(--font-mono);
  font-size: var(--text-1);
}
.wa-row__name {
  font-size: var(--text-1);
  line-height: var(--leading-1);
}
.wa-row__by {
  margin-right: auto;
}

.cust-head-actions {
  display: flex;
  gap: var(--space-stack);
  margin-left: auto;
}

@media (max-width: 760px) {
  #customers > .panel > .panel__head {
    flex-wrap: wrap;
    align-items: center;
  }
  #customers .panel__title {
    min-width: 0;
  }
  #customers .cust-search {
    flex: 1 1 160px;
    min-width: 0;
    margin-right: 0;
  }
  #customers .cust-head-actions {
    flex: 1 1 100%;
    min-width: 0;
    margin-left: 0;
    flex-wrap: wrap;
  }
  #customers .cust-head-actions .btn {
    flex: 1 1 140px;
    min-width: 0;
  }
}
.cust-bulk[hidden] {
  display: none;
}
.cust-bulk__count {
  font-size: var(--text-1);
  line-height: var(--leading-1);
  color: var(--muted-foreground);
}
.cust-bulk__actions {
  display: flex;
  gap: var(--space-stack);
  margin-left: auto;
}

/* In der Zeile `--control-md` statt Feldhöhe, sonst sprengt eine Zeile die nächste. */
.select--row {
  height: var(--control-md);
  width: auto;
}
/* Der Umschlag ist sonst ein Block über die volle Breite und reisst die Tabellenspalte auf. */
.select-wrap:has(.select--row) {
  display: inline-block;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-stack);
}
.leer {
  color: var(--muted-foreground);
}

.tbl-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-inset);
  padding: var(--space-group);
}
.tbl-skeleton[hidden],
.tbl-state[hidden],
.tbl-wrap[hidden] {
  display: none;
}

.csv-map {
  display: flex;
  flex-direction: column;
  gap: var(--space-group);
}
.csv-map-prev {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.csv-map-prev.is-empty {
  font-style: italic;
}
.csv-modal__result {
  margin-right: auto;
}

.users-invite {
  margin-bottom: var(--space-group);
}
.users-invite__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-group);
  max-width: 480px;
}
.users-invite__go {
  align-self: flex-start;
}

.cust-optin {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-stack);
}
