.app-shell {
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  background-color: var(--surface-page);
  color: var(--text-primary);
}

.app-shell__sidebar {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  width: var(--sidebar-width);
  border-right: 1px solid var(--border-subtle);
  background-color: var(--surface-neutral);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  transition: width var(--duration-normal) var(--ease-out);
  display: none;
}
.app-shell--sidebar-collapsed .app-shell__sidebar {
  width: var(--sidebar-collapsed);
}

.app-shell__workspace {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  background-color: var(--surface-page);
}

.app-shell__topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  flex-shrink: 0;
  margin: 0;
  height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  padding-top: calc(var(--space-2) + env(safe-area-inset-top, 0px));
  padding-bottom: var(--space-2);
  background-color: var(--surface-page-translucent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: height var(--duration-normal) var(--ease-out);
}
.app-shell[data-topbar="shrink"].is-collapsed .app-shell__topbar {
  height: calc(var(--topbar-height-collapsed) + env(safe-area-inset-top, 0px));
}

.app-shell__content {
  flex: 1 0 auto;
  min-width: 0;
}

.app-shell__tabbar {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  flex-shrink: 0;
  margin: 0;
  height: calc(var(--participation-footer-height) + env(safe-area-inset-bottom, 0px));
  padding-top: 0;
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  background-color: var(--surface-page-translucent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  transition: height var(--duration-normal) var(--ease-out);
}
.app-shell[data-tabbar="shrink"].is-collapsed .app-shell__tabbar {
  height: calc(48px + env(safe-area-inset-bottom, 0px));
}
/* Zones layout (Participation footer-nav and similar button rows): restore
   the top padding so button-shaped content has visual breathing room above
   it as it scales with scroll-shrink. Default tabs layout keeps padding-top
   at 0 so the active-tab indicator hugs the top edge of the chrome. */
.app-shell[data-tabbar-layout="zones"] .app-shell__tabbar {
  padding-top: var(--space-2);
}

.app-shell__tabbar-content {
  display: flex;
  align-items: stretch;
  height: 100%;
  width: 100%;
  max-width: var(--tabbar-content-max-width, none);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.app-shell__tabbar-content > * {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-shell[data-tabbar-layout="zones"] .app-shell__tabbar-content > *:first-child {
  flex: 0 0 auto;
  justify-content: flex-start;
}
.app-shell[data-tabbar-layout="zones"] .app-shell__tabbar-content > *:nth-child(2) {
  flex: 1;
}
.app-shell[data-tabbar-layout="zones"] .app-shell__tabbar-content > *:last-child {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.app-shell__menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  margin: 0;
  padding: 0;
  border: none;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  background-color: var(--surface-page);
  color: var(--text-primary);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.app-shell__menu::backdrop { background-color: transparent; }

.app-shell__sidebar:empty,
.app-shell__topbar:empty,
.app-shell__tabbar:empty { display: none; }

.app-shell__menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--topbar-height) - var(--space-2) * 2);
  width: calc(var(--topbar-height) - var(--space-2) * 2);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: height var(--duration-normal) var(--ease-out),
              width var(--duration-normal) var(--ease-out);
}
.app-shell.is-collapsed .app-shell__menu-button {
  height: calc(var(--topbar-height-collapsed) - var(--space-2) * 2);
  width: calc(var(--topbar-height-collapsed) - var(--space-2) * 2);
}
.app-shell__menu-button .material-symbols-rounded {
  font-size: 22px;
  transition: font-size var(--duration-normal) var(--ease-out);
}
.app-shell.is-collapsed .app-shell__menu-button .material-symbols-rounded {
  font-size: 16px;
}
@media (min-width: 1024px) {
  .app-shell__menu-button { display: none; }
  .app-shell__menu[open] { display: none; }
  .app-shell__sidebar { display: flex; flex-direction: column; }
}

@media (min-width: 768px) {
  .app-shell__tabbar { display: none; }
}
