/* PePoX — gemeinsame Bausteine fuer alles ausser der Website.
   Baut auf tokens.css (Design-System "Handschlag") auf.
   Regel aus dem Design-System: Blau markiert nur Zusage und die eine Hauptaktion.
   Abstand trennt, Linien nur dort, wo Daten in Reihen stehen. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* hidden gilt immer, auch gegen display-Regeln von Bausteinen */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-variation-settings: 'SOFT' 0, 'WONK' 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }
h4 { font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-bold); letter-spacing: 0; }
p { margin: 0; }
p + p { margin-top: 0.75em; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
img { max-width: 100%; display: block; }
small, .klein { font-size: var(--text-xs); }
.gedaempft { color: var(--color-text-muted); }
.mono, .betrag, .nr, .dauer { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }
/* Wörtliches, das man so tippt oder das die App so einsetzt (ein Befehl, eine Variable): in der Schrift der Ziffern */
code { font-family: var(--font-mono); font-size: 0.85em; overflow-wrap: anywhere; }
.betrag, .dauer { white-space: nowrap; }
/* Dauer („7 h 53 min“): Ziffernschrift, die Lücken enger, damit sie als ein Wert liest */
.dauer { word-spacing: -0.25em; }
.rechts { text-align: right; }
.reihe { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); }
/* eine Reihe unter dem, wozu sie gehört (ein Knopf unter einem Text in einer Karte) */
.reihe--darunter { margin-top: 0.6rem; }
.feld + .wahl { margin-top: var(--space-sm); }
.verlauf + .klappe { margin-top: 0.6rem; }

/* ---------- Seite ohne App-Rahmen ---------- */
.huelle { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--space-md); }
.wortmarke {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-size: 1.75rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.03em;
  text-decoration: none;
}

