/* Handy und Tablet bis 900 px: wie eine iPhone-App – schwebende Glas-Leiste unten,
   Profil-Blatt von unten, Listen wie in den „Einstellungen“. Geladen mit media="(max-width: 900px)". */

body { font-size: 1.0625rem; }  /* 17 px wie iOS */
.main {
  padding: calc(12px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
           calc(110px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

/* Großer Seitentitel (iOS „Large Title“) */
.topbar { margin-bottom: 20px; gap: 12px; }
.topbar h1, .profil h1 { font-size: 2.125rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.topbar > div:first-child { flex: 1 1 100%; }
.aktionen { width: 100%; gap: 10px; }
.aktionen > * { flex: 1 1 140px; }
.aktionen > form > .btn, .aktionen > .btn { width: 100%; }
.aktionen > .monat-wahl { flex: 1 1 100%; }
.monat-wahl > a.btn { width: 56px; padding-left: 0; padding-right: 0; }
.monat-wahl > .monat-anzeige { flex: 1; min-width: 0; }

.card { border-radius: 14px; padding: 16px; }
.grid { gap: 16px; }
.grid-2 { grid-template-columns: 1fr; }
.detail-grid { grid-template-columns: 1fr; }
.daten { grid-template-columns: 1fr; gap: 2px 0; }
.daten dd { margin-bottom: 8px; }

/* Knöpfe wie iOS: 50 px hoch, 12 px Rundung, 17 px fett */
.btn { min-height: 50px; border-radius: 12px; font-size: 1.0625rem; padding: 12px 18px; }
.btn-sm { min-height: 38px; font-size: .9375rem; padding: 6px 14px; border-radius: 10px; }
input, select, textarea { font-size: 17px; min-height: 44px; }
.formular input, .formular select { min-height: 44px; }
.formular .fuss { flex-direction: column-reverse; }
.formular .fuss .btn { width: 100%; }

/* ---------- Untere Leiste: schwebendes Glas ---------- */
.tab-leiste {
  display: grid; grid-template-columns: repeat(5, minmax(min-content, 1fr)); column-gap: 2px;
  position: fixed; z-index: 40;
  left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; padding: 6px;
  border-radius: 26px;
  background: var(--glas);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16), 0 0 0 .5px var(--border);
}
.tab-leiste a, .tab-leiste button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 4px 6px; border: none; border-radius: 20px; background: none; cursor: pointer;
  color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600; letter-spacing: -.02em; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tab-leiste svg { width: 24px; height: 24px; }
.tab-leiste span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* gewählter Punkt: Pille in der Hauptfarbe (12 %), gleitet beim Seitenwechsel (View Transition) */
.tab-leiste a.aktiv { color: var(--primary); }
.tab-leiste a.aktiv::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 20px;
  background: var(--primary-soft); view-transition-name: tab-pille;
}
.tab-profil {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sys-grau); color: #fff; font-size: .8rem; font-weight: 700;
}
.tab-zaehler, .tab-punkt {
  position: absolute; top: 4px; left: calc(50% + 6px);
  background: var(--sys-rot); color: #fff; font-style: normal; font-size: .75rem; font-weight: 700;
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px;
}
.tab-punkt { min-width: 10px; width: 10px; height: 10px; padding: 0; top: 6px; }

/* ---------- Profil-Blatt: die Seitenleiste kommt von unten ---------- */
.sidebar {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--schatten-fenster);
  transform: translateY(105%); visibility: hidden;
  transition: transform .4s var(--ease-out), visibility 0s linear .4s;
}
body.blatt-offen .sidebar { transform: none; visibility: visible; transition: transform .4s var(--ease-out); }
.blatt-griff { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--ios-fill); margin: 0 auto 12px; flex: none; }
.blatt-hintergrund {
  display: block; position: fixed; inset: 0; z-index: 55;
  background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-out);
}
body.blatt-offen .blatt-hintergrund { opacity: 1; pointer-events: auto; }
body.blatt-offen { overflow: hidden; }

