/* Zuhause – Grundlayout: App-Bar oben, Inhalt, Tab-Bar unten, Safe-Areas */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body {
  font: var(--fs-body)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--acc); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--acc); color: var(--acc-txt); padding: 8px 12px; border-radius: var(--r-btn);
}
.skip:focus { left: 8px; top: calc(8px + var(--safe-top)); }

/* App-Bar */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(var(--sp-4) + var(--safe-right)) 0 calc(var(--sp-4) + var(--safe-left));
  background: rgba(15, 23, 42, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid #33415566;
}
.appbar h1 { font-size: var(--fs-h1); font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; gap: var(--sp-1); align-items: center; }
.appbar-clock { color: var(--mut); font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 4px; }

/* Inhalt */
.view {
  max-width: 760px; margin: 0 auto;
  padding: var(--sp-4) calc(var(--sp-4) + var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-5)) calc(var(--sp-4) + var(--safe-left));
  outline: none;
}
.view.no-tabs { padding-bottom: calc(var(--sp-5) + var(--safe-bottom)); }
.view.enter { animation: view-in .22s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Leiste (Zuhause 2.0, P25): Handy unten Start · Suche · ＋ · Bereiche · Ich – ab 900 px links als Seitenleiste */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: rgba(15, 23, 42, .96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid #33415588;
}
.tb-main { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; height: var(--tabbar-h); }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--touch);
  color: var(--mut); text-decoration: none; font-size: .7rem; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabbar a.active { color: var(--acc); }
.tabbar a:active { opacity: .7; }
.tb-plus {
  justify-self: center; width: 54px; height: 54px; margin-top: -18px; border: 0; border-radius: 18px; cursor: pointer;
  display: grid; place-items: center; background: var(--acc); color: var(--acc-txt);
  box-shadow: 0 8px 20px rgba(56, 189, 248, .35);
}
.tb-plus svg { width: 28px; height: 28px; stroke-width: 2.4; }
.tb-plus:active { transform: scale(.95); }
.tb-plus-txt { display: none; }
.tb-favs { display: none; }

/* Schnell hinzufügen */
.qa-inline { display: block; margin-bottom: var(--sp-3); }
.qa-inline > span { display: block; font-size: var(--fs-note); color: var(--mut); font-weight: 600; margin-bottom: 6px; }
.qa-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: var(--sp-2); }
.qa-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; color: var(--txt); text-decoration: none; font-size: .78rem; font-weight: 500; text-align: center; }
.qa-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--bg); }
.qa-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Tablet & PC: Seitenleiste links */
@media (min-width: 900px) {
  :root { --side-w: 236px; }
  .tabbar {
    top: 0; right: auto; width: var(--side-w); height: auto;
    padding: calc(var(--sp-4) + var(--safe-top)) 12px var(--sp-4) calc(12px + var(--safe-left));
    border-top: 0; border-right: 1px solid #33415588; overflow-y: auto;
    display: flex; flex-direction: column; gap: var(--sp-4);
  }
  .tb-main { display: flex; flex-direction: column; align-items: stretch; gap: 2px; height: auto; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; font-size: .95rem; font-weight: 600; }
  .tabbar a.active { background: #1e293b; }
  .tabbar svg { width: 20px; height: 20px; }
  .tb-plus { order: -1; width: 100%; height: 44px; margin: 0 0 var(--sp-2); border-radius: 12px; display: flex; gap: 8px; justify-content: center; font-weight: 700; box-shadow: none; }
  .tb-plus svg { width: 20px; height: 20px; }
  .tb-plus-txt { display: inline; }
  .tb-favs { display: flex; flex-direction: column; gap: 2px; }
  .tb-favs-title { padding: 0 12px 4px; color: var(--mut); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
  .tabbar a.tb-fav { font-weight: 500; color: #cbd5e1; }
  .tabbar a.tb-fav.active { color: var(--txt); }
  body.with-tabs { padding-left: var(--side-w); }          /* Inhalt + Kopfzeile rücken neben die Seitenleiste */
  body.with-tabs .view { padding-bottom: calc(var(--sp-5) + var(--safe-bottom)); }
  body.with-tabs .fab { right: max(16px, calc((100vw - var(--side-w)) / 2 - 380px + 16px)) !important; bottom: calc(var(--safe-bottom) + 24px) !important; }
}

/* Offline */
.offline-banner {
  position: sticky; top: 0; z-index: 25;
  padding: calc(6px + var(--safe-top)) var(--sp-4) 6px;
  background: var(--warn); color: #1c1917; font-size: var(--fs-note); font-weight: 650; text-align: center;
}
.offline-banner + .appbar { top: 0; }

.noscript { padding: var(--sp-5); text-align: center; color: var(--mut); }

@media (min-width: 900px) {
  .view { padding-top: var(--sp-5); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* P38: Versionsnummer im Header */
.appbar-version { color: var(--mut); font-size: .72rem; font-weight: 700; text-decoration: none; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.appbar-version:hover { color: var(--txt); }
@media (max-width: 360px) { .appbar-version { display: none; } }

/* P69: Chat-Knopf (unten rechts) und ＋ nicht übereinander – ＋ rutscht nach oben, wenn der Chat da ist */
body.has-dock .fab { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); }
@media (min-width: 900px) { body.with-tabs.has-dock .fab { bottom: calc(var(--safe-bottom) + 76px) !important; } }

/* P92: in der iPhone-/Android-App (native Hülle) */
body.in-app { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body.native-tabs .tabbar { display: none !important; }

/* P118: Admin-/Mod-Bereiche kennzeichnen */
.role-tag { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; white-space: nowrap; vertical-align: middle; margin-left: 6px; letter-spacing: .02em; }
.role-tag.admin { background: rgba(220, 60, 60, .14); color: #ff8a80; border: 1px solid rgba(220, 60, 60, .35); }
.role-tag.mod { background: rgba(230, 160, 20, .16); color: #ffc861; border: 1px solid rgba(230, 160, 20, .4); }
.role-banner { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--sp-3, 12px); padding: 8px 12px; border-radius: 12px; font-size: 13px; color: var(--mut); }
.role-banner .role-tag { margin-left: 0; }
.role-banner.admin { background: rgba(220, 60, 60, .07); border: 1px dashed rgba(220, 60, 60, .35); }
.role-banner.mod { background: rgba(230, 160, 20, .08); border: 1px dashed rgba(230, 160, 20, .4); }
.role-tag.head { background: rgba(16, 185, 129, .14); color: #5eead4; border: 1px solid rgba(16, 185, 129, .4); }
.role-banner.head { background: rgba(16, 185, 129, .07); border: 1px dashed rgba(16, 185, 129, .4); }
