/* NAVO – App-Modus: iOS-/Android-App und Handy-Browser (Klasse .appmode an <html>, gesetzt von appmode.js).
 * Ohne .appmode greift hier nichts – Desktop und Tablet bleiben unverändert. Helle Flächen (Dunkelmodus: Grautöne), Akzent der Firma/NAVO, Kacheln statt Zeilen. */
:root {
  --ap-bar: var(--panel);
  --ap-bar-fg: var(--muted);
  --ap-bar-line: var(--line);
  --ap-hi: var(--accent);
  --ap-tile: var(--panel);
  --ap-tint: color-mix(in srgb, var(--accent) 10%, var(--panel));
  --ap-tint-2: color-mix(in srgb, var(--accent) 16%, var(--panel));
  --ap-bar-h: 64px;
  --ap-head-h: 58px;
  --ap-safe-b: env(safe-area-inset-bottom, 0px);
  --ap-safe-t: env(safe-area-inset-top, 0px);
  --ap-bottom: calc(var(--ap-bar-h) + var(--ap-safe-b));
}

/* ---------- Grundgerüst: ohne Seitenleiste, Hamburger-Menü und klassische Kopfleiste ---------- */
.appmode body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
.appmode .app {
  display: block;
  min-height: 100dvh;
}
.appmode .side,
.appmode .top,
.appmode .side-backdrop,
.appmode .menu-btn,
.appmode .ai-fab,
.appmode #aiFab {
  display: none !important;
}
.appmode .main {
  min-width: 0;
  overflow-x: clip;
}
.appmode .content {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px calc(var(--ap-bottom) + 28px);
}
.appmode body.ap-has-dock .content {
  padding-bottom: calc(var(--ap-bottom) + 96px);
}
.appmode .ap-hide,
.appmode .ap-docked {
  display: none !important;
}
.appmode .toasts {
  left: 16px;
  right: 16px;
  top: calc(var(--ap-safe-t) + 68px);
  bottom: auto;
  align-items: center;
} /* oben unter dem Seitenkopf: verdeckt weder Leiste, Sheets noch Speichern */
.appmode .toast {
  max-width: 100%;
}
.appmode .update-bar {
  bottom: calc(var(--ap-bottom) + 12px) !important;
}
.appmode #banners:empty {
  display: none;
}
.appmode #banners {
  padding: 8px 16px 0;
  max-width: 760px;
  margin: 0 auto;
}

