/* KI-cloud SaaS app shell — sidebar + main content */

.hidden {
  display: none !important;
}

.app-shell-layout {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-sidebar-brand {
  padding: 0 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.app-sidebar-brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.app-sidebar-brand span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.app-nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.app-nav a.is-active {
  background: var(--accent-muted);
  color: var(--accent);
}

.app-nav a.hidden {
  display: none;
}

.app-nav-icon {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
  font-size: 0.85rem;
}

.app-nav-badge {
  margin-left: auto;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

.app-nav-badge.hidden {
  display: none;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-page-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.shell-main {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  overflow-x: auto;
}

.shell-main .wrap {
  max-width: 1400px;
}

.shell-placeholder {
  max-width: 720px;
}

.shell-placeholder .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.shell-placeholder h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.shell-placeholder p {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
}

.shell-placeholder p:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .app-sidebar {
    flex: none;
    width: 100%;
    height: auto;
    position: relative;
    padding: 0.75rem;
  }

  .app-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .app-page-header,
  .shell-main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.cloud-login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(4, 8, 12, 0.82);
  align-items: center;
  justify-content: center;
}

.cloud-login-overlay.visible { display: flex; }

.cloud-login-card {
  background: #1a2330;
  padding: 2rem;
  border-radius: 12px;
  width: min(360px, 92vw);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  font-family: system-ui, sans-serif;
  color: #e8eef5;
}

.cloud-login-card h1 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.cloud-login-card label {
  display: block;
  margin-bottom: .35rem;
  font-size: .85rem;
  opacity: .85;
}

.cloud-login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .7rem;
  margin-bottom: .9rem;
  border-radius: 6px;
  border: 1px solid #3a4a5c;
  background: #0d1218;
  color: inherit;
}

.cloud-login-card button {
  width: 100%;
  padding: .65rem;
  border: none;
  border-radius: 6px;
  background: #2d8a5e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.cloud-login-error { color: #ff8a80; min-height: 1.2rem; font-size: .85rem; }

/* Verhindert das Aufblitzen echter Inhalte vor der Auth-Entscheidung
   (ensureAuth()/login() in auth.js entfernen diese Klasse). */
.auth-content-gate {
  visibility: hidden;
}
