/*
 * The page of one server (js/components/server-view.js and its tabs). Everything here is layout of that page, built
 * from the tokens of the design system; colours come from the tokens alone, so both themes follow by themselves.
 */

.sv-page {
  min-width: 0;
}

.sv-skeleton-head {
  display: flex;
  align-items: center;
  gap: var(--ui-space-4);
}

.sv-skeleton-head__icon {
  flex: none;
  width: 2.5rem;
}

.sv-skeleton-head__text {
  flex: 0 1 20rem;
}

/* Small pieces of text the tabs share */

.sv-sub {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

.sv-strong {
  color: var(--ui-text);
  font-weight: var(--ui-weight-semibold);
}

.sv-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sv-grow {
  flex: 1;
}

.sv-gap {
  margin: var(--ui-space-4) 0 0;
}

.sv-gap-below {
  margin-bottom: var(--ui-space-3);
}

/* Why a button cannot be pressed, in words beside it. */
.sv-why {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  text-align: left;
}

.sv-why--block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ui-modal__footer .sv-why {
  flex: 1 1 12rem;
  margin-right: auto;
}

.ui-form__actions .sv-why {
  flex: 1 1 100%;
  text-align: right;
}

.sv-link-button {
  margin: 0;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.sv-link-button:focus-visible {
  outline: none;
  border-radius: var(--ui-radius-sm);
  box-shadow: var(--ui-focus-ring);
}

/* A remark that belongs to one fact: an icon in the tone of the remark, and the words. */
.sv-note {
  display: flex;
  align-items: flex-start;
  gap: var(--ui-space-2);
  margin: var(--ui-space-2) 0 0;
  border: 1px solid var(--tone-border);
  border-radius: var(--ui-radius-md);
  padding: var(--ui-space-2) var(--ui-space-3);
  background: var(--tone-bg);
  color: var(--ui-text);
  font-size: var(--ui-text-sm);
  overflow-wrap: anywhere;
}

.sv-note > .ui-icon {
  margin-top: 0.1875rem;
  color: var(--tone-text);
}

/* The alert above the tabs */

.sv-attention {
  margin-bottom: var(--ui-space-5);
}

.sv-attention__more {
  display: block;
  margin-top: var(--ui-space-1);
  color: var(--ui-text-muted);
}

/* What needs attention, as a list on the overview */

.sv-issues {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-issue {
  display: flex;
  align-items: flex-start;
  gap: var(--ui-space-3);
  padding: var(--ui-space-3) 0;
  border-top: 1px solid var(--ui-border);
}

.sv-issue:first-child {
  border-top: 0;
  padding-top: 0;
}

.sv-issue:last-child {
  padding-bottom: 0;
}

.sv-issue > .ui-chip {
  flex: none;
  min-width: 6.25rem;
}

.sv-issue__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sv-issue__title {
  font-weight: var(--ui-weight-medium);
}

.sv-issue__detail {
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  overflow-wrap: anywhere;
}

/* The facts of a server: what it is, what is wanted, what is wrong with it, and the way to change it */

.sv-facts {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-fact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--ui-space-3);
  align-items: center;
  padding: var(--ui-space-3) 0;
  border-top: 1px solid var(--ui-border);
}

.sv-fact:first-child {
  border-top: 0;
  padding-top: 0;
}

.sv-fact:last-child {
  padding-bottom: 0;
}

.sv-fact__label {
  grid-column: 1;
  grid-row: 1;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  color: var(--ui-text-subtle);
  font-size: var(--ui-text-xs);
  font-weight: var(--ui-weight-medium);
}

.sv-fact__side {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--ui-space-1);
  margin: -0.25rem -0.5rem -0.25rem 0;
}

.sv-fact__side > .ui-chip {
  margin-right: 0.5rem;
}

.sv-fact__body {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
}

.sv-fact__value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ui-space-2);
  margin: 0;
  color: var(--ui-text);
  font-weight: var(--ui-weight-medium);
  overflow-wrap: anywhere;
}

.sv-fact__hint {
  margin: 2px 0 0;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
  overflow-wrap: anywhere;
}

/* A hint that holds a chip or a way on beside its words */
.sv-fact__hint--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ui-space-1) var(--ui-space-2);
  margin-top: var(--ui-space-1);
}

/* Times of day and addresses as small tokens in a sentence */

.sv-times {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--ui-space-1);
  vertical-align: baseline;
}

