/*
 * Bausteine aus docs/design.md. Maße aus docs/screens/*.html, Farben nur über var(--…) aus tokens.css.
 * Wo ein Baustein kleiner als 44 px gezeichnet ist, vergrößert ein unsichtbares ::after die Tippfläche.
 */

/* Kopfbereich: Gruppenname mit Wechsel, rechts der eigene Initialen-Kreis */

.app-header {
  height: var(--size-header);
  flex-shrink: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header__group {
  min-width: 0;
  min-height: var(--size-tap);
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-ink);
  font: var(--text-heading);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.app-header__group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header__group svg {
  flex-shrink: 0;
}

.app-header__group-text {
  min-width: 0;
  display: flex;
}

/* Nur in der Leiste links (ab 900 px, siehe application.css): Marke, Kachel, Mitgliederzahl, Doppelpfeil,
 * Name bei „Mein Zugang“. Am Handy mit display: none, damit Screenreader sie dort auch nicht vorlesen. */
.app-header--sidebar-only,
.account-link--sidebar-only,
.app-header .app-header__brand,
.app-header__tile,
.app-header__group-detail,
.app-header__chevrons,
.account-link__name {
  display: none;
}

/* „Mein Zugang“ ist am Handy nur der Initialen-Kreis, der Text bleibt für Screenreader. */
.account-link__text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* In einer Gruppe steht „Mein Zugang“ im Markup nach der Leiste. Am Handy sitzt er trotzdem oben rechts
 * im Kopf: so weit vom Rand und so groß wie zuvor als letztes Element des Kopfs, der Kopf hält den Platz frei. */
@media (max-width: 899.98px) {
  .app--sidebar {
    position: relative;
  }

  .app__sidebar > .app-header {
    padding-right: calc(20px + 40px + 12px);
  }

  .app__sidebar > .account-link {
    position: absolute;
    top: calc((var(--size-header) - 40px) / 2);
    right: 20px;
  }
}

/* Ab 900 px in der Leiste links (Rahmen in application.css): Marke, Gruppenwechsel als Zeile mit
 * Kachel und Mitgliederzahl, unten „Mein Zugang“ mit Initialen-Kreis, Namen und Beschriftung. */
@media (min-width: 900px) {
  .app__sidebar .app-header--sidebar-only {
    display: flex;
  }

  .app__sidebar .app-header__brand {
    padding: 0 8px;
    display: flex;
  }

  .app__sidebar .app-header__group,
  .app__sidebar .account-link {
    width: auto;
    height: 52px;
    padding: 0 8px;
    border-radius: var(--radius-row);
    background: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    font: var(--text-body);
    text-align: left;
  }

  .app__sidebar .app-header__group:hover,
  .app__sidebar .account-link:hover {
    background: var(--color-tint);
  }

  .app__sidebar .app-header__tile,
  .app__sidebar .account-link__initials {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--color-tint);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app__sidebar .app-header__tile {
    border-radius: 10px;
    font-weight: 700;
  }

  .app__sidebar .account-link__initials {
    border-radius: var(--radius-pill);
    font-weight: 600;
  }

  .app__sidebar .app-header__group-text,
  .app__sidebar .account-link__text {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .app__sidebar .account-link__text {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip-path: none;
    order: 1;
  }

  .app__sidebar .app-header__group-name,
  .app__sidebar .account-link__name {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app__sidebar .app-header__group-detail,
  .app__sidebar .account-link__text > :last-child {
    display: block;
    font: var(--text-tiny);
    color: var(--color-ink-2);
  }

  .app__sidebar .app-header__chevron {
    display: none;
  }

  .app__sidebar .app-header__chevrons {
    display: block;
    color: var(--color-ink-2);
  }
}

/* Statt des Gruppennamens ein Titel, z. B. in der Gruppenauswahl */
.app-header__title {
  min-width: 0;
  font: var(--text-heading);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Seitenkopf: runder Zurück-Knopf, Titel, rechts höchstens ein Knopf */

.page-header {
  height: var(--size-header);
  flex-shrink: 0;
  padding: 0 var(--space-page);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header__title {
  flex-grow: 1;
  min-width: 0;
  font: var(--text-heading);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Runder Knopf auf dem Grund: Zurück, Schließen, eigener Initialen-Kreis im Kopf */

.icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-card);
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: var(--text-small);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.icon-button::after {
  content: "";
  position: absolute;
  inset: -2px;
}

/* Karte */

.card {
  padding: var(--space-card);
  border-radius: var(--radius-card);
  background: var(--color-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card--list {
  min-height: 72px;
  padding: 12px 14px 12px 12px;
  border-radius: var(--radius-card-list);
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.card--menu {
  padding: 6px 8px;
  gap: 0;
}

/* Karte mit Text links und Knopf rechts, z. B. die Serie in Verwaltung → Termine */
.card--row {
  padding: 18px var(--space-card);
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

/* Schmale Listenkarte mit kleiner Datumskachel, z. B. Termine in der Verwaltung */
.card--compact {
  min-height: 64px;
  padding: 10px 14px 10px 10px;
}

/* Listenkarte mit Knopf, der auf schmalen Bildschirmen unter den Text rutscht (Korrektur in der Verwaltung) */
.card--wrap {
  flex-wrap: wrap;
  row-gap: 10px;
}

.card--wrap > .lines {
  flex: 1 1 150px;
}

.card--wrap > form {
  margin-left: auto;
}

/* Karte mit Überschrift, Feld und Knopf, z. B. die beiden Wege der Einladung */
.card--tight {
  gap: 12px;
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Überschrift über einer Gruppe von Karten, rechts ein Textknopf */

.section-header {
  margin-top: 14px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-header__title {
  font: var(--text-section);
}

.text-button {
  position: relative;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ink-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.text-button::after {
  content: "";
  position: absolute;
  inset: -6px 0;
}

.text-button-form {
  display: flex;
}

/* Satz unter einer Karte */

.note {
  padding: 2px 4px;
  font: var(--text-small);
  color: var(--color-ink-2);
}

/* Runder Schalter: aus getönt mit grauem Haken, an grün gefüllt */

.toggle {
  width: var(--size-tap);
  height: var(--size-tap);
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  color: var(--color-ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toggle svg {
  width: 20px;
  height: 20px;
}

.toggle--large {
  width: var(--size-toggle-large);
  height: var(--size-toggle-large);
}

.toggle--large svg {
  width: 26px;
  height: 26px;
}

/* An: der Schalter selbst, ein Kreis in einer Karte, die als Ganzes der Schalter ist, oder nur zur Anzeige */
.toggle[aria-pressed="true"],
[aria-pressed="true"] > .toggle,
.toggle--on {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

/* Nach Terminbeginn zeigt der Schalter den Stand nur noch an */
.toggle:disabled {
  cursor: default;
}

/* button_to steckt den Schalter in ein Formular, das ihn nicht größer machen soll */
.toggle-form {
  display: flex;
  flex-shrink: 0;
}

/* Die eigene Zusage im Termin-Detail: die ganze Karte ist der Schalter */
.rsvp-card {
  width: 100%;
  border: 0;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  color: var(--color-ink);
  font: var(--text-body);
  text-align: left;
}

button.rsvp-card {
  cursor: pointer;
}

/* Datumskachel: Tag groß, Monat klein */

.date-tile {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--radius-tile);
  background: var(--color-tint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.date-tile__day {
  font: var(--text-section);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.date-tile__month {
  font-size: 11px;
  color: var(--color-ink-2);
}

.date-tile--small {
  width: var(--size-tap);
  height: var(--size-tap);
}

.date-tile--small .date-tile__day {
  font-size: 16px;
}

/* Knöpfe: Hauptknopf fast schwarz, Nebenknopf getönt, beide als Pille */

.button {
  position: relative;
  min-height: var(--size-tap);
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: var(--text-body);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  background: var(--color-ink);
  color: var(--color-on-ink);
}

.button--secondary {
  background: var(--color-tint);
  color: var(--color-ink);
}

/* Auf dem Grund statt in einer Karte, z. B. „Bearbeiten“ im Seitenkopf */
.button--raised {
  background: var(--color-card);
  color: var(--color-ink);
}

.button--large {
  min-height: var(--size-field);
  font-size: 16px;
}

/* Im Seitenkopf 40 px hoch gezeichnet, Tippfläche trotzdem 44 px */
.button--small {
  min-height: 40px;
  font-size: 14px;
}

.button--small::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}

/* Mit Symbol vor dem Text, z. B. „+ Termin“ im Seitenkopf */
.button--icon {
  padding: 0 16px 0 12px;
}

.button--block {
  width: 100%;
  display: flex;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* button_to steckt den Knopf in ein Formular, das dann die Spalte füllt */
.button-row > form {
  display: flex;
  flex-direction: column;
}

/* Umschalter: getönte Pille, die gewählte Seite fast schwarz */

.segmented {
  padding: 3px;
  border-radius: 18px;
  background: var(--color-tint);
  display: inline-flex;
  flex-shrink: 0;
}

.segmented__option {
  position: relative;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 15px;
  background: none;
  color: var(--color-ink-2);
  font: var(--text-small);
  font-weight: 500;
  cursor: pointer;
}

.segmented__option::after {
  content: "";
  position: absolute;
  inset: -7px 0;
}

/* Als Link, z. B. Diagramm und Tabelle im Guthaben */
a.segmented__option {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.segmented__option[aria-current="true"],
.segmented__option[aria-pressed="true"] {
  background: var(--color-ink);
  color: var(--color-on-ink);
  font-weight: 600;
}

/* Menüzeile: runde getönte Fläche mit Symbol, Titel, Nebentext, Pfeil */

.menu-row {
  min-height: 64px;
  padding: 8px;
  border-radius: var(--radius-row);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-ink);
  text-decoration: none;
}

.menu-row__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-row__text {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-row__title {
  font-weight: 600;
}

.menu-row__subtitle {
  font: var(--text-small);
  color: var(--color-ink-2);
}

.menu-row__chevron {
  flex-shrink: 0;
  color: var(--color-ink-2);
}

/* Ohne Symbol, z. B. in „Mein Zugang“ */
.menu-row--plain {
  min-height: 56px;
  padding: 6px 12px;
}

/* Aktion in einer Menükarte: Titel und Nebentext, ganze Zeile als Knopf (Termin absagen, löschen) */

.action-row {
  width: 100%;
  min-height: 60px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-row);
  background: none;
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  font: var(--text-body);
  text-align: left;
  cursor: pointer;
}

.action-row__title {
  font-weight: 600;
}

.action-row__subtitle {
  font: var(--text-small);
  color: var(--color-ink-2);
}

/* Als Link, z. B. „Korrektur“ im Journal eines Mitglieds */
a.action-row {
  text-decoration: none;
}

.action-row--danger {
  color: var(--color-negative);
}

/* Getönte Zeile in einer Karte, die weiterführt (z. B. Initialen und Anzahl) */

.summary-row {
  min-height: var(--size-tap);
  padding: 0 12px;
  border-radius: var(--radius-row);
  background: var(--color-tint);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-ink);
  text-decoration: none;
}

.summary-row__label {
  flex-grow: 1;
  min-width: 0;
  font-weight: 600;
}

.summary-row svg {
  flex-shrink: 0;
  color: var(--color-ink-2);
}

/* Angaben in einer Karte: Beschriftung links, Wert rechts (Ort, Preis, Hinweis im Termin-Detail) */

.card--details {
  padding: var(--space-card) var(--space-card) 10px;
  gap: 10px;
}

.detail-list {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.detail-row {
  min-height: 40px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-row dt {
  flex-shrink: 0;
}

.detail-row__value {
  min-width: 0;
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: break-word;
}

/* Wer dabei ist: Namen als getönte Pillen mit Initialen-Kreis in zwei Spalten */

.card--attendees {
  padding: 16px var(--space-card);
  gap: 12px;
}

.name-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.name-pill {
  min-width: 0;
  height: var(--size-tap);
  padding: 0 12px 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.name-pill .avatar:not(.avatar--own) {
  background: var(--color-avatar);
}

.name-pill__label {
  min-width: 0;
  display: flex;
  gap: 4px;
}

.name-pill__suffix {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.name-pill__name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Gruppe: wer kommt wann. Eine Tabelle in einer Karte, Spalten 36 px breit, die Namen nehmen den Rest.
 * Sind es mehr Spalten, als hineinpassen, scrollt die Tabelle in ihrer Karte, nie die Seite. */

.section-header--top {
  margin-top: 0;
  align-items: baseline;
}

.card--roster {
  padding: 8px 12px 6px;
  gap: 0;
}

.roster-scroll {
  overflow-x: auto;
}

.roster {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

/* :where hält die Grundregel schwach, damit Spalten-Klassen sie ohne Verschachtelung überschreiben */
:where(.roster) th,
:where(.roster) td {
  position: relative;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.roster__dates > * {
  height: 46px;
}

/* Wird es eng, bricht die Ecke in zwei Zeilen um, statt gekürzt zu werden */
.roster__slot {
  padding-right: 6px;
  font: var(--text-small);
  line-height: 1.2;
  color: var(--color-ink-2);
  text-align: left;
  overflow-wrap: anywhere;
}

.roster__date {
  width: 36px;
  line-height: 1.15;
}

.roster__day,
.roster__month {
  display: block;
}

.roster__day {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.roster__month {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-ink-2);
}

.roster__counts > * {
  height: 34px;
  background: var(--color-tint);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.roster__counts > :first-child {
  padding-left: 10px;
  border-radius: 10px 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.roster__counts > :last-child {
  border-radius: 0 10px 10px 0;
}

/* Am Handy endet die Zeile vor den ausgeblendeten Spalten (only-wide) */
@media (max-width: 899.98px) {
  .roster__counts > :has(+ .only-wide) {
    border-radius: 0 10px 10px 0;
  }
}

.roster tbody > tr > * {
  height: 48px;
}

/* Rechts Luft, damit „(du)“ nicht am ersten Kreis klebt */
.roster__name {
  padding-left: 2px;
  padding-right: 6px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.roster__label {
  min-width: 0;
  display: flex;
  gap: 4px;
}

.roster__truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster__suffix {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Dabei: grüner Kreis mit Haken. Nicht dabei: leerer getönter Kreis. Die Bedeutung steht als Text daneben. */
.roster__mark {
  width: 24px;
  height: 24px;
  margin: 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  color: var(--color-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.roster__mark--in {
  background: var(--color-accent);
}

.roster__mark--small {
  width: 16px;
  height: 16px;
  margin: 0;
}

.roster-note {
  align-items: center;
  font: var(--text-tiny);
}

.roster-legend {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Unter 360 px: schmalere Spalten, damit die Namen Platz behalten */
@media (max-width: 359px) {
  .card--roster {
    padding-inline: 8px;
  }

  .roster__date {
    width: 30px;
  }
}

/* Eingabefeld: getönte Fläche ohne Rahmen, Beschriftung klein darüber */

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font: var(--text-small);
  color: var(--color-ink-2);
}

.field__input {
  width: 100%;
  height: var(--size-field);
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-tile);
  background: var(--color-tint);
  color: var(--color-ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.field__input::placeholder {
  color: var(--color-ink-2);
  opacity: 1;
}

.field__input:focus-visible {
  outline-offset: 0;
}

/* Mehrzeilig, z. B. eine Beschreibung */
.field__input--area {
  height: auto;
  min-height: var(--size-field);
  padding: 13px 14px;
  line-height: 1.35;
  resize: vertical;
}

/* Auswahl mit eigenem Pfeil statt dem des Browsers */
.field__select {
  position: relative;
  display: flex;
  align-items: center;
}

.field__select .field__input {
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
}

.field__select svg {
  position: absolute;
  right: 14px;
  color: var(--color-ink-2);
  pointer-events: none;
}

/* Datumsfelder: in schmalen Spalten bleibt das Kalender-Symbol sichtbar */
.field__input[type="date"] {
  min-width: 0;
  padding: 0 10px 0 14px;
}

.field__hint {
  font: var(--text-small);
  color: var(--color-ink-2);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* Zwei Datumsfelder passen erst ab 360 px nebeneinander, darunter stehen sie untereinander */
@media (max-width: 359px) {
  .field-row--dates {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Initialen-Kreis: getönt, der eigene fast schwarz */

.avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.avatar--own {
  background: var(--color-ink);
  color: var(--color-on-ink);
}

.avatar--medium {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.avatar--large {
  width: 40px;
  height: 40px;
  font: var(--text-small);
  font-weight: 600;
  line-height: 1;
}

/* Der eigene Kreis in „Mein Zugang“ */
.avatar--xl {
  width: var(--size-toggle-large);
  height: var(--size-toggle-large);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar {
  border: 2px solid var(--color-tint);
}

/* Auf getönter Fläche heben sich fremde Kreise mit --color-avatar ab */
.avatar-stack .avatar:not(.avatar--own) {
  background: var(--color-avatar);
}

.avatar-stack .avatar + .avatar {
  margin-left: -6px;
}

/* Kleine getönte Pille mit Text, z. B. „Gast ohne Konto“ */

.pill {
  min-height: 24px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

/* Die eigene Person oben in „Mein Zugang“: Initialen-Kreis, Name, darunter Marke oder E-Mail */

.profile {
  flex-direction: row;
  align-items: center;
}

.profile__text {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.profile__name {
  max-width: 100%;
  font: var(--text-heading);
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.profile__email {
  max-width: 100%;
  font: var(--text-small);
  overflow-wrap: anywhere;
}

/* Eine Einstellung in einer Karte: Beschriftung links, Umschalter rechts */

.setting {
  min-height: 64px;
  padding: 10px 14px 10px 20px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.setting__label {
  font-size: 15px;
  font-weight: 600;
}

/* Marke: grüner Kreis mit Haken und „bin dabei“ */

.brand {
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand__name {
  font: var(--text-heading);
  letter-spacing: -0.01em;
}

/* Seiten ohne Leiste (Anmelden, Login-Link gesendet): Marke oben, große Abstände */

.entry {
  padding-top: 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Einladung: dichter, damit alle drei Karten auf den ersten Blick zu sehen sind */
.entry--invitation {
  padding-top: 32px;
  gap: 16px;
}

.entry--invitation .brand {
  padding-bottom: 8px;
}

.intro {
  padding: 0 4px;
}

.text-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-wrap: break-word;
}

.text-block--tight {
  gap: 4px;
}

.text-hero {
  font: var(--text-title);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* Karte mit Symbol oben, z. B. „Schau in dein Postfach“ */
.card--message {
  padding-top: 28px;
  gap: 16px;
}

.icon-badge {
  width: var(--size-toggle-large);
  height: var(--size-toggle-large);
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hinweis nach einer Aktion, z. B. ein abgelaufener Link */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-row);
  background: var(--color-card);
  color: var(--color-ink);
}

.flash--alert {
  color: var(--color-negative);
}

.field__error {
  font: var(--text-small);
  color: var(--color-negative);
}

.field__input[aria-invalid="true"] {
  outline: 2px solid var(--color-negative);
  outline-offset: 0;
}

/* Guthaben: Restguthaben, Kacheln, Verlauf, Teilnahmequote */

.card--balance {
  gap: 8px;
}

.text-display {
  font: var(--text-display);
  letter-spacing: -0.02em;
}

/* Verbrauchsbalken: verbraucht von Beitrag */
.meter {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 6px;
  border: 0;
  border-radius: 4px;
  background: var(--color-track);
  overflow: hidden;
  appearance: none;
}

.meter::-webkit-progress-bar {
  border-radius: 4px;
  background: var(--color-track);
}

.meter::-webkit-progress-value {
  border-radius: 4px;
  background: var(--color-ink);
}

.meter::-moz-progress-bar {
  border-radius: 4px;
  background: var(--color-ink);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-stack);
}

.card--tile {
  padding: 16px;
  border-radius: var(--radius-card-list);
  gap: 2px;
}

.tile__value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: break-word;
}

/* Unter 360 px passt „Saisonende“ in 24 px nicht in die Kachel */
@media (max-width: 359px) {
  .card--tile {
    padding: 14px;
  }

  .tile__value {
    font-size: 19px;
  }
}

.card--chart {
  padding: 16px;
  gap: 10px;
}

.card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Verlaufsdiagramm, schwarz-weiß: tatsächlich durchgezogen, Prognose gestrichelt, gleichmäßig grau */
.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart__grid {
  fill: none;
  stroke: var(--color-grid);
  stroke-width: 1;
}

.chart__axis {
  fill: var(--color-ink-2);
  font-size: 11px;
}

.chart__uniform {
  fill: none;
  stroke: var(--color-ink-3);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.chart__actual,
.chart__forecast {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__forecast {
  stroke-dasharray: 5 4;
}

.chart__dot {
  fill: var(--color-ink);
  stroke: var(--color-card);
  stroke-width: 2;
}

.chart__value {
  fill: var(--color-ink);
  font-size: 12px;
  font-weight: 700;
}

.chart-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font: var(--text-tiny);
  color: var(--color-ink-2);
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Journal in der Tabellenansicht, ohne Trennlinien */
.journal {
  width: 100%;
  border-collapse: collapse;
  font: var(--text-small);
}

.journal th {
  padding: 0 0 6px;
  color: var(--color-ink-2);
  font-weight: 500;
  text-align: left;
}

.journal td {
  padding: 6px 0;
  vertical-align: top;
}

.journal th:not(:last-child),
.journal td:not(:last-child) {
  padding-right: 12px;
}

.journal__date {
  color: var(--color-ink-2);
  white-space: nowrap;
}

.journal__kind {
  display: block;
  font-weight: 600;
}

.journal__detail {
  display: block;
  color: var(--color-ink-2);
}

.journal .journal__amount {
  text-align: right;
  white-space: nowrap;
}

.card--rate {
  padding: 14px 16px;
  border-radius: var(--radius-card-list);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rate__title {
  font: var(--text-body);
  font-weight: 600;
}

.rate__value {
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

/* Leiste unten */

/* Im Markup steht die Leiste vor dem Inhalt (für die Leiste links am Desktop), angezeigt wird sie unten. */
.tab-bar {
  order: 1;
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  min-height: var(--size-nav);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-card);
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
}

.tab-bar__item {
  min-height: var(--size-nav);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--color-ink-2);
  font: var(--text-tiny);
  font-weight: 500;
  text-decoration: none;
}

.tab-bar__item svg {
  stroke-width: 1.6;
}

.tab-bar__item[aria-current="page"] {
  color: var(--color-ink);
  font-weight: 700;
}

.tab-bar__item[aria-current="page"] svg {
  stroke-width: 2.2;
}

/* Ab 900 px: Navigationspunkte untereinander in der Leiste links, der aktuelle getönt */
@media (min-width: 900px) {
  .app__sidebar .tab-bar {
    position: static;
    min-height: 0;
    padding: 0;
    background: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .app__sidebar .tab-bar__item {
    min-height: var(--size-tap);
    padding: 0 12px;
    border-radius: var(--radius-tile);
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font: var(--text-body);
    font-weight: 500;
  }

  .app__sidebar .tab-bar__item svg {
    width: 20px;
    height: 20px;
  }

  .app__sidebar .tab-bar__item:hover {
    color: var(--color-ink);
  }

  .app__sidebar .tab-bar__item[aria-current="page"] {
    background: var(--color-tint);
    font-weight: 700;
  }
}

/* Kasse in der Verwaltung: Restguthaben der Gruppe etwas kleiner als das eigene im Guthaben */
.card--cash {
  padding: 18px var(--space-card);
  gap: 6px;
}

.card--cash .text-display {
  font-size: 36px;
}

/* Kasse in der Verwaltung: ein Mitglied pro Zeile mit Initialen, Name, Prognose, Saldo und Pfeil */

.balance-row {
  min-height: 52px;
  padding: 0 8px;
  border-radius: var(--radius-row);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-ink);
  text-decoration: none;
}

.balance-row .avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

.balance-row__text {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.balance-row__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance-row__detail {
  font: var(--text-tiny);
  color: var(--color-ink-2);
  font-variant-numeric: tabular-nums;
}

.balance-row__amount {
  flex-shrink: 0;
  font-weight: 700;
}

/* Ab 900 px wird die Liste zur Tabelle: Mitglied, Teilnahmen, Eingezahlt, Verbraucht, Rest, Prognose.
 * Dieselben Zeilen, als Raster mit gemeinsamen Spalten. Sie passt schon bei 900 px ohne Scrollen
 * (kleinste Breite der Zeile 544 px), ein langer Name wird gekürzt. */
@media (min-width: 900px) {
  .card--cash-table {
    padding: 8px 12px;
  }

  .balance-columns,
  .card--cash-table .balance-row {
    padding: 0 8px;
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(5, minmax(0, 1fr));
    align-items: center;
    column-gap: 8px;
  }

  .balance-columns {
    height: 36px;
    font: var(--text-tiny);
    color: var(--color-ink-2);
    text-align: right;
  }

  .balance-columns > :first-child {
    text-align: left;
  }

  .card--cash-table .balance-row {
    min-height: 48px;
    border-radius: var(--radius-tile);
    font-variant-numeric: tabular-nums;
  }

  .card--cash-table .balance-row:hover {
    background: var(--color-tint);
  }

  /* Initialen und Name teilen sich die erste Spalte, die Prognose steht in der letzten. */
  .card--cash-table .balance-row .avatar {
    grid-area: 1 / 1;
    width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .card--cash-table .balance-row__text {
    display: contents;
  }

  .card--cash-table .balance-row__name {
    grid-area: 1 / 1;
    padding-left: 42px;
  }

  .card--cash-table .balance-row__attendance {
    grid-area: 1 / 2;
  }

  .card--cash-table .balance-row__paid-in {
    grid-area: 1 / 3;
  }

  .card--cash-table .balance-row__consumed {
    grid-area: 1 / 4;
  }

  .card--cash-table .balance-row__amount {
    grid-area: 1 / 5;
    text-align: right;
  }

  .card--cash-table .balance-row__detail {
    grid-area: 1 / 6;
    font: var(--text-body);
    text-align: right;
  }

  .card--cash-table .balance-row__detail:not(.text-negative),
  .balance-row__cell {
    color: var(--color-ink-2);
  }

  .balance-row__cell {
    text-align: right;
    white-space: nowrap;
  }

  .card--cash-table .balance-row__detail.text-strong {
    font-weight: 700;
  }

  .card--cash-table .balance-row__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .card--cash-table .menu-row__chevron {
    display: none;
  }
}

/* Knapp über 900 px: engere Spalten, damit der Name mehr Platz behält */
@media (min-width: 900px) and (max-width: 959.98px) {
  .balance-columns,
  .card--cash-table .balance-row {
    column-gap: 4px;
  }
}

/* Übersicht der Verwaltung: Kopf der Gruppenkarte, Kennzahlen, Einladungslink */

/* Text links, Knopf rechts oben, z. B. Name der Gruppe und „Bearbeiten“ */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.text-group-name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* Drei getönte Kennzahl-Kacheln nebeneinander: Zahl groß, Beschriftung klein darunter */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* dt (Beschriftung) steht im Markup vor dd (Zahl), angezeigt wird die Zahl oben */
.stat {
  padding: 10px 12px;
  border-radius: var(--radius-tile);
  background: var(--color-tint);
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  min-width: 0;
}

.stat__value {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stat__label {
  font: var(--text-tiny);
  color: var(--color-ink-2);
  overflow-wrap: break-word;
  hyphens: auto;
}

.card--invite {
  padding: 16px var(--space-card) var(--space-card);
  gap: 12px;
}

/* Unter 360 px: Kacheln enger, die beiden Knöpfe untereinander statt umgebrochen */
@media (max-width: 359px) {
  .stat {
    padding: 10px 8px;
  }

  .stat__value {
    font-size: 15px;
  }

  .card--invite .button-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.invite-url {
  overflow-wrap: anywhere;
}

/* Kleine Hilfen für die Anordnung in Karten */

.cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cluster--wide {
  gap: 16px;
}

.stretch {
  align-self: stretch;
}

/* Zieht einen Block über den Seitenrand, z. B. einen Seitenkopf mitten im Inhalt */
.bleed {
  margin: 0 calc(-1 * var(--space-page));
}

/* Untereinander mit dem Abstand einer Karte, z. B. Feld und Knopf in einem Formular */
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grow {
  flex-grow: 1;
  min-width: 0;
}

.center {
  display: flex;
  justify-content: center;
}

.plain-link {
  color: var(--color-ink);
  text-decoration: none;
}

.block-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--color-ink);
  text-decoration: none;
}

.lines {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lines--loose {
  gap: 2px;
}

/* Überschrift links, Nebentext rechts auf einer Grundlinie, z. B. „7 dabei“ und „von 10 Mitgliedern“ */
.split {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.text-title {
  font: var(--text-title);
  letter-spacing: -0.02em;
}

/* Überschrift einer Karte, so groß wie „Weitere Termine“ */
.text-section {
  font: var(--text-section);
}

.text-small {
  font: var(--text-small);
}

/* Überschrift in Textgröße, z. B. „Einladungslink“ */
.text-body {
  font: var(--text-body);
}

.text-strong {
  font-weight: 600;
}

.muted {
  color: var(--color-ink-2);
}

/* Grün nur für eine positive Prognose */
.text-positive {
  color: var(--color-positive);
}

/* Rot nur für Minus, Absage und Löschen */
.text-negative {
  color: var(--color-negative);
}

/* Abgesagter Termin: durchgestrichen und grau */
.struck {
  color: var(--color-ink-2);
  text-decoration: line-through;
}

/* Hervorhebung in Nebentext, z. B. die Adresse in „Schau in dein Postfach“ */
.text-ink {
  color: var(--color-ink);
}

/* Verwaltung → Mitglieder: Hinweiskarte zum Einladungslink, Liste mit Rollen-Pille und drei Punkten */

.card--hint {
  padding: 16px var(--space-card);
  gap: 12px;
}

.cluster--tight {
  flex-wrap: wrap;
  gap: 6px;
}

.member-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-row {
  min-height: 50px;
  padding: 0 4px 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-row .avatar,
.choice-row .avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

/* Der Name darf gekürzt werden, „(du)“ und die Marke „Gast“ bleiben sichtbar */
.member-row__name {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* Bei einem Gast rutscht die Marke unter den Namen, wenn beide nicht in eine Zeile passen */
.member-row__name--wrap {
  flex-wrap: wrap;
  row-gap: 2px;
  padding-block: 4px;
}

.member-row__truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-row__name .pill,
.member-row__suffix {
  flex-shrink: 0;
}

/* Name und „(du)“ mit normalem Wortabstand, die Marke „Gast“ mit etwas mehr */
.member-row__suffix {
  margin-left: -4px;
  white-space: nowrap;
}

/* Drei Punkte: 40 × 44 px, führt zur Seite des Mitglieds */
.more-button {
  width: 40px;
  height: var(--size-tap);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink-2);
}

/* Aufklappbare Auswahl (<details>): Auslöser als summary, darunter rechtsbündig eine schwebende Karte */
.menu {
  position: relative;
  flex-shrink: 0;
}

.menu > summary {
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

/* Rollen-Pille: Admin fast schwarz, Mitglied getönt, 34 px hoch, Tippfläche 44 px */
.role-pill {
  position: relative;
  height: 34px;
  padding: 0 8px 0 12px;
  border-radius: var(--radius-pill);
  background: var(--color-tint);
  color: var(--color-ink);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.role-pill::after {
  content: "";
  position: absolute;
  inset: -5px 0;
}

.role-pill--admin {
  background: var(--color-ink);
  color: var(--color-on-ink);
  font-weight: 600;
}

/* Rechts bündig mit der Zeile (Abstand, drei Punkte, Rand: 12 + 40 + 4 px), auch bei 320 px innerhalb der Seite.
 * Ohne Rahmen und Schatten (design.md): Die getönte Fläche setzt sie von der Karte ab. */
.menu__popover {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  right: -56px;
  width: min(280px, calc(100vw - 48px));
  padding: 6px;
  border-radius: var(--radius-card-list);
  background: var(--color-tint);
  display: flex;
  flex-direction: column;
}

/* Die untersten drei Zeilen einer längeren Liste öffnen nach oben, sonst verschwände die Auswahl hinter der Leiste */
.member-row:nth-last-child(-n+3):not(:nth-child(-n+3)) .menu__popover {
  top: auto;
  bottom: calc(100% + 6px);
}

.menu__popover > form {
  display: flex;
}

.menu__title {
  padding: 8px 12px 4px;
  font: var(--text-small);
  color: var(--color-ink-2);
}

.menu-option {
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-row);
  background: none;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  gap: 12px;
  font: var(--text-body);
  text-align: left;
}

button.menu-option {
  cursor: pointer;
}

.menu-option--current {
  background: var(--color-card);
}

.menu-option__text {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-option__title {
  font-weight: 600;
}

.menu-option__subtitle {
  font: var(--text-small);
  color: var(--color-ink-2);
}

.menu-option__check {
  flex-shrink: 0;
}

/* Auswahl eines Mitglieds als Liste von Radio-Knöpfen, z. B. beim Zusammenführen */
.choice-list {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice-list legend {
  margin-bottom: 6px;
  padding: 0;
}

.choice-row {
  min-height: 52px;
  padding: 0 8px;
  border-radius: var(--radius-row);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.choice-row__input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--color-ink);
}

.choice-row__name {
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Eine Aktion, die gerade nicht geht; der Nebentext sagt warum */
.action-row[aria-disabled="true"],
.menu-option[aria-disabled="true"] {
  cursor: default;
}
