/*
 * The Administrators screen: the people and their keys, the base of every server, and the panels that show one
 * person or the base of one server (with its form and its report). Everything here is layout around the components
 * of js/ui and uses the tokens of css/design only; a class starts with ad-.
 */

/* What a role may not do here, said once and quietly */

.ad-note {
  display: flex;
  align-items: flex-start;
  gap: var(--ui-space-2);
  margin: 0;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  line-height: var(--ui-leading);
}

.ad-note .ui-icon {
  margin-top: 3px;
}

/* The two lists */

.ad-toolbar {
  padding: var(--ui-space-4) var(--ui-space-5) 0;
}

.ad-toolbar__why {
  margin: calc(-1 * var(--ui-space-2)) 0 var(--ui-space-4);
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

@media (min-width: 640px) {
  .ad-toolbar__why {
    text-align: right;
  }
}

.ad-lead {
  margin: 0 0 var(--ui-space-4);
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  line-height: var(--ui-leading);
}

.ad-lead__set {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-1) var(--ui-space-2);
  margin-left: var(--ui-space-1);
  color: var(--ui-text);
  vertical-align: middle;
}

.ad-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ad-stack--cell {
  align-items: flex-start;
}

.ad-sub {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  overflow-wrap: normal;
}

.ad-person {
  display: flex;
  align-items: center;
  gap: var(--ui-space-3);
  min-width: 0;
}

.ad-person__name {
  color: var(--ui-text);
  font-weight: var(--ui-weight-semibold);
}

.ad-person__name--off {
  color: var(--ui-text-muted);
}

.ad-key,
.ad-access {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-1) var(--ui-space-2);
}

.ad-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-1) var(--ui-space-2);
}

.ad-name__link {
  color: var(--ui-text);
  font-weight: var(--ui-weight-semibold);
  text-decoration: none;
  overflow-wrap: normal;
}

.ad-name__link:hover {
  color: var(--ui-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.ad-marks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ui-space-1);
  margin-top: 2px;
}

/* Folded to cards on a phone, a cell reads from the right: its lines follow. */
@container (max-width: 34rem) {
  .ad-stack--cell {
    align-items: flex-end;
    text-align: right;
  }

  .ad-key,
  .ad-access,
  .ad-marks {
    justify-content: flex-end;
  }
}

/* A panel from the side: one person, or the base of one server */

.ad-panel {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-6);
}

.ad-panel__section {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
}

.ad-panel__section + .ad-panel__section {
  border-top: 1px solid var(--ui-border);
  padding-top: var(--ui-space-5);
}

.ad-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-space-3);
  min-height: var(--ui-control-sm);
}

.ad-panel__state,
.ad-panel__actions,
.ad-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
}

.ad-panel__where {
  color: var(--ui-text);
  font-weight: var(--ui-weight-medium);
}

.ad-panel__text {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  line-height: var(--ui-leading);
}

.ad-list,
.ad-why {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-wrap: anywhere;
}

.ad-why {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

.ad-why strong {
  color: var(--ui-text);
  font-weight: var(--ui-weight-medium);
}

/* People as rows: the administrators of a server */

.ad-rows {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ad-rows__row {
  display: flex;
  align-items: center;
  gap: var(--ui-space-3);
  border-top: 1px solid var(--ui-border);
  padding: var(--ui-space-2) 0;
}

.ad-rows__row:first-child {
  border-top: 0;
}

.ad-rows__row--out .ad-rows__name {
  color: var(--ui-text-muted);
}

.ad-rows__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ad-rows__name {
  color: var(--ui-text);
  font-weight: var(--ui-weight-medium);
}

.ad-rows__sub {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

/* SSH keys */

.ad-keys {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ad-keys__row {
  display: flex;
  align-items: flex-start;
  gap: var(--ui-space-3);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  padding: var(--ui-space-3) var(--ui-space-3) var(--ui-space-3) var(--ui-space-4);
  background: var(--ui-surface-sunken);
}

.ad-keys__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ad-keys__top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
}

.ad-keys__comment {
  color: var(--ui-text);
  font-weight: var(--ui-weight-medium);
  overflow-wrap: anywhere;
}

.ad-keys__print {
  color: var(--ui-text);
}

.ad-keys__sub {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

.ad-keys__actions {
  flex: none;
  display: inline-flex;
  gap: var(--ui-space-1);
}

.ad-keys__add {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
  margin-top: var(--ui-space-2);
}

.ad-keys__read {
  display: flex;
  align-items: flex-start;
  gap: var(--ui-space-2);
  margin: 0;
  color: var(--ui-good-text);
  font-size: var(--ui-text-sm);
  overflow-wrap: anywhere;
}

.ad-keys__read .ui-icon {
  margin-top: 3px;
}

/* What a change does to the servers, shown in the question before it is saved */

.ad-impact {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
  margin-top: var(--ui-space-3);
}

.ad-impact__lead {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

.ad-impact__list {
  display: flex;
  flex-direction: column;
  max-height: 16rem;
  margin: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  padding: 0 var(--ui-space-3);
  list-style: none;
  overflow-y: auto;
}

.ad-impact__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ui-space-1) var(--ui-space-2);
  border-top: 1px solid var(--ui-border);
  padding: var(--ui-space-2) 0;
}

.ad-impact__row:first-child {
  border-top: 0;
}

.ad-impact__server {
  color: var(--ui-text);
  font-weight: var(--ui-weight-semibold);
}

.ad-impact__then {
  flex-basis: 100%;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  overflow-wrap: anywhere;
}

/* What "Apply to all out of date" will do per server, shown in its question */

/* What went wrong with an answer to a question, under the question. */
.ad-ask-problem {
  margin-top: var(--ui-space-3);
}

.ad-plan {
  max-height: 22rem;
  margin-top: var(--ui-space-4);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  padding: var(--ui-space-3);
  overflow-y: auto;
}

.ad-base-form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
}

.ad-base-form__why {
  flex: 1;
  min-width: 12rem;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}
