.app-boot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.app-boot[hidden] {
  display: none;
}

.app-boot.is-fading {
  opacity: 0;
  pointer-events: none;
}

.app-boot-shell {
  width: min(360px, calc(100% - 28px));
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-boot-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  animation: loader-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.app-boot-text {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.app[hidden] {
  display: none !important;
}

.app {
  position: relative;
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-app);
}

.app::before {
  content: none;
}

.app::after {
  content: none;
}

.content-area {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: var(--bg-app);
}

.content-loader {
  position: absolute;
  inset: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  z-index: 50;
  opacity: 1;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.content-loader.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.content-loader-shell {
  width: min(360px, calc(100% - 28px));
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.content-loader-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  animation: loader-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.content-loader-text {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.module-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  position: relative;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  border: 0;
  background: var(--bg-app);
  box-shadow: none;
  animation: panel-fade-in 0.24s ease;
}

.module-panel.active {
  display: flex;
}

.module-panel-lazy {
  background: var(--bg-app);
}

.module {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.module-panel-loading,
.module-panel-error {
  margin: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: min(540px, calc(100% - 32px));
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
}

.module-panel-loading {
  color: var(--text-secondary);
}

.module-panel-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  animation: loader-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.module-panel-error {
  color: var(--signal-red-deep);
  border-color: var(--signal-red-border);
  background: var(--signal-red-light);
}

.module-panel-error::before {
  content: none;
}

@keyframes panel-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── Mobile-Top-Header mit Hamburger ──────────────────────── */
.app-mobile-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  position: relative;
  z-index: 30;
}

.app-mobile-bar-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.app-mobile-bar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}

.app-mobile-bar-toggle .material-icons {
  font-size: 22px;
}

.app-mobile-bar-title {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Mobile (<860px): Sidebar wird Off-Canvas-Drawer ──────── */
@media (max-width: 860px) {
  .app {
    flex-direction: column;
  }

  .app-mobile-bar {
    display: flex;
  }

  .content-area {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-boot-shell {
    width: calc(100% - 24px);
    padding: 12px 14px;
  }

  .content-loader-shell {
    width: calc(100% - 24px);
    padding: 12px 14px;
  }

  .app {
    height: 100dvh;
    min-height: 100dvh;
  }
}

@media (max-width: 480px) {
  .module-panel-loading,
  .module-panel-error {
    max-width: calc(100% - 24px);
    font-size: 13px;
    padding: 10px 12px;
  }
}