/* ---------- Seitenkopf: Titel linksbündig, Zurück links, Lupe/Aktionen rechts ---------- */
.ap-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: calc(var(--ap-head-h) + var(--ap-safe-t));
  padding: calc(var(--ap-safe-t) + 7px) 12px 7px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
}
.ap-hl {
  display: flex;
  gap: 4px;
  margin-left: -8px;
}
.ap-hl:empty {
  display: none;
}
.ap-hr {
  display: flex;
  gap: 6px;
  flex: none;
}
.ap-ht {
  flex: 1;
  min-width: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
body.ap-sub .ap-ht {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
body.ap-sub .ap-head {
  border-bottom-color: var(--line);
}
.ap-hbtn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ap-hbtn svg {
  width: 21px;
  height: 21px;
}
.ap-hbtn:active {
  transform: scale(0.94);
}
.ap-hbtn.ap-plus {
  background: var(--accent);
  color: var(--on-accent);
}
.ap-back {
  background: transparent;
  width: 40px;
}
.ap-back svg {
  width: 26px;
  height: 26px;
}

/* Vorhandene Seiten: Titel steht oben, Knopfleisten umbrechen sauber, einspaltig */
.appmode .page-head {
  margin-bottom: 12px;
  gap: 8px;
}
.appmode .page-head > .spacer {
  display: none;
}
.appmode .page-head h1 {
  font-size: 0 !important;
  line-height: 0;
  margin: 0;
}
.appmode .page-head h1 .badge {
  font-size: 12px;
  line-height: 1.3;
  margin: 2px 6px 2px 0;
}
.appmode .page-head h1:not(:has(.badge)) {
  display: none;
}
.appmode .page-head > div:first-child:not(.btn-row) {
  flex: 1 1 100%;
  min-width: 0;
}
.appmode .page-head .btn-row,
.appmode .btn-row {
  flex-wrap: wrap;
  gap: 8px;
}
.appmode .page-head .search,
.appmode .page-head input.search {
  flex: 1 1 100%;
  max-width: none;
}
.appmode .split,
.appmode .split3,
.appmode .g2,
.appmode .g3,
.appmode .g4 {
  grid-template-columns: minmax(0, 1fr);
}
.appmode .form {
  grid-template-columns: minmax(0, 1fr);
}
.appmode .card {
  border-radius: 16px;
}
.appmode .subnav {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 6px;
  border-bottom: 0;
  margin: 0 -16px 12px;
  padding: 2px 16px 6px;
}
.appmode .subnav::-webkit-scrollbar {
  display: none;
}
.appmode .subnav a {
  flex: none;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}
.appmode .subnav a.active {
  background: var(--ap-tint-2);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  font-weight: 600;
}

/* Touch: 16 px Eingaben (kein Zoom unter iOS), Ziele ≥ 44 px */
.appmode input:not([type='checkbox']):not([type='radio']):not([type='color']):not([type='range']),
.appmode select,
.appmode textarea {
  font-size: 16px;
  min-height: 44px;
}
.appmode .btn {
  min-height: 44px;
}
.appmode .btn.sm {
  min-height: 40px;
  padding: 0 12px;
}
.appmode .chk {
  min-height: 40px;
  align-items: center;
}
.appmode input[type='checkbox'],
.appmode input[type='radio'] {
  width: 20px;
  height: 20px;
}

/* Dialoge als Bottom-Sheet */
.appmode .modal-bg {
  place-items: end center;
  align-items: flex-end;
  padding: 0;
  padding-top: calc(var(--ap-safe-t) + 12px);
  z-index: 60;
}
.appmode .modal,
.appmode .modal.wide {
  width: 100% !important;
  max-width: 760px !important;
  border-radius: 22px 22px 0 0;
  max-height: calc(100dvh - var(--ap-safe-t) - 16px);
  margin-top: auto;
  animation: amUp 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.appmode .modal header {
  padding: 14px 18px;
  position: relative;
}
.appmode .modal header::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 38px;
  height: 5px;
  margin-left: -19px;
  border-radius: 3px;
  background: var(--line-2);
}
.appmode .modal .body {
  padding: 16px 18px;
}
.appmode .modal footer {
  flex-wrap: wrap;
  padding: 12px 18px calc(12px + var(--ap-safe-b));
}
.appmode .modal footer .btn {
  flex: 1 1 140px;
  justify-content: center;
  min-height: 48px;
  font-size: 15.5px;
  margin-right: 0 !important;
}
.appmode .pop-menu {
  z-index: 70;
}
@keyframes amUp {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* ---------- Untere Leiste (hell / dunkelgrau) ---------- */
.ap-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 44;
  background: var(--ap-bar);
  padding-bottom: var(--ap-safe-b);
  border-top: 1px solid var(--ap-bar-line);
  box-shadow: 0 -6px 24px -18px rgba(0, 0, 0, 0.35);
}
.ap-bar-in {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: var(--ap-bar-h);
  max-width: 640px;
  margin: 0 auto;
}
.ap-bi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 6px 2px 6px;
  border: 0;
  background: none;
  color: var(--ap-bar-fg);
  font: 500 11px/1.1 var(--font);
  letter-spacing: 0.01em;
  text-decoration: none !important;
  cursor: pointer;
  -webkit-touch-callout: none;
  user-select: none;
}
.ap-bi > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-fi {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 30px;
  border-radius: 15px;
  transition: background 0.15s;
}
.ap-fi svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.8;
}
.ap-bi.on {
  color: var(--text);
  font-weight: 650;
}
.ap-bi.on .ap-fi {
  color: var(--accent);
  background: var(--ap-tint);
}
.ap-bi:active .ap-fi {
  transform: scale(0.92);
}
.ap-void {
  pointer-events: none;
}
.ap-mid {
  justify-content: center;
}
.ap-fab {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 0.18s ease;
}
.ap-fab svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.2;
}
.ap-mid.open .ap-fab {
  transform: rotate(45deg);
  background: var(--text);
  color: var(--bg);
  box-shadow: none;
}
.ap-mid:active .ap-fab {
  transform: scale(0.93);
}
.ap-dot {
  position: absolute;
  top: 2px;
  right: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad, #e5484d);
  box-shadow: 0 0 0 2px var(--ap-bar);
}
.ap-dot[hidden] {
  display: none;
}
.ap-bcnt {
  position: absolute;
  top: -2px;
  left: 30px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad, #e5484d);
  color: #fff;
  font: 700 10.5px/18px var(--font);
  text-align: center;
  box-shadow: 0 0 0 2px var(--ap-bar);
}
.ap-bcnt[hidden] {
  display: none;
}