.sv-time {
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  padding: 0 0.375rem;
  background: var(--ui-surface-sunken);
  color: var(--ui-text);
  font-size: var(--ui-text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 1.25rem;
}

.sv-time-field {
  max-width: 9rem;
}

/* A second part inside a card or a panel, set off by a line */

.sv-divided {
  margin-top: var(--ui-space-5);
  border-top: 1px solid var(--ui-border);
  padding-top: var(--ui-space-5);
}

.sv-card-toolbar {
  padding: var(--ui-space-4) var(--ui-space-5) 0;
}

.sv-card-alert {
  margin: var(--ui-space-4) var(--ui-space-5) 0;
}

.sv-fold {
  border-top: 1px solid var(--ui-border);
  padding: var(--ui-space-2) var(--ui-space-3);
}

.sv-foot {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-2);
  min-width: 0;
}

.sv-foot__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ui-space-2);
}

.sv-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ui-space-2) var(--ui-space-4);
}

/* Six periods do not fit a phone: the row scrolls inside itself, the page never does. */
.sv-periods {
  max-width: 100%;
  overflow-x: auto;
}

/* The base: where it stands, and one run by section */

.sv-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ui-space-4);
}

.sv-summary__state {
  flex: 1 1 22rem;
  min-width: 0;
}

.sv-summary__text {
  margin: var(--ui-space-2) 0 0;
  font-weight: var(--ui-weight-medium);
}

.sv-summary__facts {
  margin: var(--ui-space-1) 0 0;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

.sv-summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
}

.sv-run {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-4);
}

.sv-run__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ui-space-3);
}

.sv-report {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-5);
}

.sv-report__section {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
}

.sv-report__section + .sv-report__section {
  border-top: 1px solid var(--ui-border);
  padding-top: var(--ui-space-5);
}

.sv-report__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
}

.sv-details {
  margin: 0;
  border-top: 1px solid var(--ui-border);
  padding-top: var(--ui-space-3);
  color: var(--ui-text-subtle);
  font-size: var(--ui-text-xs);
}

/* People */

.sv-people {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-person {
  display: flex;
  align-items: center;
  gap: var(--ui-space-3);
  min-width: 0;
}

.sv-person__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* The base settings panel */

.sv-group {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
}

.sv-fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--ui-border);
  padding: var(--ui-space-5) 0 0;
}

.sv-fieldset__legend {
  float: left;
  width: 100%;
  margin: 0 0 var(--ui-space-1);
  padding: 0;
  color: var(--ui-text);
  font-size: var(--ui-text-md);
  font-weight: var(--ui-weight-semibold);
}

.sv-fieldset > .sv-sub {
  clear: both;
  margin: 0 0 var(--ui-space-4);
}

.sv-picks {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-pick {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ui-space-3);
}

.sv-preview {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-3);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  padding: var(--ui-space-4);
  background: var(--ui-surface-sunken);
}

.sv-preview__line {
  margin: 0;
}

.sv-preview > .sv-sub {
  margin: 0;
}

/* Open alerts */

.sv-alerts {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-alert {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) auto;
  gap: var(--ui-space-2) var(--ui-space-4);
  align-items: start;
  padding: var(--ui-space-4) 0;
  border-top: 1px solid var(--ui-border);
}

.sv-alert:first-child {
  border-top: 0;
  padding-top: 0;
}

.sv-alert:last-child {
  padding-bottom: 0;
}

.sv-alert > .ui-chip {
  justify-self: start;
}

.sv-alert__text {
  min-width: 0;
}

.sv-alert__title {
  margin: 0;
  font-weight: var(--ui-weight-semibold);
}

.sv-alert__headline {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.sv-alert__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--ui-space-5);
  margin: var(--ui-space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--ui-text-sm);
}

.sv-alert__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ui-space-2);
  margin: var(--ui-space-2) 0 0;
  color: var(--ui-text-muted);
  font-size: var(--ui-text-sm);
}

.sv-alert__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--ui-space-2);
  max-width: 14rem;
}

@media (max-width: 40rem) {
  .sv-alert {
    grid-template-columns: minmax(0, 1fr);
  }

  .sv-alert__actions {
    justify-content: flex-start;
    max-width: none;
  }

  .sv-issue {
    flex-wrap: wrap;
  }

  .sv-issue__text {
    flex-basis: 100%;
    order: 2;
  }

  .sv-issue > .ui-btn {
    order: 3;
  }
}