.sidebar .brand, .sidebar .nav-suche { display: none; }
/* Kopf des Blatts: Name + runde Knöpfe (Hell/Dunkel, Passwort, Abmelden) */
.sidebar-footer { order: -1; background: var(--surface); border-radius: 14px; padding: 8px; margin-bottom: 8px; }
.konto-kopf { padding: 6px; }
.konto-knoepfe { padding: 6px; }
/* Menüpunkte als Gruppen wie in den Einstellungen */
.nav { display: flex; flex-direction: column; }
.nav-gruppe { padding: 18px 16px 6px; }
.nav a {
  background: var(--surface); border-radius: 0; padding: 10px 16px; min-height: 48px; gap: 14px;
  font-size: 1.0625rem; font-weight: 400; border-bottom: .5px solid var(--border);
}
.nav a.aktiv { background: var(--surface); }
.nav a .kachel { width: 30px; height: 30px; border-radius: 8px; }
.nav a .kachel svg { width: 18px; height: 18px; }
.nav > a:first-child, .nav-gruppe + a { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.nav > a:last-child, .nav > a:has(+ .nav-gruppe), .nav > a:has(+ .nav-block), .nav-block > a:last-child { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; border-bottom: none; }
.nav-block { display: flex; flex-direction: column; }
details.nav-block > summary.nav-gruppe { padding: 18px 16px 6px; }
.nav a.nav-unter { padding-left: 60px; font-size: 1rem; min-height: 44px; }
/* Übersicht, Kunden, Verträge stehen schon unten in der Leiste */
.nav > a:nth-of-type(-n+3) { display: none; }
.nav > a:nth-of-type(4):not(.nav-unter) { border-top-left-radius: 14px; border-top-right-radius: 14px; }

/* ---------- Listen wie „Einstellungen“: Tabellen werden zu weißen Zeilen ---------- */
.tabelle-wrap { overflow: visible; background: transparent; box-shadow: none; padding: 0; }
.tabelle-wrap table:not(.teamkalender), .tabelle-wrap table:not(.teamkalender) tbody { display: block; }
.tabelle-wrap table:not(.teamkalender) thead { display: none; }
.tabelle-wrap table:not(.teamkalender) tr {
  display: block; background: var(--surface); padding: 12px 16px;
  border-bottom: .5px solid var(--border);
}
.tabelle-wrap table:not(.teamkalender) tbody tr:first-child { border-radius: 14px 14px 0 0; }
.tabelle-wrap table:not(.teamkalender) tbody tr:last-child { border-radius: 0 0 14px 14px; border-bottom: none; }
.tabelle-wrap table:not(.teamkalender) tbody tr:only-child { border-radius: 14px; }
.tabelle-wrap table:not(.teamkalender) td {
  display: block; padding: 4px 0; border: none; text-align: right;
  white-space: normal; overflow-wrap: anywhere; overflow: hidden;
}
.tabelle-wrap table:not(.teamkalender) td * { white-space: normal; }
.tabelle-wrap table:not(.teamkalender) td::before {
  content: attr(data-label); float: left; max-width: 45%; margin-right: 12px;
  color: var(--muted); font-size: .9375rem; font-weight: 400; text-align: left;
}
.tabelle-wrap table:not(.teamkalender) td:not([data-label])::before { content: none; }
/* erste Zelle = Titel der Zeile, ohne Beschriftung */
.tabelle-wrap table:not(.teamkalender) td:first-child { text-align: left; padding-bottom: 8px; font-size: 1.0625rem; }
.tabelle-wrap table:not(.teamkalender) td:first-child::before { content: none; }
.tabelle-wrap table:not(.teamkalender) td.zelle-leer { display: none; }
.tabelle-wrap table:not(.teamkalender) .badges, .tabelle-wrap table:not(.teamkalender) .schnell-status { justify-content: flex-end; }
.tabelle-wrap > :not(table):not(.teamkalender-wrap) { padding-left: 4px; padding-right: 4px; }
.tabelle-wrap .card-kopf, .tabelle-wrap > h2 { padding: 0 4px; }
.teamkalender-wrap { background: var(--surface); border-radius: 14px; }
table.feste-spalten { table-layout: auto; }

/* Filter: ein Feld pro Reihe, Umschalter höchstens 3 nebeneinander */
.filter { gap: 10px; }
.filter > select, .filter > .kombi-filter { flex: 1 1 calc(50% - 5px); }
.vertrag-filter .filter-raster, .vertrag-filter .filter-raster.mit-betreuer, .vertrag-filter .filter-raster.sechs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kombi-panel { width: 100%; }

/* Fenster als Blatt von unten */
dialog.card, .tag-fenster, .heute-fenster {
  margin: auto auto 0 !important; width: 100%; max-width: 100%;
  border-radius: 14px 14px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.erinnerung-toast { top: calc(10px + env(safe-area-inset-top)); left: 16px; right: 16px; max-width: none; }
/* Umschalter mit vielen Segmenten: Reihen füllen sich ganz, Text bricht nicht ab */
.endet-leiste.gleich { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.endet-leiste.gleich .endet-chip { white-space: normal; text-align: center; line-height: 1.25; min-height: 44px; gap: 6px; }
.endet-leiste.gleich .endet-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }

.kpi .wert { font-size: 1.5rem; white-space: nowrap; }
.blatt-griff { order: -2; }

/* Provision im Detail am Handy: Sparten in einer Zeile, leere Werte weg */
.tabelle-wrap table.provision-tabelle .sp-spalte, .tabelle-wrap table.provision-tabelle td.sp-null { display: none; }
.tabelle-wrap table.provision-tabelle td.nur-handy:not(.zelle-leer) { display: block; }
.tabelle-wrap table.provision-tabelle td.status-zelle { max-width: none; font-size: .875rem; }
.tabelle-wrap table.provision-tabelle td.einzug { padding-left: 0; }
.tabelle-wrap table.provision-tabelle tr.gruppen-zeile { background: var(--surface-2); }
.tabelle-wrap table.provision-tabelle tr.gruppen-zeile td { background: transparent; }

/* Listen-Filter am Handy: Suche + kleiner Knopf „Filter“ nebeneinander, Blatt kommt von unten */
.listen-filter > .suche { flex: 1 1 0; }
.filter-klapp > summary { padding: 9px 14px; }
.filter-klapp > summary > span { display: none; }
.filter-blatt {
  position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 60;
  grid-template-columns: 1fr; border-radius: 16px 16px 0 0; max-height: 82vh;
  padding: 6px 14px calc(16px + env(safe-area-inset-bottom));
}
.filter-klapp[open]::before { z-index: 59; background: rgba(0, 0, 0, .4); }
.filter-fuss { bottom: calc(-16px - env(safe-area-inset-bottom)); padding-bottom: 6px; }
/* Schnellauswahl in 2 Zeilen */
.schnell-leiste { grid-auto-flow: row; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.schnell-leiste.vier > * { grid-column: span 3; }
.schnell-leiste.fuenf > :nth-child(-n+3) { grid-column: span 2; }
.schnell-leiste.fuenf > :nth-child(n+4) { grid-column: span 3; }
.schnell-chip { flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 10px 8px 14px; font-size: .8125rem; line-height: 1.2; }
.schnell-chip span { white-space: normal; }
.schnell-leiste.eins { grid-template-columns: 1fr; }
.schnell-leiste.eins > * { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; }
