/* App-Shell: App-Bar oben, Navigation unten (mobil) bzw. Seitenleiste (ab 900px), Hauptbereich. */
.skip-link {
  position: absolute; left: var(--space-2); top: -100px; z-index: 100;
  padding: var(--space-3) var(--space-4); background: var(--color-primary); color: var(--color-on-primary);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-2); }

.app-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-3);
  min-height: calc(var(--appbar-height) + var(--safe-top));
  padding: var(--safe-top) calc(var(--space-4) + var(--safe-right)) 0 calc(var(--space-4) + var(--safe-left));
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.app-bar-title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-weight: 700; font-size: 1.05rem; color: var(--color-text); text-decoration: none; }
.app-bar-title span:not(.status-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-bar-meta { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }

.status-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--color-status-unknown); box-shadow: 0 0 0 3px rgb(255 255 255 / 8%); }
.status-dot-online { background: var(--color-status-online); }
.status-dot-offline { background: var(--color-status-offline); }

.app-main { padding: var(--space-4) calc(var(--space-4) + var(--safe-right)) calc(var(--bottomnav-height) + var(--safe-bottom) + var(--space-5)) calc(var(--space-4) + var(--safe-left)); }
.app-content { max-width: 960px; margin: 0 auto; }

/* Untere Navigationsleiste */
.main-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.nav-list { display: flex; list-style: none; margin: 0; padding: 0; }
.nav-list > li { flex: 1 1 0; min-width: 0; margin: 0; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: var(--bottomnav-height); padding: var(--space-1);
  font: inherit; font-size: 0.75rem; font-weight: 600; color: var(--color-muted);
  text-decoration: none; background: none; border: 0; border-radius: 0; cursor: pointer;
}
.nav-item svg { width: 24px; height: 24px; fill: none; stroke: currentcolor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item[aria-current="page"] { color: var(--color-link); box-shadow: inset 0 3px 0 var(--color-link); }
.nav-item:hover { color: var(--color-text); }

/* "Mehr": mobil ein Sheet über der Leiste, am Desktop Teil der Seitenleiste */
.more-menu {
  display: none;
  position: absolute; left: 0; right: 0; bottom: 100%;
  padding: var(--space-3) calc(var(--space-4) + var(--safe-right)) var(--space-3) calc(var(--space-4) + var(--safe-left));
  background: var(--color-surface-2); border-top: 1px solid var(--color-border);
  box-shadow: 0 -8px 24px rgb(0 0 0 / 35%);
}
.more-menu.is-open { display: block; }
.more-menu ul { list-style: none; margin: 0; padding: 0; }
.more-menu a.more-link {
  display: flex; align-items: center; min-height: var(--touch-target); padding: 0 var(--space-2);
  color: var(--color-text); text-decoration: none; border-radius: var(--radius-sm);
}
.more-menu a.more-link[aria-current="page"] { color: var(--color-link); font-weight: 700; }
.more-menu form { margin: var(--space-2) 0 0; }
.more-menu .user-line { color: var(--color-muted); font-size: 0.85rem; margin: 0 0 var(--space-2) var(--space-2); }

/* Schlankes Layout für Login/2FA */
.auth-shell { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: var(--space-4) calc(var(--space-4) + var(--safe-right)) calc(var(--space-4) + var(--safe-bottom)) calc(var(--space-4) + var(--safe-left)); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-bottom: var(--space-5); font-size: 1.4rem; font-weight: 800; }
.auth-brand img { width: 40px; height: 40px; border-radius: 10px; }
.auth-main { width: 100%; max-width: 480px; margin: 0 auto; }

@media (min-width: 900px) {
  body.app-shell {
    display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: auto 1fr; grid-template-areas: "bar bar" "nav main";
  }
  .app-bar { grid-area: bar; }
  .app-main { grid-area: main; padding: var(--space-5) var(--space-6); }

  .main-nav {
    grid-area: nav; position: sticky; top: calc(var(--appbar-height) + var(--safe-top));
    align-self: start; height: calc(100dvh - var(--appbar-height) - var(--safe-top));
    overflow-y: auto; padding: var(--space-3);
    border-top: 0; border-right: 1px solid var(--color-border);
  }
  .nav-list { flex-direction: column; gap: var(--space-1); }
  .nav-item {
    flex-direction: row; justify-content: flex-start; gap: var(--space-3);
    min-height: var(--touch-target); padding: 0 var(--space-3); font-size: 1rem; border-radius: var(--radius-sm);
  }
  .nav-item[aria-current="page"] { background: var(--color-surface-2); box-shadow: inset 3px 0 0 var(--color-link); }
  .nav-item:hover { background: var(--color-surface-2); }
  .nav-more-toggle { display: none; }
  .more-menu, .more-menu.is-open {
    display: block; position: static; margin-top: var(--space-4); padding: var(--space-3) 0 0;
    background: none; border-top: 1px solid var(--color-border); box-shadow: none;
  }
  .more-menu a.more-link { padding: 0 var(--space-3); }
  .more-menu a.more-link:hover { background: var(--color-surface-2); }
}