/* ---------- Flaechen ---------- */
.karte {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

/* ---------- Knoepfe ---------- */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  padding: 0.7em 1.3em;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.knopf:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.knopf--zweit { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.knopf--zweit:hover { background: var(--color-bg-alt); border-color: var(--color-secondary-light); }
.knopf--warn { background: var(--color-surface); color: #8A1C1C; border-color: #D9B3B3; }
.knopf--warn:hover { background: #FBEFEF; border-color: #8A1C1C; }
.knopf--klein { font-size: var(--text-xs); padding: 0.45em 0.9em; }
/* gerade abgeschickt (app.js): der Knopf ruht, bis die Antwort da ist */
.knopf.sendet { opacity: 0.6; cursor: progress; }
.knopf--gross { font-size: 1.0625rem; padding: 0.85em 1.8em; }
/* Nennt das Wort den Titel einer anderen Sache („Als Kontakt zu Schreinerei Berger GmbH“), darf es umbrechen */
.knopf--lang { white-space: normal; text-align: left; overflow-wrap: anywhere; max-width: 18rem; }
.knopf[disabled], .knopf[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Symbole (src/lib/symbole.ts) ---------- */
.symbol { width: 1.15em; height: 1.15em; flex: none; }
/* Knopf nur mit Zeichen, fuer die Standardaktionen: ohne Rand in Zeilen und Block-Koepfen, mit .knopf--zweit im Seitenkopf */
.knopf--symbol { width: 2.25rem; height: 2.25rem; padding: 0; background: transparent; border-color: transparent; color: var(--color-secondary-dark); }
.knopf--symbol:hover { background: var(--color-bg-alt); border-color: transparent; color: var(--color-text); }
.knopf--symbol .symbol { width: 1.125rem; height: 1.125rem; }
.knopf--symbol.knopf--zweit { background: var(--color-surface); border-color: var(--color-border); }
.knopf--symbol.knopf--zweit:hover { background: var(--color-bg-alt); border-color: var(--color-secondary-light); }
.knopf--symbol.knopf--warn { background: transparent; border-color: transparent; color: var(--color-secondary-dark); }
.knopf--symbol.knopf--warn:hover { background: #FBEFEF; color: #8A1C1C; }
.knopf--symbol.knopf--klein { width: 1.875rem; height: 1.875rem; padding: 0; }
.knopf--symbol.knopf--klein .symbol { width: 1rem; height: 1rem; }
/* Rückmeldung am Symbolknopf (Kopieren): Er trägt zwei Zeichen; nach dem Klick steht für einen Moment das zweite da (.getan) */
.knopf--symbol .symbol + .symbol { display: none; }
.knopf--symbol.getan .symbol { display: none; }
.knopf--symbol.getan .symbol + .symbol { display: block; color: #1E5B2E; }
/* mehrere Aktionen einer Zeile oder eines Kopfs: erst der Knopf mit Text, dann die Symbole */
.aktionen { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.25rem; }
/* ein Textknopf hält etwas mehr Abstand zum nächsten; der letzte schließt mit der Kante ab */
.aktionen .knopf:not(.knopf--symbol):not(:last-child) { margin-right: 0.25rem; }
/* Aktionen, die erst beim Ueberfahren erscheinen: in einer dichten Liste (Postfach) die ein, zwei Standardaktionen jeder
   Zeile als Symbole, rechts oben in der Zeile. Die Zeile (li, position: relative) traegt die Farbe beim Ueberfahren; die
   Aktionen erben sie; das Datum der Zeile (time) weicht ihnen. Mit Fokus in der Zeile und auf Geraeten ohne Zeiger stehen
   sie immer da, dort haelt die Zeile ihnen rechts Platz frei. */
.aktionen--schwebend { position: absolute; top: 0.3rem; right: 0.35rem; z-index: 1; flex-wrap: nowrap; gap: 0; padding-left: 0.35rem; background-color: inherit; }
@media (hover: hover) {
  .aktionen--schwebend { opacity: 0; }
  :hover > .aktionen--schwebend, :focus-within > .aktionen--schwebend, .aktionen--schwebend:has(details[open]) { opacity: 1; }
  :has(> .aktionen--schwebend):is(:hover, :focus-within) time { visibility: hidden; }
}

/* ---------- Formulare ---------- */
.feld { display: grid; gap: 0.35rem; align-content: start; }
.feld + .feld { margin-top: var(--space-sm); }
.feld label, .feld-titel { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.feld input, .feld textarea, .feld select, .eingabe {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.75em;
}
.feld input:focus, .feld textarea:focus, .feld select:focus, .eingabe:focus {
  outline: none; border-color: var(--color-primary); box-shadow: var(--shadow-focus);
}
/* ein gesperrtes Feld (der Wert steht fest, solange etwas anderes gilt): grauer Grund, gestrichelter Rand */
.feld input:disabled, .feld textarea:disabled, .feld select:disabled, .eingabe:disabled {
  background: var(--color-bg); color: var(--color-text-muted); -webkit-text-fill-color: var(--color-text-muted); opacity: 1; border-style: dashed; cursor: not-allowed;
}
/* Ziffern und Wörtliches auch im Feld in der Schrift der Ziffern (font: inherit oben nähme sie .mono sonst wieder) */
.feld input.mono, .feld textarea.mono, .eingabe.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }
.feld textarea { line-height: var(--leading-normal); resize: vertical; }
.feld-hilfe { font-size: var(--text-xs); color: var(--color-text-muted); }
.optional { font-weight: var(--weight-regular); color: var(--color-text-muted); font-size: var(--text-xs); }
.haken { display: flex; gap: 0.6em; align-items: flex-start; font-size: var(--text-sm); }
.haken input { margin-top: 0.25em; accent-color: var(--color-primary); width: 1.05em; height: 1.05em; }
.haken small { display: block; color: var(--color-text-muted); font-size: var(--text-xs); }
.feld + .haken, .feld-reihe + .haken, .hinweis + .haken { margin-top: var(--space-sm); }
/* Hilfe, die zu einer ganzen Reihe gehört, steht unter der Reihe */
.feld-reihe + .feld-hilfe { display: block; margin-top: 0.35rem; }
.feld-hilfe + .feld, .feld-hilfe + .feld-reihe { margin-top: var(--space-sm); }
.feld + .klappe, .feld-reihe + .klappe { margin-top: var(--space-sm); }
/* Datei waehlen: der Knopf des Browsers sieht aus wie ein Zweitknopf, der Dateiname steht daneben */
input[type="file"] { font: inherit; font-size: var(--text-sm); color: var(--color-text-muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: var(--text-xs); font-weight: var(--weight-bold); line-height: 1.2;
  padding: 0.5em 0.95em; margin-right: 0.75em; cursor: pointer;
  background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
input[type="file"]::file-selector-button:hover { background: var(--color-bg-alt); border-color: var(--color-secondary-light); }
/* Feldgruppe: Felder, die zusammen eine Sache beschreiben (eine neue Person), oder die Zeilen einer Frage (.wahl);
   fieldset mit legend als Überschrift, ohne Rahmen */
.feldgruppe { margin: 0; padding: 0; border: 0; min-width: 0; }
.feldgruppe > legend { padding: 0; margin-bottom: 0.5rem; font-size: var(--text-sm); font-weight: var(--weight-bold); }
.feldgruppe > .feld-hilfe { display: block; margin-top: 0.35rem; }
.feldgruppe + .formular-fuss { margin-top: var(--space-md); }
.feld + .feldgruppe, .feld-reihe + .feldgruppe, .klappe + .feldgruppe, .feldgruppe + .feld, .feldgruppe + .feld-reihe, .feldgruppe + .feldgruppe { margin-top: var(--space-md); }
/* Fuss eines Formulars: rechts, erst „Abbrechen“ (Zweitknopf), zuletzt die eine Hauptaktion; wie im Dialog */
.formular-fuss { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.5rem; margin-top: var(--space-md); }

/* ---------- Status ---------- */
.marke {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  padding: 0.25em 0.65em;
  border-radius: 999px;
  background: var(--color-bg-alt);
  color: var(--color-secondary-dark);
  white-space: nowrap;
}
.marke::before { content: ''; width: 0.45em; height: 0.45em; border-radius: 50%; background: currentColor; }
.marke--neu      { background: var(--color-primary-50); color: var(--color-primary-dark); }   /* angefragt, neu */
.marke--laeuft   { background: #E8EEF9; color: #1A3F7A; }                                     /* in Arbeit */
.marke--wartet   { background: #F6EED9; color: #7A5300; }                                     /* wartet auf dich / Kunde */
.marke--gut      { background: #E1EFE4; color: #1E5B2E; }                                     /* bezahlt, bestaetigt */
.marke--schlecht { background: #F6E3E3; color: #8A1C1C; }                                     /* ueberfaellig, abgelehnt */
.marke--aus      { background: var(--color-bg-alt); color: var(--color-text-muted); }         /* abgeschlossen */

/* vorbereitet: was die App fertig gemacht hat und auf dich wartet (Liste der Projekte) */
.vorbereitet { display: inline-flex; align-items: center; gap: 0.45em; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: #7A5300; }
.vorbereitet::before { content: ''; width: 0.55em; height: 0.55em; border-radius: 50%; background: #D99A00; }

/* ---------- Tabellen ---------- */
.tabelle { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tabelle th {
  text-align: left;
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.tabelle td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--color-bg-alt); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover td { background: #F7F8F6; }
.tabelle a { text-decoration: none; font-weight: var(--weight-semibold); }
.tabelle a:hover { text-decoration: underline; }
.tabelle .rechts, .tabelle td.betrag { text-align: right; }
/* die Fläche der Tabelle: weiß mit Rand, wie die Zeilenliste; rollt seitlich, wenn die Tabelle nicht passt */
.tabelle-huelle { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.tabelle-huelle > .leer { padding: var(--space-md); }
/* Tabelle mit ganzen Sätzen (Aufbewahrung, Verzeichnis): schmal je Zeile ein Block. Die erste Zelle ist der Titel, jede
   weitere steht darunter, mit dem Wort ihrer Spalte davor (data-th). */
@media (max-width: 40rem) {
  .tabelle--text thead { display: none; }
  .tabelle--text, .tabelle--text tbody, .tabelle--text tr, .tabelle--text td { display: block; }
  .tabelle--text tr { padding: 0.7rem var(--space-sm); border-top: 1px solid var(--color-bg-alt); }
  .tabelle--text tbody tr:first-child { border-top: 0; }
  .tabelle--text td { padding: 0; border: 0; white-space: normal; }
  .tabelle--text td + td { margin-top: 0.2rem; }
  .tabelle--text td[data-th]::before { content: attr(data-th) ': '; color: var(--color-text-muted); }
  .tabelle--text tbody tr:hover td { background: transparent; }
}

/* ---------- Schluessel/Wert ---------- */
.fakten { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; font-size: var(--text-sm); }
.fakten dt { color: var(--color-text-muted); }
.fakten dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Reiter ---------- */
.reiter { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-md); overflow-x: auto; }
.reiter a {
  padding: 0.6rem 0.9rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.reiter a:hover { color: var(--color-text); }
.reiter a[aria-current="page"] { color: var(--color-text); border-bottom-color: var(--color-primary); }
/* Telefon: Reiter, die nicht in eine Reihe passen, brechen um; keiner liegt unsichtbar hinter dem Rand */
@media (max-width: 40rem) { .reiter { flex-wrap: wrap; overflow-x: visible; gap: 0 0.25rem; } .reiter a { padding-inline: 0.7rem; } }

/* ---------- Hinweise ---------- */
.hinweis {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  font-size: var(--text-sm);
}
.hinweis--wartet { background: #F6EED9; }
.hinweis--gut { background: #E1EFE4; }
.hinweis--schlecht { background: #F6E3E3; }
.hinweis--blau { background: var(--color-primary-50); }
/* Hinweis mit Aktion: der Satz links, rechts die Aktion, die ihn erledigt (Zweitknopf, klein) */
.hinweis > .symbol { margin-top: 0.15em; }
.hinweis:has(> .aktionen) { flex-wrap: wrap; row-gap: 0.6rem; }
.hinweis:has(> .aktionen) > span:not(.aktionen) { flex: 1 1 14rem; min-width: 0; }
.hinweis > .aktionen { flex: none; align-self: center; margin-left: auto; }
/* im Formular: ein Hinweis steht unter dem Feld, das er meint, oder über dem ersten Feld (was beim Speichern fehlte) */
.feld + .hinweis, .feld-reihe + .hinweis, .hinweis + .hinweis, .hinweis + .feld, .hinweis + .feld-reihe, .hinweis + .klappe { margin-top: var(--space-sm); }

/* ---------- Leiste der App ueber einem Blatt (Mail, Rechnung): links, was die App dazu weiss (Marke, Projekt, Kunde),
   rechts, was sie anbietet. Grau und ausserhalb des Blatts, damit sich App und Inhalt nie mischen. ---------- */
.leiste { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); min-height: 3rem; padding: 0.45rem 0.6rem 0.45rem var(--space-sm); background: var(--color-bg-alt); border-radius: var(--radius-md); font-size: var(--text-sm); }
.leiste-was { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.75rem; min-width: 0; padding-block: 0.15rem; }
.leiste-was a { font-weight: var(--weight-semibold); text-decoration: none; overflow-wrap: anywhere; }
.leiste-was a:hover { text-decoration: underline; }
.leiste-was a + a { font-weight: var(--weight-regular); color: var(--color-secondary-dark); }
.leiste .aktionen { flex: none; flex-wrap: nowrap; margin-left: auto; }

/* ---------- Dokument (Mail, PDF, Text) ---------- */
.dokument {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.dokument h2, .dokument h3 { margin: 1.2em 0 0.4em; }
.dokument h2:first-child, .dokument h3:first-child { margin-top: 0; }
.dokument ul, .dokument ol { padding-left: 1.2em; }

/* ---------- Backoffice-Rahmen (layout.ts: seite, navigation) ---------- */
body.app { background: var(--color-bg); }
.app-rahmen > * { min-width: 0; }
.app-rahmen { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.app-nav {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: var(--space-md) var(--space-sm);
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
}
.app-marke {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1;
  font-weight: var(--weight-semibold);
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  padding: 0 0.6rem;
  margin-bottom: var(--space-md);
}
.app-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.app-nav li a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  color: var(--color-secondary-dark);
}
.app-nav li a:hover { background: var(--color-bg-alt); color: var(--color-text); }
.app-nav li a[aria-current="page"] { background: var(--color-surface); color: var(--color-text); font-weight: var(--weight-bold); box-shadow: inset 2px 0 0 var(--color-primary); }
.app-nav-zahl { font-family: var(--font-mono); font-size: 0.7rem; background: var(--color-primary); color: #fff; border-radius: 999px; padding: 0.05em 0.5em; }
/* unten: wer angemeldet ist (fuehrt zum Konto), daneben Abmelden als Symbol */
.app-nav-fuss { margin-top: auto; display: flex; gap: 0.25rem; align-items: center; justify-content: space-between; font-size: var(--text-sm); }
.app-konto { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: 1; padding: 0.35rem 0.6rem; border-radius: var(--radius-sm); text-decoration: none; font-weight: var(--weight-medium); color: var(--color-secondary-dark); }
.app-konto:hover { background: var(--color-bg-alt); color: var(--color-text); }
.app-konto > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-avatar { width: 1.75rem; height: 1.75rem; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--color-bg-alt); color: var(--color-secondary-dark); font-size: var(--text-xs); font-weight: var(--weight-bold); }
main.app-inhalt, .app main { padding: var(--space-lg) clamp(1rem, 3vw, 2.5rem) var(--space-xl); min-width: 0; }
/* Breite der Seite, nach ihrer Art (seite({ breite })): der Inhalt steht links an der Navigation und wird nicht breiter als
   72rem (Überblick, Liste, Sache, Einstellung) oder 40rem (Formular). Ein Arbeitsplatz nimmt die ganze Breite. */
main.app-inhalt--normal { max-width: 77rem; }
main.app-inhalt--schmal { max-width: 45rem; }
/* für Screenreader da, für das Auge nicht (die Überschrift eines Blocks, der keine braucht) */
.unsichtbar { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.app-kopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.app-kopf p { color: var(--color-text-muted); margin-top: 0.25rem; max-width: 75ch; }
/* die Marke der Sache am Ende der grauen Zeile */
.app-kopf p .marke { margin-left: 0.35rem; vertical-align: 0.05em; }
.app-kopf .aktionen { align-self: center; }
/* schmal bleibt, was rechts steht („Mehr“), oben rechts neben dem Titel; der Titel bricht um */
.app-kopf > div:first-child { flex: 1 1 12rem; min-width: 0; }
.app-kopf h1 { overflow-wrap: anywhere; }
/* „Mehr“ im Kopf: so breit wie der längste Punkt, kein Umbruch mitten im Namen einer Aktion */
.app-kopf .menue-liste { width: max-content; max-width: calc(100vw - 2rem); }
/* Der Menüknopf und das Fach gibt es nur schmal: breit ist .app-nav-inhalt durchsichtig, seine Teile stehen in der Spalte */
.app-burger { display: none; }
.app-nav-inhalt { display: contents; }

/* ====================================================================
   Bausteine fuer das Backoffice
   ==================================================================== */

/* ---------- Navigation: Suche, Gruppen, Zaehler, Abmelden ---------- */
.app-suche { display: block; margin: 0 0 var(--space-sm); position: relative; }
.app-suche input {
  width: 100%; font: inherit; font-size: var(--text-sm);
  padding: 0.45em 0.7em; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
}
.app-suche input:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--shadow-focus); }
.app-nav li.app-nav-trenner { height: 1px; background: var(--color-border); margin: 0.5rem 0.6rem; }
/* ---------- Schmal (Handy, Tablet hochkant): Leiste oben, das Menü als Fach von rechts ----------
   Oben bleibt beim Rollen eine Leiste stehen: links die Wortmarke (führt zu Heute), rechts der Menüknopf. Er öffnet das
   Fach mit Suche, Bereichen, Konto und Abmelden; der Knopf wird zum Kreuz. Zu geht es mit dem Kreuz, einem Tipp daneben
   oder Escape (app.js). Die Seite dahinter rollt solange nicht. */
:root { --leiste: 3.25rem; }
@media (max-width: 52rem) {
  html { scroll-padding-top: calc(var(--leiste) + 0.5rem); }
  html.menue-offen, html.menue-offen body { overflow: hidden; }
  .app-rahmen { display: block; }
  .app-rahmen > .app-nav {
    position: sticky; top: 0; z-index: 30; height: var(--leiste);
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 0 0.35rem 0 clamp(1rem, 3vw, 2.5rem); border-right: 0; border-bottom: 1px solid var(--color-border);
  }
  .app-rahmen > .app-nav .app-marke { margin: 0; padding: 0; font-size: 1.35rem; }
  .app-rahmen > .app-nav .app-burger { display: inline-grid; width: 2.75rem; height: 2.75rem; }
  .app-burger .symbol { width: 1.5rem; height: 1.5rem; }
  .app-burger .symbol + .symbol, .app-burger[aria-expanded="true"] .symbol:first-child { display: none; }
  .app-burger[aria-expanded="true"] .symbol + .symbol { display: block; }
  /* der Schleier über der Seite; ein Tipp darauf trifft die Navigation selbst und schließt (app.js) */
  .app-rahmen > .app-nav::after {
    content: ''; position: fixed; inset: var(--leiste) 0 0 0; background: rgb(24 28 36 / 0.32);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  .app-rahmen > .app-nav.offen::after { opacity: 1; pointer-events: auto; }
  .app-rahmen > .app-nav .app-nav-inhalt {
    position: fixed; top: var(--leiste); right: 0; bottom: 0; z-index: 1; width: min(20rem, 86vw);
    display: flex; flex-direction: column; gap: var(--space-sm);
    padding: var(--space-md) var(--space-sm) calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    background: var(--color-bg); border-left: 1px solid var(--color-border);
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .app-rahmen > .app-nav.offen .app-nav-inhalt { transform: none; visibility: visible; transition: transform 0.2s ease; }
  .app-rahmen > .app-nav .app-suche { margin: 0; }
  .app-rahmen > .app-nav .app-suche input { padding: 0.6em 0.75em; }
  .app-rahmen > .app-nav li a { padding: 0.7rem 0.75rem; font-size: var(--text-base); }
  .app-rahmen > .app-nav .app-nav-zahl { font-size: 0.75rem; }
  .app-rahmen > .app-nav .app-nav-fuss { padding-top: var(--space-sm); border-top: 1px solid var(--color-border); }
  .app-rahmen > .app-nav .app-konto { padding: 0.6rem 0.6rem; font-size: var(--text-base); }
  .app-rahmen > .app-nav .app-nav-fuss .knopf--symbol { width: 2.75rem; height: 2.75rem; }
}
@media (max-width: 52rem) and (prefers-reduced-motion: reduce) {
  .app-rahmen > .app-nav::after, .app-rahmen > .app-nav .app-nav-inhalt, .app-rahmen > .app-nav.offen .app-nav-inhalt { transition: none; }
}
/* Ein Feld unter 16 px lässt Safari auf dem Handy beim Antippen hineinzoomen; die Seite bleibt so, wie sie ist */
@media (max-width: 52rem) and (hover: none) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: max(1rem, 16px) !important; }
}

/* ---------- Seitenaufbau ---------- */
.zurueck { display: inline-flex; align-items: center; gap: 0.25rem; font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: none; }
.zurueck:hover { color: var(--color-text); }
.spalten { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: var(--space-lg); align-items: start; }
@media (max-width: 68rem) { .spalten { grid-template-columns: minmax(0, 1fr); gap: var(--space-md); } }
/* ist Platz, bekommt die Randspalte ihn: Eine Mailadresse oder die Adresse eines Repositorys bricht dann nicht mehr mitten um */
@media (min-width: 80rem) { .spalten { grid-template-columns: minmax(0, 1fr) 23rem; } }
.block + .block { margin-top: var(--space-lg); }
.block-kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem var(--space-sm); margin-bottom: 0.75rem; }
.block-kopf h2 { font-size: 1.25rem; }
.block-kopf h3 { font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-bold); letter-spacing: 0; }
.block-kopf a:not(.knopf) { font-size: var(--text-sm); color: var(--color-text-muted); }
.block-kopf a:not(.knopf):hover { color: var(--color-primary); }
.karte > .block-kopf { margin-bottom: var(--space-sm); }
/* der Stand eines Blocks in ein, zwei Wörtern rechts neben der Überschrift (18 Mails, berechnet 2.000,00 €) */
.block-kopf > small { font-size: var(--text-sm); color: var(--color-text-muted); }
/* Karten am Rand (rechte Spalte einer Sache): untereinander, knapper als im Inhalt; jeder Kopf gleich hoch, mit oder ohne Symbol */
.karten { display: grid; gap: var(--space-sm); min-width: 0; align-content: start; }
.karten > .karte { padding: var(--space-sm) 1.25rem 1.25rem; font-size: var(--text-sm); min-width: 0; }
.karten > .karte > .block-kopf { align-items: center; min-height: 1.875rem; margin-bottom: 0.5rem; }
/* Paare in der schmalen Karte: das Wort bleibt in einer Zeile, ein langer Wert (eine Mailadresse) bricht um */
.karten .paare li > :first-child { flex: none; }
.karten .paare li > :last-child { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Aufklapper: was man selten braucht, bleibt zu; die Zeile mit dem Winkel öffnet es an Ort und Stelle ---------- */
.klappe > summary { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; min-height: 1.5rem; cursor: pointer; list-style: none; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-secondary-dark); }
.klappe > summary::-webkit-details-marker { display: none; }
.klappe > summary:hover { color: var(--color-text); }
.klappe > summary > .symbol { transition: transform 0.15s; }
@media (prefers-reduced-motion: reduce) { .klappe > summary > .symbol { transition: none; } }
.klappe[open] > summary > .symbol { transform: rotate(180deg); }
.klappe[open] > summary { margin-bottom: var(--space-sm); }
/* als Kopf eines Blocks: Überschrift links, daneben der Stand, der Winkel am Rand */
.klappe--block > summary { display: flex; align-items: baseline; gap: 0.25rem var(--space-sm); color: var(--color-text); }
.klappe--block > summary h2 { font-size: 1.25rem; }
.klappe--block > summary h2 { min-width: 0; }
.klappe--block > summary small { font-size: var(--text-sm); font-weight: var(--weight-regular); color: var(--color-text-muted); white-space: nowrap; }
.klappe--block > summary > .symbol { margin-left: auto; align-self: center; color: var(--color-secondary-dark); }

/* ---------- Angaben mit Zeichen: wie man jemanden erreicht (Mail, Telefon, Anschrift); je Zeile ein Zeichen und der Wert ---------- */
.angaben { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; font-size: var(--text-sm); }
.angaben li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.5rem; align-items: start; overflow-wrap: anywhere; }
.angaben .symbol { margin-top: 0.2em; color: var(--color-text-muted); }
.angaben small { color: var(--color-text-muted); }
/* eine Angabe, die man einzeln ändert (ein Standort): rechts ihr Stift; mehrzeilig mit dem Namen fett in der ersten Zeile */
.angaben li:has(> .knopf) { grid-template-columns: auto minmax(0, 1fr) auto; }
.angaben li > .knopf { margin: -0.35rem 0; }
.angaben b { display: block; font-weight: var(--weight-semibold); }

/* ---------- Zeilenliste: links Zeit oder Zeichen, Mitte Text, rechts die eine Aktion ---------- */
.zeilen { list-style: none; margin: 0; padding: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.zeilen > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.25rem var(--space-sm); align-items: center; padding: 0.85rem var(--space-md); }
.zeilen > li + li { border-top: 1px solid var(--color-bg-alt); }
.zeilen .wann { font-family: var(--font-mono); font-size: var(--text-sm); min-width: 3.6rem; color: var(--color-secondary-dark); }
.zeilen .was { min-width: 0; overflow-wrap: anywhere; }
.zeilen .was b { font-weight: var(--weight-semibold); }
/* der Titel der Zeile als Link zur Sache: sieht aus wie der fette Titel, ist aber der echte Weg (Tastatur, neuer Tab) */
.zeilen .was a.titel { display: block; font-weight: var(--weight-semibold); text-decoration: none; }
.zeilen .was a.titel:hover { text-decoration: underline; }
.zeilen .was small { display: block; font-size: var(--text-sm); color: var(--color-text-muted); margin-top: 0.1rem; }
.zeilen .tun { justify-self: end; }
.zeilen > li.vorbei { color: var(--color-text-muted); }
/* Zeile mit Marke vorn (Mitteilungen): die Marke steht oben links, der Text darf mehrzeilig sein */
.zeilen--marke > li { grid-template-columns: 7.5rem minmax(0, 1fr) auto; align-items: start; }
.zeilen--marke .marke { justify-self: start; margin-top: 0.15rem; }
.zeilen .was small.verlauf { font-size: var(--text-xs); margin-top: 0.3rem; }
.zeilen > li.erledigt .was b { font-weight: var(--weight-regular); color: var(--color-text-muted); }
/* Ungelesen, Neu: der blaue Punkt vor dem Namen oder Titel, dazu fett (eine Mail, eine Mitteilung, die man noch nicht
   geöffnet hat). Geöffnet steht der Titel einer Mitteilung mittelfett, wie der Name einer gelesenen Mail. */
.ungelesen { display: inline-block; width: 0.5em; height: 0.5em; margin-right: 0.45em; border-radius: 50%; background: var(--color-primary); vertical-align: 0.08em; }
.zeilen > li.mitteilung .was a.titel { font-weight: var(--weight-medium); }
.zeilen > li.mitteilung.neu .was a.titel { font-weight: var(--weight-bold); }
/* Zeile ohne Spalte vorn (eine Verbindung, ein Eintrag im Papierkorb, eine Position): links der Name und darunter in ein,
   zwei Zeilen, wie es steht; rechts der Stand als Marke und die Aktionen. Der Text darf umbrechen. */
.zeilen--zwei > li { grid-template-columns: minmax(0, 1fr) auto; }
/* knappe Zeile (Heute): nichts vorn, Titel und eine Zeile Lage, rechts ein Symbol; die Lage bricht nicht um */
.zeilen--knapp > li { grid-template-columns: minmax(0, 1fr) auto; padding-block: 0.7rem; }
/* die Lage hat zwei Zeilen Platz, erst dann die Auslassung: Der Satz endet oft mit dem, worauf es ankommt */
.zeilen--knapp .was small { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
@media (max-width: 40rem) {
  .zeilen > li, .zeilen--marke > li { grid-template-columns: auto minmax(0, 1fr); padding-inline: var(--space-sm); }
  .zeilen .tun { grid-column: 1 / -1; justify-self: start; margin-top: 0.35rem; }
  .zeilen .tun:empty { display: none; }
  .zeilen--knapp > li { grid-template-columns: minmax(0, 1fr) auto; }
  .zeilen--zwei > li { grid-template-columns: minmax(0, 1fr); }
  .zeilen--knapp .tun { grid-column: auto; justify-self: end; margin-top: 0; }
  /* schmal reicht eine Zeile nicht für den Satz zur Lage: zwei, dann die Auslassung */
  .zeilen--knapp .was small { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  /* mit Marke: Marke und Aktion in einer Reihe, darunter der Text in ganzer Breite */
  .zeilen--marke > li { grid-template-columns: minmax(0, 1fr) auto; }
  .zeilen--marke .marke { grid-column: 1; grid-row: 1; margin-top: 0; }
  .zeilen--marke .tun { grid-column: 2; grid-row: 1; justify-self: end; margin-top: 0; }
  .zeilen--marke .was { grid-column: 1 / -1; }
}

/* ---------- Verlauf: was geschah, das Neueste oben; links wann, rechts was. Die App schreibt ihn selbst. ---------- */
.verlauf { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); }
.verlauf li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-sm); padding: 0.4rem 0; }
.verlauf li + li, .klappe > .verlauf li:first-child { border-top: 1px solid var(--color-bg-alt); }
.verlauf span { overflow-wrap: anywhere; }
.verlauf time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); padding-top: 0.15rem; white-space: nowrap; }
@media (max-width: 40rem) { .verlauf li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Aufzählung: was eine Aktion umfasst (was gelöscht wird, was im Paket liegt); darüber als h4, was damit geschieht ---------- */
.punkte { margin: 0.3rem 0 0; padding-left: 1.1rem; font-size: var(--text-sm); display: grid; gap: 0.2rem; }
.punkte + h4, .punkte + p, .punkte + .klappe, .feld + h4, .feld-reihe + h4 { margin-top: var(--space-sm); }

/* ---------- Klickbare Zeile: steht die Zeile fuer genau eine Sache, oeffnet ein Klick irgendwo darauf diese Sache.
   data-oeffnet="/adresse" an li oder tr (app.js); der Name in der Zeile bleibt ein echter Link (Tastatur, neuer Tab). ---------- */
[data-oeffnet] { cursor: pointer; }
.zeilen > li[data-oeffnet]:hover { background: #F7F8F6; }
.zeilen > li[data-oeffnet]:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.zeilen > li[data-oeffnet]:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.zeilen > li[data-oeffnet]:only-child { border-radius: var(--radius-md); }

/* ---------- Seiten einer langen Liste: links zu den neueren, in der Mitte wo man ist, rechts zu den älteren ---------- */
.seiten { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-sm); margin-top: var(--space-md); font-size: var(--text-sm); color: var(--color-text-muted); }
.seiten a { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 2rem; color: var(--color-text); text-decoration: none; font-weight: var(--weight-semibold); }
.seiten a:hover { color: var(--color-primary); }
.seiten > :last-child { justify-self: end; }

/* ---------- Leerer Zustand: ein Satz, was hier stehen wird, hoechstens eine Aktion ---------- */
.leer { color: var(--color-text-muted); font-size: var(--text-sm); }

/* ---------- Kennzahlen: nur Zahlen, auf die man handelt ---------- */
.zahlen { display: flex; flex-wrap: wrap; gap: 1px; margin: 0; background: var(--color-border); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
/* bricht die Reihe um, füllt die letzte Zahl ihre Reihe: nie eine leere Zelle */
.zahl { flex: 1 1 11rem; background: var(--color-surface); padding: var(--space-sm) var(--space-md); }
.zahl dt { font-size: var(--text-xs); color: var(--color-text-muted); }
.zahl dd { margin: 0.15rem 0 0; font-family: var(--font-mono); font-size: var(--text-lg); letter-spacing: -0.03em; white-space: nowrap; }
.zahl dd small { display: block; font-family: var(--font-body); font-size: var(--text-xs); letter-spacing: 0; color: var(--color-text-muted); white-space: normal; margin-top: 0.1rem; }
.zahl--schlecht dd { color: #8A1C1C; }

/* ---------- Filter: runde Knoepfe, einer ist gedrueckt ---------- */
.filter { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.filter button {
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.2;
  padding: 0.4em 0.9em; border-radius: 999px; border: 1px solid var(--color-border);
  background: transparent; color: var(--color-secondary-dark); cursor: pointer; white-space: nowrap;
}
.filter button:hover { border-color: var(--color-secondary-light); color: var(--color-text); }
.filter button[aria-pressed="true"] { background: var(--color-text); border-color: var(--color-text); color: var(--color-bg); }
/* dasselbe als Links, wenn der Server filtert */
.filter a {
  font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.2; text-decoration: none;
  padding: 0.4em 0.9em; border-radius: 999px; border: 1px solid var(--color-border);
  color: var(--color-secondary-dark); white-space: nowrap;
}
.filter a:hover { border-color: var(--color-secondary-light); color: var(--color-text); }
.filter a[aria-current="true"] { background: var(--color-text); border-color: var(--color-text); color: var(--color-bg); }
.filter .anzahl { font-family: var(--font-mono); font-size: 0.75em; font-weight: var(--weight-medium); margin-left: 0.4em; opacity: 0.75; }
.werkzeug { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-xs) var(--space-sm); margin-bottom: var(--space-sm); }
.suchfeld { font: inherit; font-size: var(--text-sm); padding: 0.45em 0.75em; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); min-width: 0; width: 15rem; max-width: 100%; }
.suchfeld:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--shadow-focus); }

/* ---------- Stufen: wo das Projekt steht ---------- */
.stufen { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; font-size: var(--text-xs); overflow-x: auto; }
.stufen li { flex: 1 1 0; min-width: max-content; padding: 0.45rem 0.9rem 0.1rem 0; border-top: 3px solid var(--color-border); color: var(--color-text-muted); white-space: nowrap; }
.stufen li.erledigt { border-top-color: var(--color-secondary-light); color: var(--color-secondary-dark); }
.stufen li[aria-current] { border-top-color: var(--color-primary); color: var(--color-text); font-weight: var(--weight-bold); }
/* Telefon: sieben Namen passen nicht in eine Reihe. Die Leiste zeigt alle Stufen als Striche und nennt nur die jetzige
   („3 von 7 · Bautag“); nichts rollt zur Seite. Ist das Projekt zu Ende, sagt es die Marke im Kopf, die Leiste entfällt. */
@media (max-width: 40rem) {
  .stufen { overflow: visible; counter-reset: stufe; }
  .stufen li { flex: 1 1 0; min-width: 0; padding-right: 0; font-size: 0; counter-increment: stufe; }
  .stufen li[aria-current] { flex: 0 0 auto; padding-right: 0.5rem; font-size: var(--text-xs); }
  .stufen li[aria-current]::before { content: counter(stufe) ' von 7 · '; font-weight: var(--weight-regular); color: var(--color-text-muted); }
  .stufen:not(:has([aria-current])) { display: none; }
}

/* ---------- Dialog ---------- */
dialog.dialog {
  width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem);
  padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}
dialog.dialog::backdrop { background: rgba(20, 24, 21, 0.45); }
.dialog-kopf { padding: var(--space-md) var(--space-md) 0; }
.dialog-kopf h2 { font-size: var(--text-lg); }
.dialog-kopf p { margin-top: 0.3rem; font-size: var(--text-sm); color: var(--color-text-muted); }
/* eine Wahl im Kopf (Fassungen einer Mail): mit Abstand unter dem Satz */
.dialog-kopf p + .filter { margin-top: 0.75rem; }
.dialog-rumpf { padding: var(--space-sm) var(--space-md) 0; font-size: var(--text-sm); }
/* Der Fuß bleibt unten stehen, wenn der Inhalt länger ist als das Fenster: Die Knöpfe sind immer zu sehen, der Inhalt läuft darunter aus. */
.dialog-fuss { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.5rem; padding: var(--space-md);
  background: linear-gradient(to bottom, transparent, var(--color-surface) 0.75rem); }
.feld-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--space-sm); }
.feld-reihe .feld + .feld { margin-top: 0; }
/* am Telefon steht jedes Feld für sich: zwei halbe Felder schneiden ihren Inhalt ab */
@media (max-width: 30rem) { .feld-reihe { grid-template-columns: minmax(0, 1fr); } .feld-reihe > div:empty { display: none; } }
/* drei Felder (Anrede, Vorname, Nachname): das erste etwas schmaler; schmal steht es allein, die beiden anderen nebeneinander.
   Hilfe, die zur ganzen Reihe gehört, steht darunter (.feld-reihe + .feld-hilfe). */
.feld-reihe--drei { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 34rem) {
  .feld-reihe--drei { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .feld-reihe--drei > :first-child { grid-column: 1 / -1; }
}
/* PLZ und Ort: die fünf Ziffern schmal, der Ort bekommt den Rest; bleibt auch am Telefon nebeneinander */
.feld-reihe--plz { grid-template-columns: 6.5rem minmax(0, 1fr); }
.feld-reihe + .feld, .feld + .feld-reihe, .feld-reihe + .feld-reihe { margin-top: var(--space-sm); }
/* links im Fuß eines Dialogs: Löschen der Sache, die er bearbeitet, als Symbol; geht es gerade nicht, ist es blass und nennt
   den Grund, wenn man darauf zeigt (aria-disabled, title).
   Im HTML steht es nach dem Hauptknopf, damit Enter speichert und nicht löscht. */
.dialog-fuss > .fuss-links { order: -1; justify-content: flex-start; margin-right: auto; }
/* links im Fuß eines Formulars auf der Seite: der Stand in einem Satz (Einstellungen: „Veröffentlicht 23.11., 14:02“) */
.formular-fuss > .fuss-links { order: -1; margin-right: auto; font-size: var(--text-sm); color: var(--color-text-muted); }
/* Wert mit Einheit: die Einheit steht grau hinter dem Feld (€, Tage, Minuten) */
.mit-einheit { display: flex; align-items: center; gap: 0.5rem; }
/* eine Zahl braucht kein Feld über die ganze Breite: Zahlen stehen gleich breit untereinander, die Einheit direkt dahinter */
.mit-einheit input { flex: 0 1 9rem; min-width: 3.5rem; }
.mit-einheit input[type="number"] { flex-basis: 6.5rem; }
.mit-einheit > span { font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }

/* ---------- Mehrere Werte derselben Art (weitere Adressen und Nummern eines Kontakts): je Wert eine Zeile aus Art, Wert,
   Bezeichnung und Papierkorb; darunter der Knopf für eine weitere. app.js: [data-mehrfach-neu] hängt die Vorlage (template)
   an, [data-mehrfach-weg] nimmt die Zeile weg. Leere Zeilen zählen beim Speichern nicht. ---------- */
.mehrfach { display: grid; gap: 0.4rem; margin-top: var(--space-sm); }
.mehrfach-zeile { display: grid; grid-template-columns: 6.75rem minmax(0, 1fr) 8rem auto; gap: 0.4rem; align-items: center; }
.mehrfach-zeile .eingabe { min-width: 0; }
.mehrfach > .knopf { justify-self: start; }
.mehrfach + .feld, .mehrfach + .feld-reihe, .mehrfach + .haken { margin-top: var(--space-sm); }
/* schmal: oben Art, Bezeichnung und Papierkorb, darunter der Wert in ganzer Breite (eine Mailadresse braucht den Platz) */
@media (max-width: 34rem) {
  .mehrfach-zeile { grid-template-columns: 6.75rem minmax(0, 1fr) auto; }
  .mehrfach-zeile > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .mehrfach-zeile > :nth-child(3) { grid-column: 2; grid-row: 1; }
  .mehrfach-zeile + .mehrfach-zeile { margin-top: 0.4rem; padding-top: 0.8rem; border-top: 1px solid var(--color-bg-alt); }
}

/* ---------- Menue hinter den drei Punkten ---------- */
.menue { position: relative; }
.menue > summary { list-style: none; cursor: pointer; }
.menue > summary::-webkit-details-marker { display: none; }
.menue-liste {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 13.5rem;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 0.3rem; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
.menue-liste a, .menue-liste button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: var(--text-sm);
  padding: 0.45rem 0.6rem; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--color-text); text-decoration: none; cursor: pointer;
}
.menue-liste a:hover, .menue-liste button:hover { background: var(--color-bg-alt); }
.menue-liste .warn { color: #8A1C1C; }
/* kurzes Formular hinter einem Symbolknopf (z. B. „Später“): dieselbe Flaeche wie das Menue */
.menue-form { display: grid; gap: var(--space-xs); padding: var(--space-sm); min-width: 13rem; }
.menue-form label { display: grid; gap: 0.25rem; font-size: var(--text-xs); color: var(--color-text-muted); }
.menue-form input { font: inherit; font-size: var(--text-sm); color: var(--color-text); padding: 0.35em 0.5em; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.menue-form .knopf { justify-self: end; width: auto; text-align: center; border: 1px solid var(--color-border); padding: 0.45em 0.9em; font-size: var(--text-xs); }
/* steht das kurze Formular unter anderen Punkten (Kalender: „Sperren“ am Tag), trennt es eine Linie; eine Zeile sagt, was dabei gilt */
.menue-liste > :not(.menue-form) + .menue-form { border-top: 1px solid var(--color-border); }
.menue-hinweis { margin: 0; font-size: var(--text-xs); line-height: 1.4; color: var(--color-text-muted); white-space: normal; max-width: 18rem; }
/* schmal: Steht der Knopf unter dem Text links, öffnet sich das Menü nach rechts; steht er rechts in der Zeile, nach links */
@media (max-width: 40rem) {
  .zeilen .menue-liste { right: auto; left: 0; }
  .zeilen--knapp .menue-liste, .zeilen--marke .menue-liste { left: auto; right: 0; }
}
/* Ragt ein Menü trotzdem aus dem Fenster, klappt app.js es zur anderen Seite (der Knopf steht dann anders als gedacht) */
.menue > .menue-liste.menue-liste--nach-rechts { right: auto; left: 0; }
.menue > .menue-liste.menue-liste--nach-links { left: auto; right: 0; }

/* ---------- Auswahl: eine von mehreren Zeilen ---------- */
.wahl { display: grid; gap: 0.4rem; }
.wahl label {
  display: flex; gap: 0.65rem; align-items: center; padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); font-size: var(--text-sm); cursor: pointer;
}
.wahl label:hover { border-color: var(--color-secondary-light); }
.wahl label:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-50); }
.wahl input { accent-color: var(--color-primary); width: 1.05em; height: 1.05em; flex: none; margin: 0; }
.wahl small { display: block; color: var(--color-text-muted); font-size: var(--text-xs); }

/* ---------- Datei oder Anhang ---------- */
.datei {
  display: inline-flex; align-items: center; gap: 0.5em; max-width: 100%;
  font: inherit; font-size: var(--text-xs); color: var(--color-text); text-decoration: none;
  padding: 0.35em 0.7em; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-bg); cursor: pointer;
}
.datei b { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: var(--weight-semibold); }
.datei:hover { border-color: var(--color-secondary-light); }

/* ---------- Liste aus Stichpunkten mit Wert rechts ---------- */
.paare { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); }
.paare li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); padding: 0.4rem 0; }
.paare li + li { border-top: 1px solid var(--color-bg-alt); }
.paare li > :first-child { color: var(--color-text-muted); }
.paare li > :last-child { text-align: right; }
/* unter dem Wert eine kleine graue Zeile: seit wann, warum */
.paare small { display: block; color: var(--color-text-muted); }
/* die Summe der Posten: letzte Zeile, dunkler Strich darüber, fett */
.paare li.gesamt { border-top-color: var(--color-text); font-weight: var(--weight-bold); }
.paare li.gesamt > :first-child { color: var(--color-text); }

.tabelle td small { display: block; color: var(--color-text-muted); font-size: var(--text-xs); font-weight: var(--weight-regular); }

/* ein Satz über dem ersten Feld eines Dialogs hält Abstand zu ihm */
.dialog-rumpf > p + .feld, .dialog-rumpf > p + .feld-reihe { margin-top: var(--space-sm); }
/* Fließtext endet nicht mit einem einzelnen Wort in der letzten Zeile */
p, li, small, dd, .feld-hilfe, .hinweis span, .leer { text-wrap: pretty; }
/* ein kurzer Link bricht nicht mitten im Namen um */
.am-stueck { white-space: nowrap; }
/* Tabelle mit ganzen Sätzen, breit: die erste und die letzte Spalte (ein Stichwort, eine Frist) behalten ihre Breite */
@media (min-width: 40.0625rem) {
  .tabelle--text th:first-child { width: 11rem; }
  .tabelle--text th:last-child { width: 11rem; }
}

/* ============ Schmal und Finger: was am Telefon anders steht (Design-System „Schmal“) ============ */
/* ein offenes Menü an schwebenden Aktionen liegt über den Knöpfen der Nachbarzeilen (sonst träfe der Finger deren „···“) */
.aktionen--schwebend:has(details[open]) { z-index: 20; }
/* ist unter dem Knopf kein Platz mehr, öffnet sich das Menü nach oben (app.js) */
.menue > .menue-liste.menue-liste--nach-oben { top: auto; bottom: calc(100% + 4px); }
/* Warum etwas gerade nicht geht (aria-disabled mit title): Ein Finger kann nicht darauf zeigen, darum sagt es beim Antippen
   eine kurze Zeile unten im Fenster (app.js) */
.kurzmeldung {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  width: max-content; max-width: min(28rem, calc(100vw - 2rem)); margin: 0; padding: 0.7rem 1rem; border-radius: var(--radius-md);
  background: var(--color-text); color: var(--color-bg); font-size: var(--text-sm); line-height: 1.4; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}
/* am Telefon steht der Fokus beim Öffnen auf dem Dialog selbst (app.js): ohne Rahmen um das ganze Fenster */
dialog.dialog:focus { outline: none; }
/* Finger statt Zeiger: kleine Knöpfe, Symbole und Rückwege bekommen eine Fläche, die man trifft */
@media (pointer: coarse) {
  .zurueck { min-height: 2.75rem; }
  .knopf--klein { min-height: 2.5rem; }
  .knopf--symbol.knopf--klein { width: 2.5rem; height: 2.5rem; }
  .seiten a { min-height: 2.75rem; }
}
@media (max-width: 40rem) {
  /* Fuß eines Dialogs oder Formulars: Passen die Knöpfe nicht in eine Reihe, steht die Hauptaktion oben und jede Reihe füllt die Breite */
  .dialog-fuss, .formular-fuss { flex-wrap: wrap-reverse; }
  .dialog-fuss > .knopf, .formular-fuss > .knopf, .formular-fuss > form { flex: 1 1 auto; }
  .formular-fuss > form > .knopf { width: 100%; }
  .formular-fuss > .fuss-links { order: 1; flex: 1 1 100%; margin-right: 0; }
  /* die Karte hält am Telefon weniger Rand: Felder und Text nutzen die Breite */
  .karte { padding: var(--space-sm); }
  .werkzeug > form, .werkzeug .suchfeld { width: 100%; }
  /* Aufklapper als Blockkopf: der Stand steht rechts neben dem Winkel, auch wenn die Überschrift umbricht */
  .klappe--block > summary { align-items: center; }
  .klappe--block > summary small { margin-left: auto; }
  .klappe--block > summary > .symbol { margin-left: 0; }
  /* eine Marke allein rechts (Stand eines Projekts, einer Rechnung) steht unter dem Titel, nicht unter dem Datum */
  .zeilen .tun:has(> .marke:only-child) { grid-column: 2; margin-top: 0.15rem; }
  /* Blättern: die Mitte („Seite 2 von 4 · 105 Mitteilungen“) bekommt ihre eigene Zeile */
  .seiten { grid-template-columns: 1fr 1fr; }
  .seiten > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; text-align: center; }
  .seiten > :last-child { grid-column: 2; grid-row: 1; }
}
/* Kennzahlen am Telefon: je Zahl eine Zeile, links das Wort, rechts der Wert; drei Kacheln nähmen einen halben Schirm */
@media (max-width: 40rem) {
  .zahl { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); padding: 0.7rem var(--space-sm); }
  .zahl dt { font-size: var(--text-sm); }
  .zahl dd { margin: 0; text-align: right; font-size: var(--text-base, 1rem); }
}
/* Schlüssel und Wert: am Telefon untereinander, der Wert in ganzer Breite */
@media (max-width: 30rem) {
  .fakten { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .fakten dt { font-size: var(--text-xs); }
  .fakten dd + dt { margin-top: 0.5rem; }
}
/* ein langer Text im Dialog wächst mit seinem Inhalt: Es rollt nur der Dialog, nicht noch das Feld darin */
@supports (field-sizing: content) {
  @media (max-width: 40rem) { .dialog textarea { field-sizing: content; min-height: 6rem; max-height: none; } }
}
