/* ============================================================
   App Shell Layout — Topbar, Bottom Nav, Content Container
   ============================================================ */
#app{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar{
  background: var(--cream);
  padding: calc(var(--safe-top) + 14px) var(--space-5) 10px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar.is-scrolled{
  background: rgba(248,243,234,0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--border);
}
.topbar-inner{
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  transition: max-width 0.15s ease;
}
.topbar-back{
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.topbar-title{
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--petrol-deep);
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-spacer{ width: 40px; flex-shrink: 0; }
.topbar-action{
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); color: var(--petrol); flex-shrink: 0;
}
.topbar-action.is-active{ color: var(--coral); }
.topbar-action svg{ --icon-size: var(--icon-sm); }

.view-root{
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 4px var(--space-5) calc(var(--bottom-nav-height) + var(--safe-bottom) + 32px);
  outline: none;
  transition: max-width 0.15s ease;
}

/* Mobile-first App: Auf jedem Viewport bleibt EIN zentrierter
   Handy-Viewport (--max-width) sichtbar — kein Editorial-Website-Layout,
   keine Mehrspalten-Ausdehnung auf Desktop. Der Desktop-Browser dient
   nur als Vorschau-Rahmen für die mobile Anwendung. */
@media (min-width: 640px){
  body{
    background: var(--cream-deep);
  }
  #app{
    max-width: var(--max-width);
    margin: 0 auto;
    background: var(--cream);
    min-height: 100vh;
    box-shadow: 0 0 60px rgba(11,36,42,0.12);
  }
}

.bottom-nav{
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  display: flex;
}
.bottom-nav-inner{
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
}
.nav-item{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 4px 8px;
  min-height: 60px;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.nav-icon-wrap{
  display: flex; align-items: center; justify-content: center;
}
.nav-icon-wrap svg{ --icon-size: var(--icon-md); color: var(--ink-faint); }
.nav-item.active .nav-icon-wrap svg{ color: var(--coral); }
.nav-item.active .nav-label{ color: var(--coral); }

.toast-root{
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px);
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
  padding: 0 var(--space-5);
}
.toast{
  background: var(--petrol-deep);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
  max-width: 100%;
}
@keyframes toast-in{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}
@media (min-width: 640px){
  .bottom-nav{
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
  }
  .toast-root{
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
  }
}

.update-bar{
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  z-index: 60;
  background: var(--petrol-deep);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}
.update-bar-btn{
  background: var(--coral);
  color: var(--white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.update-bar-btn:active{ transform: scale(0.97); }
@media (min-width: 640px){
  .update-bar{
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
  }
}

.sheet-backdrop{
  position: fixed; inset: 0;
  background: rgba(18,51,59,0.4);
  z-index: 90;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in{ from{opacity:0;} to{opacity:1;} }
.sheet{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 91;
  background: var(--paper);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-5) calc(var(--safe-bottom) + var(--space-6));
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.25s cubic-bezier(.2,.9,.3,1);
}
@keyframes sheet-up{
  from{ transform: translateY(100%); }
  to{ transform: translateY(0); }
}
.sheet-handle{
  width: 40px; height: 4px; border-radius: var(--radius-pill);
  background: var(--border-strong);
  margin: 0 auto var(--space-4);
}

@media (min-width: 640px){
  .view-root{ padding-left: var(--space-6); padding-right: var(--space-6); }
  .sheet{
    left: 50%; right: auto; transform: translateX(-50%);
    width: 100%; max-width: 560px;
    border-radius: var(--radius-lg);
    bottom: var(--space-6);
  }
  @keyframes sheet-up{
    from{ transform: translate(-50%, 40px); opacity: 0; }
    to{ transform: translate(-50%, 0); opacity: 1; }
  }
}
