.track__span {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

.linkish {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brass);
  font: inherit;
  font-size: 1.02rem;
  text-align: left;
  cursor: pointer;
}

.linkish:hover {
  text-decoration: underline;
}

/* A contact channel card: the values, the primary one marked, and a way to
   add another — the shape a contact record needs rather than a form field. */
.channel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.channel-list {
  display: grid;
  gap: 0.55rem;
}

.channel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 0.75rem;
  align-items: center;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.channel:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.channel[data-clickable],
.lease[data-clickable] {
  cursor: pointer;
}

.lease[data-clickable]:hover .lease__name {
  color: var(--brass);
}

.channel[data-clickable]:hover .channel__value {
  color: var(--brass);
}

.channel__value {
  font-size: 1rem;
  overflow-wrap: anywhere;
  transition: color 120ms ease;
}

.channel__meta {
  grid-column: 1;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.channel .badge {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.linkish--small {
  font-size: 0.82rem;
}

/* --- The accounts a contact pays from (#111) --- */
.konto-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.konto {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.konto:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.konto__iban {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/*
  One badge sits in the top-right cell. Several have to share it: pinning each
  of them to `grid-column: 2 / grid-row: 1` stacked them on top of one another,
  so a period read `8026 abgerechnet` — two badges drawn over each other.
*/
.konto__badges {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.konto > .badge {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.konto__meta {
  grid-column: 1 / -1;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.konto__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.3rem;
}

/* --- IBAN proposals harvested from the payment stream (#84) --- */
.vorschlag-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.vorschlag {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.vorschlag__iban {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.vorschlag .badge {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.vorschlag__meta,
.vorschlag__zahler {
  grid-column: 1 / -1;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.vorschlag__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.vorschlag--beantwortet .vorschlag__iban {
  color: var(--text-dim);
}

.record-form {
  display: grid;
  gap: 1.1rem;
}

.record-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: 1rem;
}

/* A control and the checkbox that qualifies it. Closer than two fields are to
   each other — the checkbox is about the control above it, not a field of its
   own — and not flush, which is what it read as when the grid that used to
   carry it was dropped. */
.record-form__stack {
  display: grid;
  gap: 0.6rem;
}

/*
  A button is as wide as its label. Flex items shrink by default and `.btn` sets
  `white-space: nowrap`, so a row that did not fit cut the text off inside the
  button instead of wrapping the row: "Schlüssel hinzufügen" and "Lieferstelle
  entfernen" were both clipped at 160 px of a 167 px label. German labels are
  long and the sheet is narrow, so this row has to wrap rather than squeeze.
*/
.record-form__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.7rem;
  padding-top: 0.2rem;
}

.record-form__actions .btn {
  flex: none;
}

/* The tools that fill or clear a form, as against the band that saves it: they
   belong at the reading edge, beside the fields they act on, not beside Save. */
.record-form__actions--links {
  justify-content: flex-start;
}

@media (max-width: 860px) {
  /* Two rows: the band takes what it needs, the screen takes the rest. On the
     wide layout's single `1fr` row the band was squeezed to nothing and painted
     over the page head. */
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .rail {
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  /* A line of its own that scrolls sideways. Wrapped in beside the rest it
     stood 466 px tall on a 932 px phone, and the shell is a fixed height now,
     so what the band takes comes out of the screen the work is on. */
  .rail__nav {
    order: 4;
    display: flex;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin: 0;
    min-height: auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  /* A share of the line and one line of text, where the rail proper gives the
     card the whole column and three. Qualified by `.rail` because
     `.mandant__name` is set again in a part that loads after this one, and at
     equal specificity that cascade wins. */
  .rail .mandant {
    flex: 1 1 0;
    min-width: 0;
    max-width: 15rem;
  }

  .rail .mandant__name {
    -webkit-line-clamp: 1;
  }

  /* A scrolling row reads as one list without the spines. Hidden rather than
     dropped: they keep their `data-i18n` and both translations for the rail. */
  .rail__section {
    display: none;
  }

  .rail__link {
    flex: none;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .rail__link.is-active {
    border-left: 0;
    border-bottom-color: var(--brass);
  }

  .rail__foot {
    order: 3;
    margin-left: auto;
    grid-auto-flow: column;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0;
    border-top: 0;
  }

  .rail__id {
    display: none;
  }

  .usermenu__pop {
    top: 100%;
    bottom: auto;
    left: auto;
    right: 0;
    width: 15rem;
    margin: 0.4rem 0 0;
  }

  .toolbar__actions {
    margin-left: 0;
  }
}

@media (max-width: 620px) {
  .record__head {
    align-items: flex-start;
  }

  .record__actions {
    width: 100%;
  }

  .record__actions .btn {
    flex: 1;
  }

  /* The head's actions run the full width here, so the menu goes with them.
     Left where it stands, its panel hangs off the left edge: it opens from its
     right corner, and that corner is 208px from the left of a 430px window. */
  .record__menu,
  .record__menu .menu,
  .record__menu .menu__trigger {
    width: 100%;
  }

  .record__menu .menu__pop {
    left: 0;
    right: 0;
  }

  /* `flex: 1` is `1 1 0%`, so every button got an equal share of the row no
     matter how long its label was — fine for the two-button case it was written
     for, and at three it clamped each to 107px while `white-space: nowrap` spilled
     the text past the card. `auto` starts each button at its own content width and
     lets the wrap already on the container do the rest. */
  .record-form__actions .btn {
    flex: 1 1 auto;
  }
}

/* Several parties on one tenancy — a Wohngemeinschaft stacks rather than
   running together as one string. */

/* --- The login a Lieferant signs in with (#388) --- */

.vendor-access {
  display: grid;
  gap: 1rem;
}

/* Shown once and never again, so it gets a frame of its own rather than a line
   among the facts. The brass edge is the same one an unsaved change carries. */
.vendor-access__link {
  display: grid;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--brass);
  border-radius: var(--r-md);
  background: var(--sunk);
}

.vendor-access__link input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.vendor-access__link .btn {
  justify-self: start;
}

/* --- Addresses the helpdesk offers (#470) --- */
/* The bar was written for two short words and grew a third and a longer one.
   `wrap` and `flex-shrink: 0` are both load-bearing: without the second, flex
   squeezes a button narrower than its own label and `white-space: nowrap` pushes
   the text out of the box it is in — measured at 176 px of label in a 162 px
   button in the detail sheet, which is 496 px wide (#475). */
.adressen__antwort {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.adressen__antwort .btn {
  flex: 0 0 auto;
  padding: 0.28rem 0.62rem;
  font-size: 0.85rem;
}

.adressen__fehler {
  align-self: center;
  color: var(--neg);
  font-size: 0.82rem;
}
