/*
 * webapp-f7 — gemeinsame Framework7-iOS-Basis für phpApps-SPAs.
 * Akzentfarbe kommt vom Projekt via --ds-color-accent aus theme.css
 * (generiert aus _shared/design-system/tokens/, Fallback Teal).
 * Projekt-Pages bekommen zusätzlich die Klasse .wf7-page.
 */

html,
body,
#app {
  height: 100%;
}

:root {
  --webapp-accent-text: var(--ds-color-accent-text, var(--webapp-accent, var(--ds-color-accent, #0f8b8d)));
}

.wf7-page {
  --webapp-accent: var(--ds-color-accent, #0f8b8d);
  --f7-bars-border-color: var(--ds-border-bar, rgba(16, 42, 67, 0.14));
  --f7-bars-link-color: var(--webapp-accent-text);
  --f7-navbar-bg-color: var(--ds-surface-bar, rgba(255, 255, 255, 0.94));
  --f7-page-bg-color: var(--ds-surface-page, #f7f7f2);
  --f7-page-title-letter-spacing: 0;
  --f7-theme-color: var(--webapp-accent);
  --f7-toolbar-bg-color: var(--ds-surface-toolbar, rgba(255, 255, 255, 0.96));
  --f7-tabbar-link-active-color: var(--webapp-accent-text);
  --f7-toolbar-link-color: var(--webapp-accent-text);
  color: var(--ds-color-text, #1f2933);
  font-size: 16px;
}

/* Native tab labels need the compact iOS size on narrow phones; keep F7's
   standard size, icons and touch targets at every other width. */
@media (width < 360px) {
  .wf7-tabbar {
    --f7-tabbar-label-font-size: 10px;
  }
}

/* framework7-react rendert einen <NavLeft>-Child ohne slot-Prop als
   slots.default → im DOM landet er NACH .title/.title-large; die flex-
   .navbar-inner würde das Logo damit ans Ende (rechts) schieben. order:-1
   zieht es wieder nach links. Gilt für beide SPAs (Buchung + Backend). */
.wf7-page .navbar-inner .left {
  order: -1;
}

/* iOS-Bottom-Sheet mit Grabber + zentriertem Titel + Close */
.wf7-grabber {
  background: var(--ds-color-handle, #c7ccd1);
  border-radius: 3px;
  height: 5px;
  margin: 8px auto 4px;
  width: 36px;
}

.wf7-sheet-header {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 44px;
  position: relative;
}

.wf7-sheet-title {
  color: var(--ds-color-heading, #102a43);
  font-size: 1.05rem;
  font-weight: 600;
}

.wf7-sheet-close {
  align-items: center;
  color: var(--ds-color-muted, #aeb5bc);
  display: flex;
  height: 44px;
  justify-content: center;
  position: absolute;
  right: 6px;
  top: 0;
  transition: color 200ms ease;
  width: 44px;
}

.wf7-sheet-close .f7-icons {
  font-size: 26px;
}

.wf7-sheet-close:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .wf7-sheet-close {
    transition-duration: 1ms;
  }
}

/* Cookie-/Datenschutz-Hinweis (kein rechtlicher Tracking-Consent — reine
   Info mit localStorage-Merker). Auto-Init via WebappF7.initConsentBanner(),
   siehe common.js. */
.wf7-consent-banner {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20000;
  flex-direction: column;
  gap: 12px;
  padding: 16px max(16px, env(safe-area-inset-right)) max(16px, calc(env(safe-area-inset-bottom) + 16px)) max(16px, env(safe-area-inset-left));
  background: var(--ds-color-hero, #102a43);
  color: #ffffff;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}

.wf7-consent-banner.wf7-consent-visible {
  display: flex;
}

.wf7-consent-banner-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

.wf7-consent-banner-text a {
  color: #ffffff;
  text-decoration: underline;
}

.wf7-consent-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wf7-consent-banner .button-outline {
  --f7-button-border-color: var(--webapp-accent-text);
  --f7-button-outline-border-color: var(--webapp-accent-text);
  --f7-button-text-color: var(--webapp-accent-text);
}

@media (min-width: 700px) {
  .wf7-consent-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ── StateBlock (shared DS-Komponente) ───────────────────────────────────
   Gehoert zu _shared/design-system/src/webapp-f7/StateBlock.tsx. Lag bis
   2026-07-30 DOPPELT in friseurs backend.css und webapp.css — dieselbe Falle
   wie bei AdminList, ein zweiter Konsument haette ungestylt gerendert.
   Hier steht nur, was in beiden Kopien deckungsgleich war; abweichende Werte
   (Zeilenhoehe und Breite des Textes, der groessere Titel in der Bestaetigung)
   bleiben als Projekt-Overrides in den Apps. `.state-kicker` war ueberhaupt
   nur in der Buchungs-App gestylt und erbte im Backend — die Variante
   "Termin gebucht" haette dort blass ausgesehen, sobald sie jemand nutzt. */
.state-icon {
  color: var(--ds-color-muted);
  font-size: 44px;
}

.state-kicker {
  color: var(--webapp-accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.state-title {
  color: var(--ds-color-text);
  font-size: 1.05rem;
  font-weight: 700;
  max-width: 320px;
}

/* Nur die gemeinsamen Werte: Zeilenhoehe (1.4 im Backend, 1.55 in der
   Buchung) und max-width setzen die Apps selbst, damit dieser Umzug nichts
   verschiebt. */
.state-text {
  color: var(--ds-color-muted);
  font-size: 0.95rem;
}

/* Plakette der Bestaetigung. Lag bis 2026-07-30 in friseurs webapp.css, obwohl
   StateBlock sie rendert — der zweite Konsument haette sie ungestylt bekommen
   (im Backend gab es dafuer gar keine Regel). Nachgezogen als letzter Rest des
   StateBlock-Umzugs.
   Der Umzug ist nachweislich wirkungslos fuer die Buchungs-App: beide Regeln
   waren dort schon unscoped (Spezifitaet 0,1,0), es gibt nirgends einen
   konkurrierenden Selektor, und beide Tokens sind in tokens.css fuer Hell UND
   Dunkel definiert (#e3f8e8/#2f9e44 gegen #132a19/#51cf66). Damit spielt auch
   die Reihenfolge der Stylesheets keine Rolle. */
.confirmation-badge {
  align-items: center;
  background: var(--ds-status-success-bg);
  border-radius: 50%;
  display: flex;
  height: 88px;
  justify-content: center;
  width: 88px;
}

.confirmation-badge .f7-icons {
  color: var(--ds-status-free);
  font-size: 44px;
}

/* Gebuchte Leistungen auf der Bestaetigung. Die Bestaetigungs-Seite ist der
   EINZIGE Beleg, den der Kunde bekommt — erhoben wird nur die Handynummer, es
   gibt also keine Mail zum Nachlesen. Deshalb steht hier, was gebucht wurde
   und was es kostet.
   Flaeche gegen --ds-surface-card gemischt, nicht gegen Weiss: eine gegen
   hartes Weiss getoente Flaeche bleibt im Dark-Mode hell, waehrend der Text
   per Token auf Fast-Weiss umschlaegt (Kontrast ~1). Siehe
   bin/check-css-darkmode.sh, das genau das blockiert. */
.confirmation-services {
  background: color-mix(in srgb, var(--ds-color-accent) 8%, var(--ds-surface-card));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 320px;
  padding: 12px 16px;
  width: 100%;
}

.confirmation-service {
  color: var(--ds-color-text);
  font-size: 0.95rem;
  font-weight: 600;
}

.confirmation-price {
  border-top: 1px solid var(--ds-border-bar);
  color: var(--ds-color-heading);
  font-size: 1.05rem;
  font-weight: 800;
  margin-top: 4px;
  padding-top: 8px;
}

/* ── AdminList (shared DS-Komponenten) ───────────────────────────────────
   Gehoert zu _shared/design-system/src/webapp-f7/AdminList.tsx. Lag bis
   2026-07-29 in friseurs backend.css und musste beim zweiten Konsumenten
   mitwandern — jetzt hier, damit die Kern-Verwaltung in jedem webapp-f7-
   Projekt gestylt rendert. Strikt token-basiert (--ds-*), Dark greift
   automatisch. Karte, Divider, Chevron und Dark-Grundwerte liefert F7. */
.admin-list-title {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-list-chip {
  align-items: center;
  background: color-mix(in srgb, var(--ds-color-accent) 14%, transparent);
  border-radius: 8px;
  color: var(--ds-color-accent-text);
  display: flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.admin-list-chip .f7-icons {
  font-size: 18px;
}

.admin-avatar {
  align-items: center;
  background: color-mix(in srgb, var(--ds-color-accent) 16%, transparent);
  border-radius: 50%;
  color: var(--ds-color-accent-text);
  display: flex;
  font-size: 0.8rem;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.admin-avatar .f7-icons {
  font-size: 18px;
}

.admin-title-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  width: 100%;
}

/* Eigene Box fuer den Titeltext: item-title ist flex (s.u.), ein roher
   Textknoten bekommt darin kein individuelles min-width/overflow und
   ueberliefe sonst zusammen mit dem Badge die gemeinsame Box, die
   irgendwo mittendrin per overflow:hidden abgeschnitten wird — meist im
   Badge, weil er im Quelltext hinter dem Titel steht (gemessen SAM-65). */
.admin-entity-title-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badge {
  background: color-mix(in srgb, var(--ds-color-accent) 14%, transparent);
  border-radius: 6px;
  color: var(--ds-color-accent-text);
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-left: 8px;
  padding: 2px 6px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Gedaempfte Badge-Variante fuer Zustaende, die KEINE Auszeichnung sind
   („Inaktiv"). Das akzentfarbene .admin-badge wuerde einen abgeschalteten
   Datensatz wie eine Hervorhebung lesen. Gegen `transparent` gemischt, nicht
   gegen Weiss — sonst bliebe die Flaeche im Dark-Mode hell. */
.admin-badge-muted {
  background: color-mix(in srgb, var(--ds-color-text) 10%, transparent);
  color: var(--ds-color-muted);
}

.admin-row-subtitle {
  color: var(--ds-color-muted);
  font-size: 0.82rem;
}

/* ── Konto-Hub (KontoHubContent) ─────────────────────────────────────
   Umgezogen aus friseurs backend.css, weil die Komponente im Design-System
   liegt — sonst rendert der zweite Konsument Hero und Avatar ungestylt.
   Hartes Weiss ist hier richtig: der Hero ist in BEIDEN Modi dunkel
   (--ds-color-hero ist eine Flaechenfarbe). */
.konto-hero {
  align-items: center;
  background: var(--ds-color-hero, #131B3D);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 28px) 20px 26px;
  text-align: center;
}

.konto-hero .profile-avatar-fallback {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.konto-hero-name {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 4px;
}

.konto-hero-role {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 3px;
}

.profile-avatar {
  align-items: center;
  border-radius: 50%;
  box-shadow: 0 10px 24px var(--ds-border-bar);
  display: flex;
  height: 88px;
  justify-content: center;
  margin-bottom: 14px;
  overflow: hidden;
  width: 88px;
}

.profile-avatar-fallback {
  background: linear-gradient(135deg, var(--webapp-accent) 0%, color-mix(in srgb, var(--webapp-accent) 80%, black) 100%);
  color: #ffffff;
  font-size: 1.65rem;
  font-weight: 800;
}

/* ── Terminzeile (AppointmentRow) ─────────────────────────────────────
   F7-Listenzeile statt freier Kachel, damit `swipeout` greift (das verlangt
   ein <li class="swipeout"> in einer F7-Liste). Uhrzeit und Statuspunkt liegen
   im item-media, die Status-Toenung sitzt auf .swipeout-content — eine
   durchscheinende Zeile wuerde die Wisch-Aktionen darunter zeigen.
   Werte uebernommen aus friseurs timeline.css, damit nur die Mechanik wechselt
   und nicht zusaetzlich die Optik. Flaechen gegen --ds-surface-card gemischt,
   nie gegen hartes Weiss (bin/check-css-darkmode.sh). */
.appointment-list ul {
  background: var(--ds-surface-card);
}

/* F7s `.item-inner` ist Flex-ROW: Titel und `item-subtitle` landeten dadurch
   nebeneinander („Frei 30 Min. · online buchbar" in einer Zeile), statt die Meta
   unter den Titel zu setzen. Dieselbe Umstellung wie bei .admin-entity-inner. */
.appointment-row .item-inner {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.appointment-gutter {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 62px;
}

.appointment-time {
  color: var(--ds-color-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.appointment-dot {
  border-radius: 50%;
  flex-shrink: 0;
  height: 8px;
  width: 8px;
}

.appointment-dot-free {
  background: var(--ds-status-free);
}

.appointment-dot-booked {
  background: var(--webapp-accent);
}

.appointment-dot-cancelled {
  background: var(--ds-color-muted);
}

.appointment-title {
  font-weight: 600;
}

.appointment-meta {
  color: var(--ds-color-muted);
  font-size: 0.82rem;
}

/* Leistungen als eigene Zeile unter der Meta-Zeile. `display: block` macht aus
   dem <span> den Umbruch, ohne die Meta-Zeile auf flex umzustellen (dort liegt
   die Telefon-Schaltflaeche inline). */
.appointment-services {
  display: block;
  font-weight: 700;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

/* Telefonnummer als Ausloeser des Kontakt-Sheets: <button>, damit sie ohne
   href bedienbar und per Tastatur erreichbar ist — sieht aus wie ein Link. */
.appointment-phone {
  appearance: none;
  background: none;
  border: 0;
  color: var(--webapp-accent-text);
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.appointment-phone:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

.appointment-row-booked .swipeout-content {
  background: color-mix(in srgb, var(--webapp-accent) 8%, var(--ds-surface-card));
}

.appointment-row-booked .appointment-title,
.appointment-row-booked .appointment-meta {
  color: var(--ds-color-heading);
}

.appointment-row-cancelled .swipeout-content {
  background: var(--ds-surface-page);
}

.appointment-row-cancelled .appointment-title,
.appointment-row-cancelled .appointment-meta {
  color: var(--ds-color-muted);
}

.appointment-row-free .appointment-title {
  color: var(--ds-color-muted);
}

/* Wisch-Aktionen: F7s Variable `--f7-swipeout-button-bg-color` setzen, Optik
   (Pillen, abgehobene Zeile, weisser Text) liefert F7 v9 im iOS-Theme selbst.
   Die Werte sind bewusst FESTE Farben und keine --ds-*-Tokens: die Tokens drehen
   pro Modus, und weisser Text braucht in BEIDEN Modi eine dunkle Flaeche.
   Gemessen 2026-08-10, warum F7s Defaults hier nicht reichen: im Dark-Mode ist
   --f7-swipeout-button-bg-color #ffffff8c, weisser Text darauf ergibt komponiert
   rund 2.3:1. Auch --ds-status-danger faellt aus (dunkel #ff6b6b, ~2.4:1). */
.appointment-swipe {
  font-weight: 600;
}

.appointment-swipe-accent {
  --f7-swipeout-button-bg-color: var(--webapp-accent);
}

.appointment-swipe-danger {
  --f7-swipeout-button-bg-color: #c92a2a;
}

.appointment-swipe-success {
  /* #2b8a3e lag mit weissem Text bei 4.37:1 — knapp unter AA fuer 14.4px.
     Nachgemessen mit #1f6f2e: 5.3:1. */
  --f7-swipeout-button-bg-color: #1f6f2e;
}

.appointment-swipe-muted {
  --f7-swipeout-button-bg-color: #495057;
}

.admin-toggle {
  --f7-toggle-active-color: var(--ds-color-accent);
}

/* F7s .item-inner ist flex-row — Titelzeile und Untertitel muessen bei
   AdminEntityRow untereinander stehen, nicht nebeneinander. */
.admin-entity-inner {
  align-items: stretch;
  display: flex;
  flex-direction: column;
}

/* `min-width: 0` ist hier Pflicht, nicht Kosmetik: als Flex-Item von
   .admin-title-row hat .item-title sonst `min-width: auto` und kann nicht
   unter seine min-content-Breite schrumpfen. Die Badges tragen
   `flex-shrink: 0`, also waechst diese min-content-Breite mit jedem Badge —
   gemessen 2026-08-10 bei 375px mit ZWEI Badges („Diese Sitzung" + „Inaktiv"):
   Box 419px in einer 319px-Zeile, und `.page-content` mit `overflow-x: hidden`
   schneidet den letzten Badge ab. Mit 0 schrumpft die Box, und gekuerzt wird
   der Titeltext, der dafuer eine eigene Box hat (SAM-65). */
.admin-entity-inner .admin-title-row .item-title {
  align-items: center;
  display: flex;
  min-width: 0;
}

.admin-entity-inner .admin-row-subtitle {
  align-self: flex-start;
  padding-left: 0;
  text-align: left;
}

/* Ungelesen per Schriftgewicht, nicht per Statuspunkt: das Gewicht liest man
   ohne zu wissen, was eine Farbe bedeuten soll (Mail-App-Konvention).
   Die gelesene Zeile bleibt bei den Vorgaben — hier wird nur betont, nicht
   gedaempft, sonst wirken gelesene Nachrichten deaktiviert. */
.admin-row-unread .item-title {
  font-weight: 700;
}

.admin-row-unread .admin-row-subtitle {
  color: var(--ds-color-text);
  font-weight: 600;
}

/* Persistierende Auswahl im Desktop-Master: flach und deutlich genug fuer
   schnelles Scannen, ohne mit dem Hover-/Swipe-Zustand zu konkurrieren. */
.admin-row-selected {
  background: color-mix(in srgb, var(--ds-color-accent) 10%, var(--ds-surface-card));
}

.admin-row-selected .item-title {
  color: var(--ds-color-accent-text);
}

/* F7 setzt die Dark-Listenflaeche als direkte Regel, nicht nur ueber
   --f7-list-bg-color — deshalb die Flaeche explizit ans Token binden. */
.admin-list ul {
  background: var(--ds-surface-card);
}

.wf7-page .item-subtitle.admin-row-subtitle {
  color: var(--ds-color-muted);
}

/* Wisch-Aktion an AdminEntityRow (F7-swipeout).
   Form, Groesse und die Animation gehoeren F7: seit v9 sind Wisch-Aktionen im
   iOS-Theme abgerundete Pillen und die offene Zeile bekommt einen abgehobenen
   Hintergrund — genau das macht iOS 15+ in inset-Listen auch. Deshalb wird
   hier NICHT die Optik nachgebaut, sondern nur F7s eigene Variablen an unsere
   Tokens gebunden, damit Hell und Dunkel zur Palette passen. */
.admin-list {
  --f7-swipeout-button-bg-color: var(--ds-status-danger);
  --f7-swipeout-active-bg-color: color-mix(in srgb, var(--ds-color-muted) 16%, var(--ds-surface-card));
}

.swipeout-actions-right .admin-swipe-delete {
  font-weight: 600;
  text-decoration: none;
}

/* Backend-Seiten (resources/f7/backend). Nur Tokens, damit Dark mit der Palette mitgeht. */
.backend-dashboard-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-left: 16px;
  margin-right: 16px;
  padding: 0;
}

.backend-dashboard-grid > .backend-dashboard-tile {
  align-items: stretch;
  background: var(--ds-surface-card);
  border-radius: 20px;
  box-sizing: border-box;
  color: var(--ds-color-text);
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 8px;
  margin: 0;
  min-height: 80px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 12px;
  text-decoration: none;
}

.backend-tile-value {
  color: var(--ds-color-heading);
  font-size: 28px;
  font-weight: 700;
  line-height: 34px;
}

.backend-dashboard-tile > .backend-tile-value {
  grid-column: 2;
  text-align: right;
}

.backend-tile-icon {
  align-items: center;
  background: var(--ds-backend-tone-info-bg);
  border-radius: 50%;
  color: var(--ds-backend-tone-info-text);
  display: flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}


.backend-tile-icon.backend-tone-success { background: var(--ds-backend-tone-success-bg); color: var(--ds-backend-tone-success-text); }
.backend-tile-icon.backend-tone-warning { background: var(--ds-backend-tone-warning-bg); color: var(--ds-backend-tone-warning-text); }
.backend-tile-icon.backend-tone-danger { background: var(--ds-backend-tone-danger-bg); color: var(--ds-backend-tone-danger-text); }
.backend-tile-icon.backend-tone-muted { background: var(--ds-backend-tone-muted-bg); color: var(--ds-backend-tone-muted-text); }
.backend-tile-icon .f7-icons { font-size: 17px; }

.backend-tile-label {
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
}

.backend-dashboard-tile > .backend-tile-label,
.backend-dashboard-tile > small { grid-column: 1 / -1; }

.backend-dashboard-tile > .backend-tile-label {
  overflow-wrap: normal;
  word-break: normal;
}

.backend-dashboard-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.backend-dashboard-card .block-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  margin: 16px 16px 8px;
  text-transform: none;
}

.backend-dashboard-card-link {
  align-items: center;
  color: var(--ds-color-heading);
  display: inline-flex;
  gap: 8px;
  min-height: 44px;
}

.backend-dashboard-card-link .icon {
  color: var(--ds-color-muted);
  height: 12px;
  width: 8px;
}

.backend-dashboard-card-list { margin-top: 0; }

.backend-dashboard-card-summary {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  padding-top: 12px;
}

.backend-dashboard-card-empty {
  color: var(--ds-color-muted);
  font-size: 15px;
  line-height: 20px;
  white-space: normal;
}

@media (min-width: 1024px) {
  .backend-dashboard-page .backend-dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .backend-dashboard-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backend-dashboard-hubs { display: none; }
}

.backend-dashboard-card,
.backend-analytics-group,
.backend-security-section {
  min-width: 0;
}

/* Detail values are prose too, not F7's default single-line trailing metadata. */
.backend-detail-section .item-inner {
  align-items: flex-start;
  gap: 12px;
}

.backend-detail-section .item-title {
  flex: 0 1 40%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.backend-detail-section .item-after {
  display: block;
  flex: 1 1 0;
  max-width: none;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: normal;
}

.backend-page-description {
  color: var(--ds-color-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 20px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.backend-security .media-list .item-title {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.backend-security .media-list .item-inner {
  min-width: 0;
}

.backend-push #push-status {
  color: var(--ds-color-muted);
  font-size: 13px;
  line-height: 18px;
}

.backend-analytics-item-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.backend-empty-state {
  color: var(--ds-color-muted);
}

.backend-empty-state p {
  margin: 0;
}

/* ── Kontrollelemente im Profil (ThemeControl, PushControl) ──────────────
   HIG: jede Wahl und der Schalter sind mindestens 44 px hoch treffbar, ohne
   die Optik zu vergroessern. */
.backend-theme-control .block {
  padding: 0;
}

.backend-theme-views .button {
  --f7-button-height: 44px;
  min-height: 44px;
}

/* Das native input liegt unsichtbar als 44-px-Flaeche ueber dem F7-Toggle
   (Muster der Checkboxen oben): die Spur bleibt 31 px hoch, Klick und Fokus
   treffen das echte Control. */
.backend-push .toggle {
  position: relative;
}

.backend-push .toggle input[type="checkbox"] {
  display: block;
  height: 44px;
  left: 0;
  margin: 0;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  z-index: 2;
}

.backend-push .toggle input[type="checkbox"]:focus-visible ~ .toggle-icon {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

.backend-push-offer h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.backend-push-offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backend-push-offer-actions .button {
  min-height: 44px;
  height: auto;
  white-space: normal;
}

.backend-test-notice {
  color: var(--ds-backend-tone-warning-text);
  background: var(--ds-backend-tone-warning-bg);
  overflow-wrap: anywhere;
}

/* Fieldset als F7-Liste: Browser-Rahmen, Innenabstand und min-width zuruecksetzen, Flaeche ans Token binden
   (F7 setzt die Dark-Flaeche als direkte Regel auf `ul`, nicht auf die Liste). */
.backend-page fieldset.list {
  margin-bottom: 0;
  min-width: 0;
  padding: 0;
}

.backend-page fieldset.list > legend {
  padding: 0;
}

.backend-page fieldset.list ul,
.backend-page .list ul {
  background: var(--ds-surface-card);
}

.backend-repeater {
  display: block;
  list-style: none;
  padding: 0;
}

.backend-repeater-row {
  background: var(--ds-surface-card);
  border: 1px solid var(--ds-border-bar);
  border-radius: 8px;
  margin: 8px 16px;
  min-width: 0;
  padding: 8px 0;
}

.backend-row-actions,
.backend-collection-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backend-row-actions {
  margin-top: 8px;
  min-width: 0;
}

.backend-row-actions .button,
.backend-collection-actions .button {
  --f7-button-small-height: 44px;
  --f7-button-small-line-height: 42px;
  min-height: 44px;
}

/* Farbfeld: Texteingabe plus Farbmuster. Leer heisst "Standard" und malt
   keine Farbe — ein <input type="color"> ohne Wert zeigt sonst Schwarz. */
.backend-color-field {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.backend-color-field .backend-color-input {
  flex: 1 1 auto;
  min-width: 0;
}

.backend-color-standard {
  color: var(--ds-color-muted, #66707a);
  flex-shrink: 0;
  font-size: 0.82rem;
}

.backend-color-preview {
  border: 1px solid var(--ds-border-bar, rgba(16, 42, 67, 0.14));
  border-radius: 6px;
  flex-shrink: 0;
  height: 28px;
  width: 28px;
}

/* 44px-Trefferflaeche fuer die F7-Checkboxen (label.item-checkbox): das Icon bleibt klein, das Label ist die Flaeche. */
.backend-row-selectable {
  align-items: center;
  display: flex;
}

.backend-row-selectable > .item-media {
  padding-inline-start: var(--f7-list-item-padding-horizontal);
}

.backend-row-selectable > .item-content {
  flex: 1;
  min-width: 0;
}

.backend-row-check,
.backend-check-all {
  align-items: center;
  min-height: 44px;
}

.backend-row-check {
  display: flex;
  justify-content: center;
  min-width: 44px;
}

/* F7 blendet das input aus (display: none): es bleibt als echte, fokussierbare Trefferflaeche ueber dem Label liegen,
   das Icon ist nur die Optik. */
.backend-row-check,
.backend-check-all {
  position: relative;
}

label.backend-row-check.item-checkbox input[type="checkbox"],
label.backend-check-all.item-checkbox input[type="checkbox"] {
  display: block;
  height: 100%;
  inset: 0;
  margin: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
  z-index: 1;
}

label.backend-row-check input:focus-visible ~ .icon-checkbox,
label.backend-check-all input:focus-visible ~ .icon-checkbox {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

/* Vorschlagsliste liegt ueber dem Inhalt darunter, schiebt ihn nicht. */
.backend-search-suggest {
  position: relative;
  width: 100%;
}

.backend-page .backend-search-suggest .backend-suggestions {
  background: var(--ds-surface-card);
  border: 1px solid var(--ds-border-bar);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  left: 0;
  margin: 4px 0 0;
  max-height: 40vh;
  overflow-y: auto;
  padding: 0;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 100;
}

.backend-suggestions li {
  list-style: none;
}

.backend-suggestions button {
  align-items: flex-start;
  background: transparent;
  border: 0;
  color: var(--ds-color-text);
  display: flex;
  flex-direction: column;
  min-height: 44px;
  padding: 8px 16px;
  text-align: left;
  width: 100%;
}

.backend-suggestions small {
  color: var(--ds-color-muted);
}

.backend-totp-qr {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.backend-totp-qr canvas,
.backend-totp-qr img {
  background: #ffffff; /* darkmode-ok: QR-Code braucht in beiden Modi hellen Grund */
  max-width: 100%;
  padding: 8px;
}

/* ── Kalender (CalendarPage, Spec 6.9) ───────────────────────────────────
   Toene nur als Punkt und Rand; Text bleibt in den Text-Tokens, die Legende
   steht als Text im Eintrag. Flaechen gegen --ds-surface-card gemischt, nie
   gegen Weiss (bin/check-css-darkmode.sh). Kontrast gemessen: Text auf der
   getoenten Flaeche >= 7:1, Punkte >= 3:1 in Hell und Dunkel. */
.backend-calendar-page {
  --calendar-text-soft: color-mix(in srgb, var(--ds-color-text) 78%, var(--ds-surface-card));
  --calendar-warning: #b45309;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) .backend-calendar-page {
    --calendar-warning: #f59f00;
  }
}

/* Explizites Dunkel auf hellem System: die System-Regel matcht dort nie, die
   Warnfarbe muss dem tatsaechlichen Modus folgen, nicht dem Betriebssystem. */
:root.dark .backend-calendar-page {
  --calendar-warning: #f59f00;
}

.backend-calendar-tone-neutral { --calendar-tone: color-mix(in srgb, var(--ds-color-text) 55%, var(--ds-surface-card)); }
.backend-calendar-tone-accent { --calendar-tone: var(--webapp-accent); }
.backend-calendar-tone-success { --calendar-tone: var(--ds-status-free); }
.backend-calendar-tone-warning { --calendar-tone: var(--calendar-warning); }
.backend-calendar-tone-danger { --calendar-tone: var(--ds-status-danger); }
.backend-calendar-tone-muted { --calendar-tone: var(--ds-color-muted); }

.backend-calendar-visually-hidden {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.backend-calendar-dot {
  background: var(--calendar-tone);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  height: 8px;
  width: 8px;
}

.backend-calendar-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backend-calendar-subnavbar {
  --f7-subnavbar-offset-left: 0;
  --f7-subnavbar-offset-right: 0;
}

.backend-calendar-subnavbar .subnavbar-inner {
  display: flex;
  gap: 0;
  padding-left: calc(4px + var(--f7-safe-area-left, 0px));
  padding-right: calc(4px + var(--f7-safe-area-right, 0px));
}

.backend-calendar-views {
  --f7-segmented-strong-between-buttons: 0;
  --f7-segmented-strong-padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.backend-calendar-views.segmented .button {
  font-size: 13px;
  min-width: 44px;
  padding-left: 2px;
  padding-right: 2px;
}

.backend-calendar-period {
  display: flex;
  flex: 0 0 auto;
}

@media (max-width: 359px) {
  .backend-calendar-page {
    --f7-subnavbar-height: 88px;
  }

  .backend-calendar-subnavbar .subnavbar-inner {
    flex-wrap: wrap;
  }

  .backend-calendar-views {
    flex: 1 0 100%;
  }

  .backend-calendar-period {
    margin-inline-start: auto;
  }
}

.backend-calendar-footer {
  margin: 16px;
}

.backend-calendar-footer .backend-calendar-summary {
  margin-top: 8px;
}

.backend-calendar-agenda-day > .backend-calendar-day-text {
  padding-left: 16px;
  padding-right: 16px;
}

.backend-calendar-views button { min-height: 44px; }

.backend-calendar-summary,
.backend-calendar-day-text {
  color: var(--calendar-text-soft);
  font-size: 0.82rem;
  margin: 0;
}

.backend-calendar-nav-button,
.backend-calendar-more,
.backend-calendar-compact-day {
  min-height: 44px;
  min-width: 44px;
}

/* F7 stylt seine `.link`-Klasse am Anker (`.navbar a.link`); diese Knöpfe
   bleiben <button>, damit „Vorheriger Zeitraum" an den Grenzen des Zeitraums
   wirklich deaktiviert ist. Der Browser-Rahmen (grauer Grund, 2px outset) muss
   deshalb zurückgesetzt werden — mit der Farbe, die F7 seinen Navbar-Links
   gibt, sonst wird der Text schwarz. */
.backend-calendar-nav-button {
  appearance: none;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--f7-navbar-link-color, var(--f7-bars-link-color, var(--f7-theme-color)));
  font: inherit;
  font-size: var(--f7-navbar-font-size, 17px);
  margin: 0;
  padding: 0;
  width: auto;
}

.backend-calendar-nav-button:disabled {
  opacity: 0.4;
}


.backend-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.backend-calendar-legend li {
  align-items: center;
  display: flex;
  font-size: 0.82rem;
  gap: 6px;
}

.backend-calendar-day-title {
  font-size: 1rem;
  margin: 12px 16px 4px;
}

.backend-calendar-day-title[aria-current='date'] {
  color: var(--webapp-accent-text);
}

.backend-calendar-empty {
  margin: 0 16px;
}

/* Eintrag: eine Zeile Uhrzeit, Titel, Untertitel, Legendentext, Aktionen. */
.backend-calendar-entry {
  background: color-mix(in srgb, var(--calendar-tone) 10%, var(--ds-surface-card));
  border-left: 4px solid var(--calendar-tone);
  color: var(--ds-color-text);
  list-style: none;
  overflow-wrap: anywhere;
}

.backend-calendar-entry-agenda,
.backend-calendar-entry-swipe .backend-calendar-entry-content {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
}

.backend-calendar-entry-swipe .backend-calendar-entry-content {
  background: color-mix(in srgb, var(--calendar-tone) 10%, var(--ds-surface-card));
}

.backend-calendar-entry-time {
  color: var(--calendar-text-soft);
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 62px;
}

.backend-calendar-entry-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.backend-calendar-entry-title {
  font-weight: 600;
}

.backend-calendar-entry-link {
  appearance: none;
  background: none;
  border: 0;
  color: var(--webapp-accent-text);
  font: inherit;
  font-weight: 600;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}

.backend-calendar-entry-link:focus-visible,
.backend-calendar-entry:focus-visible,
.backend-calendar-slot:focus-visible,
.backend-calendar-more:focus-visible,
.backend-calendar-compact-day:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

.backend-calendar-drop-target {
  align-items: center;
  display: flex;
  min-height: 44px;
}

.backend-calendar-entry-dragging {
  opacity: 0.55;
}

.backend-calendar-move {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backend-calendar-move p {
  flex: 1;
  margin: 0;
  min-width: 12rem;
}

/* The destination hint is part of the live status, on a line of its own. */
.backend-calendar-move-hint {
  color: var(--calendar-text-soft);
}

.backend-calendar-entry-subtitle,
.backend-calendar-entry-tone {
  color: var(--calendar-text-soft);
  font-size: 0.82rem;
}

.backend-calendar-entry-tone {
  align-items: center;
  display: flex;
  gap: 6px;
}

.backend-calendar-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* Kontaktwege (O9): reine Geraete-Links, Flaeche wie die Wisch-Aktionen, mindestens 44 px hoch. */
.backend-calendar-entry-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.backend-calendar-contact-link {
  align-items: center;
  border: 1px solid var(--ds-color-muted);
  border-radius: 8px;
  color: var(--webapp-accent-text);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 44px;
  padding: 0 12px;
  text-decoration: none;
}

.backend-calendar-contact-link:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

.backend-calendar-swipe {
  font-weight: 600;
}

.backend-calendar-swipe-danger {
  --f7-swipeout-button-bg-color: #c92a2a;
}

.backend-calendar-swipe-neutral {
  --f7-swipeout-button-bg-color: #495057;
}

/* Telefon: Tagesleiste. Eigene Regeln, weil die Tagesleiste des Design-Systems nur im Projekt gestylt ist. */
.backend-calendar-page .day-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 16px;
  scrollbar-width: none;
}

.backend-calendar-page .day-strip::-webkit-scrollbar {
  display: none;
}

.backend-calendar-page .day-tile {
  appearance: none;
  background: var(--ds-surface-card);
  border: 2px solid transparent;
  border-radius: 12px;
  color: var(--ds-color-text);
  flex: 1 0 44px;
  font: inherit;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 0;
}

.backend-calendar-page .day-tile-muted {
  color: var(--calendar-text-soft);
}

.backend-calendar-page .day-tile-active {
  background: color-mix(in srgb, var(--webapp-accent) 18%, var(--ds-surface-card));
  border-color: var(--webapp-accent-text);
}

.backend-calendar-page .day-tile:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

.backend-calendar-page .day-tile-wd {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.backend-calendar-page .day-tile-num {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
}

.backend-calendar-page .day-tile-bar {
  background: color-mix(in srgb, var(--webapp-accent) 16%, var(--ds-surface-card));
  border-radius: 999px;
  display: block;
  height: 3px;
  margin: 4px 7px 0;
  overflow: hidden;
}

.backend-calendar-page .day-tile-bar-fill {
  background: var(--webapp-accent);
  display: block;
  height: 100%;
}

/* Telefon: Monat als kompaktes Tagesraster mit Anzahl. */
.backend-calendar-compact {
  padding: 0 16px;
}

.backend-calendar-compact-head,
.backend-calendar-compact-days {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.backend-calendar-compact-head {
  color: var(--calendar-text-soft);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.backend-calendar-compact-day {
  appearance: none;
  background: var(--ds-surface-card);
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--ds-color-text);
  display: flex;
  flex-direction: column;
  font: inherit;
  padding: 2px 0;
}

.backend-calendar-compact-active {
  background: color-mix(in srgb, var(--webapp-accent) 18%, var(--ds-surface-card));
  border-color: var(--webapp-accent-text);
}

.backend-calendar-compact-day[aria-current='date'] .backend-calendar-compact-num {
  color: var(--webapp-accent-text);
  font-weight: 800;
}

.backend-calendar-compact-count {
  color: var(--calendar-text-soft);
  font-size: 0.7rem;
  min-height: 1em;
}

/* Ab 768 px: Zeitraster fuer Woche und Tag. Positionen sind nur visuell. */
.backend-calendar-grid {
  display: grid;
  gap: 0 4px;
  grid-template-columns: 3.5rem repeat(var(--calendar-columns), minmax(0, 1fr));
  padding: 0 16px;
}

.backend-calendar-hour {
  color: var(--calendar-text-soft);
  font-size: 0.7rem;
}

.backend-calendar-column {
  position: relative;
}

.backend-calendar-day-head {
  align-items: flex-start;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.backend-calendar-column .backend-calendar-day-title {
  margin: 4px 0 0;
}

.backend-calendar-column-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  position: relative;
}

.backend-calendar-column-entries > .backend-calendar-entry {
  box-sizing: border-box;
  overflow: hidden;
  padding: 2px 4px;
  pointer-events: auto;
  position: absolute;
  z-index: 1;
}

/* Raised only while its actions menu is open: hovering or dragging never unfolds an entry over its neighbour. */
.backend-calendar-column-entries > .backend-calendar-entry:has(.backend-calendar-entry-menu) {
  z-index: 5;
}

.backend-calendar-column-entries > .backend-calendar-entry,
.backend-calendar-cell .backend-calendar-entry {
  overflow: visible;
}

.backend-calendar-column-entries .backend-calendar-entry-clip {
  box-sizing: border-box;
  inset: 0;
  overflow: hidden;
  padding: 2px 44px 2px 4px;
  position: absolute;
}

.backend-calendar-cell .backend-calendar-entry {
  min-height: 44px;
  position: relative;
}

.backend-calendar-entry-menu-wrap {
  position: absolute;
  right: 0;
  top: 0;
}

.backend-calendar-entry-menu-button {
  appearance: none;
  background: none;
  border: 0;
  color: var(--webapp-accent-text);
  font-size: 1.2rem;
  font-weight: 700;
  height: 44px;
  line-height: 1;
  width: 44px;
}

.backend-calendar-entry-menu-button:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

.backend-calendar-entry-menu {
  background: var(--ds-surface-card);
  border: 1px solid var(--ds-color-muted);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgb(0 0 0 / 20%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 11rem;
  padding: 8px;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 10;
}

.backend-calendar-entry-menu .button,
.backend-calendar-entry-menu .backend-calendar-contact-link {
  min-height: 44px;
}

.backend-calendar-column-entries .backend-calendar-entry-time {
  min-width: 0;
}

.backend-calendar-slots {
  left: 0;
  position: absolute;
  right: 0;
  z-index: 0;
}

.backend-calendar-slot {
  appearance: none;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ds-border-bar);
  display: block;
  width: 100%;
}

/* Ab 768 px: Monat als Wochenraster. */
.backend-calendar-month {
  padding: 0 16px;
}

.backend-calendar-month-head,
.backend-calendar-month-week {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.backend-calendar-month-head {
  color: var(--calendar-text-soft);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.backend-calendar-cell {
  background: var(--ds-surface-card);
  min-height: 96px;
  min-width: 0;
  padding: 2px;
}

.backend-calendar-cell .backend-calendar-day-title {
  font-size: 0.85rem;
  margin: 2px 4px;
}

.backend-calendar-cell ul {
  margin: 0;
  padding: 0;
}

.backend-calendar-cell .backend-calendar-entry {
  margin-bottom: 2px;
  padding: 2px 44px 2px 4px;
}

.backend-calendar-cell .backend-calendar-entry-time {
  min-width: 0;
}

.backend-calendar-outside .backend-calendar-day-title {
  color: var(--ds-color-muted);
}

.backend-calendar-more,
.backend-calendar-cell-create {
  appearance: none;
  background: none;
  border: 0;
  color: var(--webapp-accent-text);
  font: inherit;
  font-size: 0.8rem;
}

/* ── Navigation: Hubs und Desktop-Sidebar ────────────────────────────────
   Gehoert zu resources/f7/backend/navigation.tsx (NavigationHub,
   NavigationRow, NavigationSidebar). Struktur und Klassennamen stehen dort,
   hier steht nur die Darstellung. Beides zeigt DASSELBE Modell: unter
   1024px die Hubs (Chrome bleibt die F7-Tabbar), ab 1024px die Sidebar,
   die die Tabbar ersetzt.

   Masse nach HIG: Listenzeilen und Sidebar-Links mindestens 44px hoch,
   Gruppenueberschriften Footnote (13/18), Zeilentext Body (17/22).
   Farben ausschliesslich aus --ds-*; der Akzent ist FLAECHE, Text darauf
   nutzt --webapp-accent-text. Getoente Flaechen mischen gegen
   --ds-surface-card, nie gegen hartes Weiss (bin/check-css-darkmode.sh). */

.wf7-nav-hub {
  padding-bottom: 8px;
}

/* Zwei Bereiche brauchen sichtbaren Abstand: der block-title des zweiten
   traegt nur seinen eigenen oberen Rand, und der ist fuer zwei getrennte
   Gruppen zu knapp. */
.wf7-nav-section + .wf7-nav-section {
  margin-top: 20px;
}

/* Gruppenueberschrift als HIG Footnote statt F7-Standardschrift. */
.wf7-nav-section-title {
  color: var(--ds-color-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 18px;
  text-transform: none;
}

/* F7 setzt die Dark-Listenflaeche als DIREKTE Regel auf `ul` (nicht ueber
   --f7-list-bg-color). Ohne diese Bindung stuende die Liste in F7-Grau
   neben den Karten. */
.wf7-nav-list ul {
  background: var(--ds-surface-card);
}

.wf7-nav-item {
  list-style: none;
}

.wf7-nav-link {
  text-decoration: none;
}

.wf7-nav-link:focus-visible {
  outline: 2px solid var(--webapp-accent-text);
  outline-offset: 2px;
}

/* Aktueller Eintrag: getoente Zeile plus Akzent-Text. Die Toenung liegt auf
   .item-content, weil F7 die Zeilenflaeche darueber zeichnet. */
.wf7-nav-link-current .item-content {
  background: color-mix(in srgb, var(--webapp-accent) 12%, var(--ds-surface-card));
}

.wf7-nav-link-current .wf7-nav-label {
  color: var(--webapp-accent-text);
  font-weight: 600;
}

.wf7-nav-icon {
  color: var(--webapp-accent-text);
  font-size: 22px;
  height: 24px;
  line-height: 24px;
  width: 24px;
}

/* Eigene Box wie .admin-entity-title-text: .item-title ist flex, ein langer
   Name wuerde sonst die Zeile sprengen statt zu kuerzen. */
.wf7-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf7-nav-empty {
  color: var(--ds-color-muted);
}

/* Ab Tablet in derselben Spalte wie die Projektseiten (760px); sonst laufen
   die Hubs ueber die volle Fensterbreite. */
@media (min-width: 700px) {
  .wf7-nav-hub {
    margin-left: auto;
    margin-right: auto;
    max-width: 760px;
    width: 100%;
  }
}

/* Die Sidebar ist Desktop-Chrome: unter 1024px uebernimmt die Tabbar. */
.wf7-sidebar {
  --wf7-sidebar-width: 248px;
  display: none;
}

@media (min-width: 1024px) {
  /* Sie sitzt im selben Bezugsrahmen wie ein .views-Container (position:
     relative, volle Hoehe) und traegt die Safe-Areas selbst — F7 verteilt
     sie sonst nur auf .view und .page-content. */
  .wf7-sidebar {
    background: var(--ds-surface-card);
    border-right: 1px solid var(--ds-border-bar);
    bottom: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2px;
    left: 0;
    overflow-y: auto;
    padding: calc(20px + var(--f7-safe-area-top)) 14px calc(14px + var(--f7-safe-area-bottom));
    position: absolute;
    scrollbar-color: var(--ds-border-bar) transparent;
    scrollbar-width: thin;
    top: 0;
    width: var(--wf7-sidebar-width);
    z-index: 6000;
  }

  /* Die Sidebar nimmt ihren Platz ein, statt den Inhalt zu ueberdecken. Nur
     wenn die Seite sie auch rendert (`:has`) — Projekte mit eigener
     Desktop-Navigation behalten ihren Rahmen, und die mobile Tabbar
     verschwindet nur, wo die Sidebar sie ersetzt. Der Selektor haengt am
     Framework7-Root, damit es gleich ist, ob die Shell die Sidebar als
     Geschwister der Views oder direkt in `.backend-shell` rendert. */
  .framework7-root:has(.wf7-sidebar) .backend-shell > .view {
    left: var(--wf7-sidebar-width, 248px);
    width: calc(100% - var(--wf7-sidebar-width, 248px));
  }

  .framework7-root:has(.wf7-sidebar) .backend-shell > .wf7-tabbar {
    display: none;
  }

  .wf7-sidebar-section {
    min-width: 0;
  }

  .wf7-sidebar-home {
    padding: 2px 0 6px;
  }

  /* Nachrichten ist eine einzelne Seite ohne Bereichskopf. */
  .wf7-sidebar-messages {
    padding-top: 8px;
  }

  .wf7-sidebar-title {
    color: var(--ds-color-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 18px;
    margin: 0;
    padding: 14px 12px 5px;
  }

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

  .wf7-sidebar-item {
    margin: 0;
  }

  .wf7-sidebar-link {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-sizing: border-box;
    color: var(--ds-color-muted);
    display: flex;
    font-family: inherit;
    font-size: 17px;
    font-weight: 500;
    gap: 12px;
    line-height: 22px;
    min-height: 44px;
    padding: 0 12px;
    text-align: start;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
    width: 100%;
  }

  .wf7-sidebar-link-current {
    background: color-mix(in srgb, var(--webapp-accent) 12%, var(--ds-surface-card));
    color: var(--webapp-accent-text);
    font-weight: 600;
  }

  .wf7-sidebar-link:focus-visible {
    outline: 2px solid var(--webapp-accent-text);
    outline-offset: 2px;
  }

  .wf7-sidebar-icon {
    color: var(--webapp-accent-text);
    flex: 0 0 22px;
    font-size: 22px;
    height: 22px;
    line-height: 22px;
    width: 22px;
  }

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

  /* Konto bleibt am Fuss, unabhaengig von der Laenge des Hauptbaums. */
  .wf7-sidebar-foot {
    border-top: 1px solid var(--ds-border-bar);
    margin-top: auto;
    padding-top: 12px;
  }

  .wf7-sidebar-logout,
  .wf7-sidebar-logout .wf7-sidebar-icon {
    color: var(--ds-backend-tone-danger-text);
  }
}

@media (hover: hover) and (pointer: fine) {
  .wf7-sidebar-link:hover {
    background: color-mix(in srgb, var(--ds-color-muted) 8%, transparent);
    color: var(--ds-color-text);
  }

  .wf7-sidebar-link-current:hover {
    background: color-mix(in srgb, var(--webapp-accent) 18%, var(--ds-surface-card));
    color: var(--webapp-accent-text);
  }

  .wf7-sidebar-logout:hover {
    color: var(--ds-backend-tone-danger-text);
  }
}

/* ── Backend-Geltungsbereich (Spec F7-Backend nativ, Scheibe 2) ─────────────
   Schrift, Seitengrund und Ton-Paare gelten nur unter html.wf7-backend (T3).
   Die Endnutzer-App unter /app behaelt DM Sans, ihren Seitengrund und ihre
   F7-Farbnamen. */
html.wf7-backend {
  --f7-page-bg-color: var(--ds-backend-surface-page);
  /* Listen, Formulare und Karten ohne sichtbare Umrandung (E3): F7 zieht die
     Linie ueber diese beiden Variablen, an vielen Stellen im Markup steht
     `list-outline-ios` (ListPage, FormPage, Dashboard, Adapter). */
  --f7-list-outline-border-color: transparent;
  --f7-list-outline-inset-border-color: transparent;
}

/* Project palettes already supply the semantic card token. */
html.wf7-backend:not(:where(.wf7-project-theme)) {
  --ds-surface-card: var(--ds-backend-surface-card);
}

html.wf7-backend .backend-page,
html.wf7-backend .backend-page .page-content {
  background-color: var(--ds-backend-surface-page);
}

/* Status-Plaketten: Ton-Klasse statt F7-Farbname (E10), Text gegen die
   getoente Flaeche >= 4,5:1 in hell und dunkel (S2-12). */
html.wf7-backend .badge.backend-tone-success { background-color: var(--ds-backend-tone-success-bg); color: var(--ds-backend-tone-success-text); }
html.wf7-backend .badge.backend-tone-warning { background-color: var(--ds-backend-tone-warning-bg); color: var(--ds-backend-tone-warning-text); }
html.wf7-backend .badge.backend-tone-info { background-color: var(--ds-backend-tone-info-bg); color: var(--ds-backend-tone-info-text); }
html.wf7-backend .badge.backend-tone-danger { background-color: var(--ds-backend-tone-danger-bg); color: var(--ds-backend-tone-danger-text); }
html.wf7-backend .badge.backend-tone-muted { background-color: var(--ds-backend-tone-muted-bg); color: var(--ds-backend-tone-muted-text); }

/* Kalendertöne auf dieselben Tokens (hell/dunkel). */
html.wf7-backend .backend-calendar-tone-success { --calendar-tone: var(--ds-backend-tone-success-text); }
html.wf7-backend .backend-calendar-tone-warning { --calendar-tone: var(--ds-backend-tone-warning-text); }
html.wf7-backend .backend-calendar-tone-danger { --calendar-tone: var(--ds-backend-tone-danger-text); }
html.wf7-backend .backend-calendar-tone-muted { --calendar-tone: var(--ds-backend-tone-muted-text); }

/* Formular-Abschnitt: fieldset ohne Browser-Rahmen, Legende wird Abschnitts-
   kopf und faellt bei einem einzigen Abschnitt weg (F1, S2-8). */
html.wf7-backend .backend-page fieldset.list {
  border: 0;
  border-radius: 24px;
  padding: 0;
}

html.wf7-backend .backend-page fieldset.list > legend.block-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  padding: 0;
  text-transform: none;
}

/* Feldzeile: Label 12/16, Eingabe 17/22, Abstand Label-Oberkante bis
   Eingabe-Oberkante 25 px (M1, S2-10). Der Wrap ist ein Block: Flex-Row
   wuerde Hilfe und Fehler neben die Eingabe setzen und deren Breite stehlen. */
html.wf7-backend .backend-page .item-label {
  color: var(--ds-color-muted);
  font-size: 12px;
  line-height: 16px;
  margin-bottom: 9px;
}

/* Der versteckte Submit-Helfer des Formulars: erlaubt Enter im Textfeld (implizite
   Absendung), ist aber kein sichtbarer Knopf (S2-7). */
html.wf7-backend .backend-page .backend-form-submit {
  /* touch-ok: aria-hidden implicit-submit helper; never an interactive target */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html.wf7-backend .backend-page .item-input-wrap {
  display: block;
  height: auto;
  margin: 0;
  min-height: 40px;
  padding: 0;
  width: 100%;
}

html.wf7-backend .backend-page .item-input-wrap:has(> .backend-search-suggest + .button) {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
}

html.wf7-backend .backend-page .item-input-wrap:has(> .backend-search-suggest + .button) > .backend-search-suggest {
  flex: 1 1 0;
  min-width: 0;
}

html.wf7-backend .backend-page .item-input-wrap > .backend-search-suggest + .button {
  flex: 0 0 44px;
  height: 44px;
  width: 44px;
}

html.wf7-backend .backend-page .item-input-wrap > .item-input-info,
html.wf7-backend .backend-page .item-input-wrap > .item-input-error-message {
  flex-basis: 100%;
}

html.wf7-backend .backend-select-chip {
  display: inline-block;
  margin-inline-end: 4px;
  margin-block-end: 4px;
  max-width: 100%;
  vertical-align: top;
}

html.wf7-backend .backend-select-chip > .button {
  max-width: 100%;
  min-height: 44px;
  width: auto;
}

html.wf7-backend .backend-page .item-input-wrap input:not([type=checkbox],[type=radio]),
html.wf7-backend .backend-page .item-input-wrap select,
html.wf7-backend .backend-page .item-input-wrap textarea {
  font-size: 17px;
  line-height: 22px;
  width: 100%;
}

/* Examples remain readable in both backend themes; the end-user shell keeps F7 defaults. */
html.wf7-backend .backend-page .item-input-wrap input::placeholder,
html.wf7-backend .backend-page .item-input-wrap textarea::placeholder {
  color: var(--ds-backend-tone-muted-text);
  opacity: 1;
}

html.wf7-backend .backend-page .item-input-info {
  color: var(--ds-color-muted);
  font-size: 12px;
  line-height: 16px;
  margin-top: 4px;
}

html.wf7-backend .backend-page .item-input-error-message {
  align-items: center;
  color: var(--ds-backend-tone-danger-text);
  display: flex;
  font-size: 12px;
  gap: 4px;
  line-height: 16px;
  margin-top: 4px;
}

/* Schalter rechts in der Zeile (F4); gesperrt traegt der Label die Klasse. */
html.wf7-backend .backend-field-inline .item-label {
  margin-bottom: 0;
}

html.wf7-backend .backend-field-inline .item-after {
  align-items: center;
  display: flex;
  margin-inline-start: auto;
}

html.wf7-backend .backend-field-notes {
  padding-top: 0;
}

/* Auswahlzeile (Smart Select) mit Hilfe oder Fehler: Titel und gewaehlter Wert bleiben in der ersten Zeile (der
   Titel schrumpft, der Wert ist von F7 auf 70 % begrenzt), Hilfe und Fehler stehen darunter. In der Flex-Zeile liefen
   Wert und Hilfetext sonst ohne Abstand ineinander (Benutzerformular „Gruppen“). Zeilen ohne Hinweis bleiben, wie
   Framework7 sie setzt. */
html.wf7-backend .backend-smart-select .item-inner:has(> .settings-field-help, > .field-error:not([hidden])) {
  flex-wrap: wrap;
}

html.wf7-backend .backend-smart-select .item-inner:has(> .settings-field-help, > .field-error:not([hidden])) > .item-title {
  flex: 1 1 0;
  min-width: 0;
}

html.wf7-backend .backend-smart-select .item-inner > .settings-field-help,
html.wf7-backend .backend-smart-select .item-inner > .field-error {
  flex-basis: 100%;
  order: 1;
}

html.wf7-backend .backend-smart-select .settings-field-help {
  color: var(--ds-color-muted);
  font-size: 12px;
  line-height: 16px;
  margin-top: 4px;
}

html.wf7-backend .backend-smart-select .field-error:not([hidden]) {
  align-items: center;
  color: var(--ds-backend-tone-danger-text);
  display: flex;
  font-size: 12px;
  gap: 4px;
  line-height: 16px;
  margin-top: 4px;
}

/* Dateizeile: die ganze Zeile waehlt, kein nativer Knopf (F6). */
html.wf7-backend .backend-file-row {
  align-items: center;
  display: flex;
  min-height: 44px;
  position: relative;
  width: 100%;
}

html.wf7-backend .backend-file-name {
  color: var(--ds-color-muted);
  flex: 1 1 auto;
  font-size: 15px;
  line-height: 20px;
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.wf7-backend .backend-file-input {
  height: 100%;
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

/* Navbar-Aktionen (Aktionsregel §6): Trefferflaeche 44 x 44, Label nur als
   zugaenglicher Name; Desktop-Pille bleibt F7s gefuellter Button. */
html.wf7-backend .backend-nav-action,
html.wf7-backend .backend-back,
html.wf7-backend .backend-row-more {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
}

html.wf7-backend .backend-list-row .swipeout-content {
  align-items: center;
  display: flex;
}

html.wf7-backend .backend-list-row .swipeout-content > .item-content {
  flex: 1;
  min-width: 0;
}

html.wf7-backend .backend-row-more {
  flex: 0 0 44px;
  margin-inline-end: 8px;
}

html.wf7-backend .backend-form-extras .list-button {
  background: transparent;
  border: 0;
  font: inherit;
  min-height: 44px;
  width: 100%;
  color: var(--webapp-accent-text);
  white-space: normal;
}

html.wf7-backend .backend-form-extras .list-button.color-red {
  color: var(--ds-backend-tone-danger-text);
}

html.wf7-backend .backend-nav-new .f7-icons {
  font-size: 22px;
}

/* Wischaktionen der Zeile: Loeschen rot, jede Aktion mindestens 44 px breit. */
html.wf7-backend .swipeout-actions-right .swipeout-action {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 64px;
  padding: 0 16px;
}

html.wf7-backend .swipeout-actions-right .admin-swipe-delete {
  background: var(--ds-backend-tone-danger-text);
  color: #ffffff; /* darkmode-ok: weisser Text auf der roten Loeschflaeche beider Modi */
}

/* Listenzeile: Titel eigene Textbox mit Ellipsis, Wert rechts mit gleich
   breiten Ziffern, Status als Plakette, Zeile als item-link mit Chevron. */
html.wf7-backend .backend-list-row .admin-title-row .item-title {
  flex: 1 1 50%;
  min-width: 50%;
}

html.wf7-backend .backend-list-row .backend-row-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.wf7-backend .backend-list-row .backend-row-after {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(50% - 8px);
  white-space: normal;
  font-variant-numeric: tabular-nums;
  margin-inline-start: 8px;
}

html.wf7-backend .backend-list-row .backend-row-subtitle {
  align-self: flex-start;
  color: var(--ds-color-muted);
  font-size: 15px;
  line-height: 20px;
  padding-left: 0;
  text-align: left;
}

/* Leerzustand ausserhalb der Liste (L1): Symbol 48, Text, runder Knopf 44. */
html.wf7-backend .backend-empty-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
}

html.wf7-backend .backend-empty-icon {
  color: var(--ds-color-muted);
  font-size: 48px;
  height: 48px;
  width: 48px;
}

html.wf7-backend .backend-empty-state p {
  color: var(--ds-color-muted);
  font-size: 17px;
  line-height: 22px;
  margin: 0;
}

html.wf7-backend .backend-empty-action {
  --f7-button-height: 44px;
  min-height: 44px;
  width: fit-content;
}

/* Untertitel der Liste als Fusszeile (13/18). */
html.wf7-backend .backend-page-footer,
html.wf7-backend .backend-settings-footer {
  font-size: 13px;
  line-height: 18px;
}

/* Am Telefon verdeckt die Tabbar keinen Inhalt: F7 polstert um ihre Hoehe,
   das gilt auch auf kurzen Viewports (E7, M5). Am Desktop gibt es keine
   Tabbar, dort bleibt nur die untere Safe-Area. */
@media (max-width: 1023.98px) {
  .backend-page .page-content {
    padding-bottom: calc(var(--f7-tabbar-icons-height) + var(--f7-safe-area-bottom));
  }
}

@media (min-width: 1024px) {
  html.wf7-backend .backend-shell .backend-page .page-content {
    padding-bottom: var(--f7-safe-area-bottom);
  }

  html.wf7-backend .backend-page:not(.backend-calendar-page) .page-content {
    padding-inline: max(0px, calc((100% - 760px) / 2));
  }

  html.wf7-backend .backend-page:not(.backend-calendar-page) > .navbar .navbar-inner {
    right: 0;
    margin-inline: auto;
    max-width: 760px;
  }

  /* Der grosse Titel bleibt; nur die leere normale Navbar-Zeile entfaellt. */
  html.wf7-backend .backend-page:has(> .navbar-large):not(:has(.navbar .right)) {
    --f7-navbar-height: 0px;
  }

  html.wf7-backend .backend-page:has(> .navbar-large):not(:has(.navbar .right)) > .navbar .navbar-inner {
    padding-top: var(--f7-safe-area-top);
    padding-bottom: 0;
  }

  html.wf7-backend .backend-page:has(> .navbar-large):not(:has(.navbar .right)) > .navbar .title {
    display: none;
  }
}

/* Shell state is shared with AdminLTE; F7 owns only its presentation. */
html.wf7-backend .backend-shell {
  --f7-safe-area-bottom: max(env(safe-area-inset-bottom), var(--band-h, 0px));
}
.backend-shell-bands {
  position: fixed;
  inset: auto 0 0;
  z-index: 7000;
  text-align: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--ds-surface-card);
  font-size: 15px;
  line-height: 20px;
}
.backend-test-band { padding: 8px; color: var(--ds-backend-tone-warning-text); background: var(--ds-backend-surface-card); }
.backend-impersonation-band { padding: 4px 12px; color: var(--ds-color-heading); }
.backend-impersonation-band form { display: inline; }
.backend-impersonation-band button {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--webapp-accent-text);
  background: transparent;
  border: 0;
  font: inherit;
}
.wf7-sidebar-brand { display: block; padding: 16px; color: var(--ds-color-heading); font-size: 22px; font-weight: 600; }
.wf7-sidebar-brand img { display: block; max-width: 100%; max-height: 64px; }
.wf7-sidebar-brand .wf7-sidebar-logo-dark { display: none; }
html.dark .wf7-sidebar-brand .wf7-sidebar-logo-light { display: none; }
html.dark .wf7-sidebar-brand .wf7-sidebar-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  html:not(.light) .wf7-sidebar-brand .wf7-sidebar-logo-light { display: none; }
  html:not(.light) .wf7-sidebar-brand .wf7-sidebar-logo-dark { display: block; }
}
.backend-app-version { padding: 12px 16px; color: var(--ds-color-muted); font-size: 13px; }
.backend-toast { --f7-toast-bg-color: var(--ds-backend-surface-card); --f7-toast-text-color: var(--ds-color-heading); border-inline-start: 4px solid var(--backend-toast-tone); }
.backend-toast-success { --backend-toast-tone: var(--ds-backend-tone-success-text); }
.backend-toast-info { --backend-toast-tone: var(--ds-backend-tone-info-text); }
.backend-toast-warning { --backend-toast-tone: var(--ds-backend-tone-warning-text); }
.backend-toast-danger { --backend-toast-tone: var(--ds-backend-tone-danger-text); }
.backend-toast .toast-text { color: var(--backend-toast-tone); }

.backend-money-field { display: flex; align-items: center; gap: 12px; }
.backend-money-field input { flex: 1; min-width: 0; }
.backend-money-suffix { color: var(--ds-color-muted); }
.backend-file-stored img { max-width: 120px; max-height: 120px; object-fit: contain; }
.backend-file-stored .item-checkbox { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.wf7-sidebar-user { display: flex; align-items: center; gap: 12px; padding: 16px; overflow-wrap: anywhere; font-size: 13px; }
.wf7-sidebar-user .profile-avatar { flex-shrink: 0; }
.konto-hero-groups { color: rgba(255, 255, 255, 0.82); font-size: 15px; }
img.profile-avatar { object-fit: cover; }