/* Primäraktion groß unten (über der Leiste) */
.ap-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--ap-bottom);
  z-index: 43;
  display: flex;
  gap: 10px;
  padding: 12px 16px 10px;
  max-width: 760px;
  margin: 0 auto;
  background: linear-gradient(to bottom, transparent, var(--bg) 26%);
}
.ap-dock[hidden] {
  display: none;
}
.ap-dock .btn {
  flex: 1 1 0;
  min-height: 50px;
  justify-content: center;
  font-size: 16px;
  border-radius: 14px;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.45);
}
.ap-dock .btn:not(.primary) {
  background: var(--panel);
}
body.ap-menu-open .ap-dock,
body.ap-search-open .ap-dock {
  display: none;
}

/* ---------- „Mehr“: Profilkopf, Schnellzugriff, Kachel-Raster je Gruppe ---------- */
.ap-menu {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--ap-bottom);
  z-index: 45;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.16s ease,
    transform 0.2s ease;
}
.ap-menu.in {
  opacity: 1;
  transform: none;
}
body.ap-menu-open {
  overflow: hidden;
}
.ap-mtop {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--ap-safe-t) + 9px) 12px 6px 16px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.ap-mtitle {
  flex: 1;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.ap-mscroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 16px 28px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.ap-prof {
  background: var(--ap-tile);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}
.ap-prof-me,
.ap-prof-co {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ap-prof-me {
  padding: 14px 14px 12px;
}
.ap-prof-co {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  min-height: 50px;
}
.ap-prof-co.static {
  cursor: default;
}
.ap-avatar {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: var(--ap-tint-2);
  color: var(--accent);
  font: 700 16px var(--font);
  display: grid;
  place-items: center;
}
.ap-prof-t {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ap-prof-t b {
  font-size: 17px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-prof-t small {
  color: var(--muted);
  font-size: 13.5px;
}
.ap-co {
  height: 26px;
  max-width: 96px;
  object-fit: contain;
  flex: none;
  border-radius: 6px;
}
.ap-co-ic {
  width: 26px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.ap-co-ic svg {
  width: 20px;
  height: 20px;
}
.ap-coname {
  flex: 1;
  min-width: 0;
  font-weight: 550;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-co-sw {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  flex: none;
}
.ap-co-sw svg {
  width: 15px;
  height: 15px;
}
.ap-sec {
  margin-top: 20px;
}
.ap-gh {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.ap-gh-a {
  border: 0;
  background: none;
  color: var(--accent);
  font: 600 14.5px var(--font);
  padding: 4px 0;
  cursor: pointer;
}
.ap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ap-tile2 {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 92px;
  padding: 12px 10px 11px 12px;
  border: 0;
  border-radius: 16px;
  background: var(--ap-tile);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--text);
  text-decoration: none !important;
  text-align: left;
  font: inherit;
  cursor: pointer;
  -webkit-touch-callout: none;
  user-select: none;
}
.ap-tile2:active {
  transform: scale(0.97);
  background: var(--ap-tint);
}
.ap-tile2.sm {
  min-height: 78px;
}
.ap-ti {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--ap-tint);
  color: var(--accent);
  flex: none;
}
.ap-ti svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}
.ap-tl {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.22;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  -webkit-hyphens: manual;
  hyphens: manual;
}
.ap-tile2 .ap-cnt {
  position: absolute;
  top: 10px;
  right: 10px;
}
.ap-cnt {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.ap-cnt[hidden] {
  display: none;
}
.ap-tile2[data-locked] {
  opacity: 0.55;
}
.ap-lock {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--muted);
}
.ap-lock svg {
  width: 15px;
  height: 15px;
}
.ap-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.ap-q {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 9px;
  border: 0;
  border-radius: 16px;
  background: var(--ap-tile);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  min-width: 0;
  -webkit-touch-callout: none;
  user-select: none;
}
.ap-q .ap-ti {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.ap-q .ap-tl {
  font-size: 12px;
  text-align: center;
  -webkit-line-clamp: 1;
  max-width: 100%;
}
.ap-q.on .ap-ti {
  box-shadow: 0 0 0 3px var(--ap-tint-2);
}
.ap-q.add {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.ap-q.add .ap-ti {
  background: var(--ap-tint);
  color: var(--accent);
}
.ap-q.add.picking .ap-ti {
  box-shadow: 0 0 0 2px var(--accent);
}
.ap-quick:has(> .ap-q.add:only-child) {
  display: block;
}
.ap-q.add:only-child {
  flex-direction: row;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: var(--ap-tile);
  box-shadow: 0 0 0 1px var(--line);
  text-align: left;
}
.ap-q.add:only-child .ap-tl {
  font-size: 14px;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}
.ap-ai {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 0;
  border-radius: 16px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: linear-gradient(120deg, var(--ap-tint-2), var(--ap-tint));
  color: var(--text);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.ap-ai .ap-ti {
  background: var(--accent);
  color: var(--on-accent);
}
.ap-ai .ap-tl {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  -webkit-line-clamp: unset;
}
.ap-ai .ap-tl b {
  font-size: 15.5px;
}
.ap-ai .ap-tl small {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}
.ap-ai > svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.ap-pick {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 14px;
  padding: 10px 10px 10px 14px;
  margin: 12px 0 0;
  font-weight: 600;
  font-size: 14.5px;
}
.ap-pick span {
  flex: 1;
}
.ap-pick svg {
  width: 20px;
  height: 20px;
}
.ap-pick-x {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: none;
  color: inherit;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 14px;
  font: 600 14px var(--font);
}
.ap-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  border: 0;
  border-radius: 14px;
  background: var(--ap-tile);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--bad, #d93036);
  font: 600 15.5px var(--font);
  cursor: pointer;
}
.ap-logout svg {
  width: 19px;
  height: 19px;
}
.ap-hint {
  color: var(--faint);
  font-size: 12.5px;
  text-align: center;
  margin: 14px 0 0;
}

/* ---------- Bottom-Sheets („+“, Sortieren, Schnellzugriff, Zeitraum) ---------- */
.ap-sheet-bg {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--ap-bottom);
  z-index: 47;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease;
}
.ap-sheet-bg.in {
  background: rgba(10, 14, 22, 0.38);
}
.ap-sheet-bg.over {
  z-index: 49;
}
.ap-sheet {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--text);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px 14px;
  max-height: 82vh;
  overflow-y: auto;
  transform: translateY(105%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -16px 40px -20px rgba(0, 0, 0, 0.45);
}
.ap-sheet-bg.in .ap-sheet {
  transform: none;
}
.ap-grab {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-2);
  margin: 2px auto 10px;
}
.ap-sh-h {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 14px 2px 10px;
}
.ap-sheet-neu .ap-ai {
  margin-top: 4px;
}
.ap-sheet .ap-tile2 {
  min-height: 84px;
}
.ap-sh-list {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}
.ap-srow {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  text-align: left;
  font: 500 16px/1.25 var(--font);
  cursor: pointer;
}
.ap-srow:last-child {
  border-bottom: 0;
}
.ap-srow:active {
  background: var(--ap-tint);
}
.ap-si {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--ap-tint);
  color: var(--accent);
}
.ap-si svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.9;
}
.ap-sl {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ap-sl b {
  font-weight: 550;
}
.ap-sl small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}
.ap-ctx {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 4px 0 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ap-tint);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 550;
}

/* ---------- Suche (Vollbild, vorhandene globale Suche) ---------- */
.ap-search {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--ap-bottom);
  z-index: 46;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.ap-search-top {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: calc(var(--ap-safe-t) + 10px) 16px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.ap-search-slot {
  flex: 1;
  min-width: 0;
}
.ap-search .gsearch {
  position: static;
  max-width: none;
  width: 100%;
  visibility: visible !important;
}
.ap-search .gsearch input {
  height: 46px;
  font-size: 16px;
  border-radius: 14px;
  padding-right: 12px;
}
.ap-search .gsearch kbd {
  display: none;
}
.ap-search .gs-results {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--ap-safe-t) + 67px);
  bottom: var(--ap-bottom);
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg);
  padding: 6px 8px 24px;
  overflow-y: auto;
  z-index: 1;
}
.ap-search.has-q .gs-results.hidden {
  display: block !important;
}
.ap-search .gs-item {
  padding: 12px 12px;
  min-height: 54px;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 15.5px;
}
.ap-search .gs-sec {
  padding: 16px 12px 6px;
  font-size: 12px;
}
.ap-search-x {
  border: 0;
  background: none;
  color: var(--accent);
  font: 500 16px var(--font);
  min-height: 44px;
  padding: 0 2px;
  cursor: pointer;
}
.ap-search-hint {
  padding: 32px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

/* ---------- Übersicht ---------- */
.ap-start {
  display: flex;
  flex-direction: column;
}
.ap-hello {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 2px 14px;
}
.ap-hello b {
  font-size: 16px;
  font-weight: 600;
}
.ap-hello span {
  color: var(--muted);
  font-size: 13.5px;
}
.ap-act {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}
.ap-act-b {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 12px 10px 11px;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ap-act-b:active {
  transform: scale(0.97);
}
.ap-act-b .ap-ti {
  width: 34px;
  height: 34px;
}
.ap-act-b .ap-tl {
  font-size: 12.5px;
}
.ap-act-b:first-child .ap-ti {
  background: var(--accent);
  color: var(--on-accent);
}
.ap-card-sec {
  margin-top: 22px;
}
.ap-sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 10px;
}
.ap-sec-h h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ap-sec-h a {
  font-size: 14.5px;
  color: var(--accent);
  font-weight: 550;
}
.ap-period {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ap-tint-2);
  color: var(--accent);
  font: 600 13.5px var(--font);
  cursor: pointer;
}
.ap-period svg {
  width: 15px;
  height: 15px;
}
.ap-sec-b {
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}
.ap-sec-b:has(> .ap-kt) {
  background: none;
  box-shadow: none;
  overflow: visible;
}
.ap-skel {
  height: 60px;
  margin: 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--panel-2), var(--line), var(--panel-2));
  background-size: 200% 100%;
  animation: amSk 1.2s infinite linear;
}
@keyframes amSk {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.ap-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  color: var(--muted);
  font-size: 15px;
}
.ap-empty svg {
  width: 22px;
  height: 22px;
  flex: none;
  opacity: 0.75;
}
.ap-list-card {
  display: flex;
  flex-direction: column;
}
.ap-li2 {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 9px 14px;
  color: var(--text);
  text-decoration: none !important;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.ap-li2:last-child {
  border-bottom: 0;
}
.ap-li2:active {
  background: var(--panel-2);
}
.ap-li2 > svg {
  width: 17px;
  height: 17px;
  color: var(--faint);
  flex: none;
}
.ap-l2t {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ap-l2t small {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-li-note {
  padding: 12px 14px 2px;
  color: var(--muted);
  font-size: 13.5px;
}
.ap-ldot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.hint-bad .ap-ldot {
  background: var(--bad);
}
.hint-warn .ap-ldot {
  background: var(--warn);
}
.hint-ok .ap-ldot {
  background: var(--ok);
}
.ap-chk {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--line-2);
  flex: none;
}
.ap-due {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ap-due.now {
  color: var(--warn);
  font-weight: 600;
}
.ap-due.late {
  color: var(--bad);
  font-weight: 600;
}
.ap-time {
  flex: none;
  min-width: 52px;
  padding: 3px 7px;
  border-radius: 8px;
  background: var(--ap-tint);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}
.ap-oi {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--ap-tint);
  color: var(--accent);
}
.ap-oi svg {
  width: 19px;
  height: 19px;
}
.ap-open .ap-n {
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}
.ap-open.bad .ap-n {
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  color: var(--bad);
}
.ap-open.bad .ap-oi {
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
}
.ap-big-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none !important;
  font-size: 15.5px;
}
.ap-big-link > svg {
  width: 17px;
  height: 17px;
  color: var(--faint);
}
.ap-more-link {
  display: block;
  text-align: center;
  padding: 20px 8px 8px;
  color: var(--accent);
  font-size: 14.5px;
}
.ap-kt {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ap-kt.n1 {
  grid-template-columns: minmax(0, 1fr);
}
.ap-kt.n2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ap-kt.n3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ap-kt.n3 .ap-ktile:last-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'l v' 's v';
  align-items: center;
  column-gap: 12px;
  background: var(--ap-tint);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.ap-kt.n3 .ap-ktile:last-child .ap-kl {
  grid-area: l;
}
.ap-kt.n3 .ap-ktile:last-child .ap-ks {
  grid-area: s;
  flex-direction: row;
  gap: 6px;
}
.ap-kt.n3 .ap-ktile:last-child b {
  grid-area: v;
  font-size: 20px;
}
.ap-ktile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 11px 11px 10px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--line);
}
.ap-kl {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
}
.ap-kl svg {
  width: 14px;
  height: 14px;
}
.ap-ktile b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-ktile b.neg {
  color: var(--bad);
}
.ap-ks {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  min-width: 0;
}
.ap-ks small {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-pct {
  font-weight: 700;
  font-size: 12px;
}
.ap-pct.up {
  color: var(--ok);
}
.ap-pct.down {
  color: var(--bad);
}
.ap-kpi-note {
  margin: 8px 4px 0;
  font-size: 11.5px;
  color: var(--faint);
}
.ap-clock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: var(--text);
  text-decoration: none !important;
}
.ap-clock-h {
  font-size: 14px;
  color: var(--muted);
}
.ap-clock.in .ap-clock-h {
  color: var(--ok);
  font-weight: 600;
}
.ap-clock-n {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.ap-clock-n small {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}
.ap-clock-p {
  font-size: 13.5px;
  color: var(--muted);
}
.ap-home-ed {
  display: flex;
  flex-direction: column;
}
.ap-he-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}
.ap-he-row:last-child {
  border-bottom: 0;
}
.ap-he-l {
  flex: 1;
  font-size: 15.5px;
}
.ap-switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex: none;
}
.ap-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.ap-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-2);
  transition: background 0.15s;
}
.ap-switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.ap-switch input:checked + span {
  background: var(--accent);
}
.ap-switch input:checked + span::after {
  transform: translateX(20px);
}

/* ---------- Listen (Kontakte, Angebote, Rechnungen, Projekte, Ausgaben) ---------- */
.appmode .content:has(.ap-listpage) {
  padding-top: 0;
}
.ap-listpage {
  margin: 0 -16px;
}
.ap-find {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 0;
}
.ap-find.open {
  display: flex;
}
.ap-find > span {
  display: none;
}
.ap-find input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border-radius: 12px;
  background: var(--panel);
}
.ap-find-x {
  border: 0;
  background: none;
  color: var(--accent);
  font: 500 16px var(--font);
  min-height: 44px;
  cursor: pointer;
}
.ap-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 16px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: calc(var(--ap-safe-t) + var(--ap-head-h));
  z-index: 5;
}
.ap-chips::-webkit-scrollbar {
  display: none;
}
.ap-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: 550 14px var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.ap-chip span {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ap-chip.on {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.ap-chip.on span {
  color: color-mix(in srgb, var(--bg) 70%, transparent);
}
.ap-rows {
  margin: 2px 16px 0;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}
.ap-li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none !important;
  position: relative;
}
.ap-li + .ap-li::before {
  content: '';
  position: absolute;
  left: 62px;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--line);
}
.ap-li:active {
  background: var(--panel-2);
}
.ap-av {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
}
.ap-sdot {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
}
.ap-sdot::after {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--faint) 18%, transparent);
}
.t-ok.ap-sdot::after {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent);
}
.t-warn.ap-sdot::after {
  background: var(--warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 18%, transparent);
}
.t-bad.ap-sdot::after {
  background: var(--bad);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 18%, transparent);
}
.t-info.ap-sdot::after,
.t-accent.ap-sdot::after {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.ap-av.t-info {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.ap-av.t-ok {
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
}
.ap-av.t-warn {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}
.ap-li-l {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ap-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-meta i {
  font-style: normal;
  margin: 0 5px;
  color: var(--faint);
}
.ap-st {
  font-weight: 600;
  color: var(--muted);
}
.ap-st.t-ok {
  color: var(--ok);
}
.ap-st.t-warn {
  color: var(--warn);
}
.ap-st.t-bad {
  color: var(--bad);
}
.ap-st.t-info,
.ap-st.t-accent {
  color: var(--accent);
}
.ap-li-r {
  flex: none;
  max-width: 42%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}
.ap-li-r b {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ap-li-r small {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ap-load-more {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px;
  min-height: 46px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel);
  color: var(--accent);
  font: 500 15px var(--font);
  cursor: pointer;
}
.ap-listpage .ap-empty {
  background: var(--panel);
}
.ap-listpage .ap-skel {
  height: 48px;
}

/* ---------- Scannen ---------- */
.ap-scan-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ap-scan-btns .btn {
  justify-content: center;
}
.ap-pages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.ap-page {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.ap-page-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

/* Einstellungen: App-Ansicht ein/aus */
#amSet .chk {
  display: flex;
  gap: 8px;
}

/* Willkommens-Karte der geführten Touren: über der unteren Leiste, nicht über Menü/Sheets */
.appmode .tour-welcome {
  bottom: var(--ap-bottom);
  z-index: 42;
  padding-bottom: 10px;
  box-shadow: 0 -12px 30px -16px rgba(8, 18, 40, 0.45);
}
body.ap-menu-open .tour-welcome,
body.ap-search-open .tour-welcome,
body:has(.ap-sheet-bg) .tour-welcome {
  display: none;
}
body.ap-menu-open .update-bar,
body.ap-search-open .update-bar,
body:has(.ap-sheet-bg) .update-bar {
  display: none !important;
}
.ap-dock .btn {
  min-width: 0;
  white-space: normal;
  line-height: 1.15;
  text-align: center;
  padding: 6px 12px;
}
.ap-dock .btn.primary {
  flex-grow: 1.6;
}
