/* GuildMesh mobile shell stabilisation, 15 August 2026.
   Loaded last so mobile layout rules cannot be undone by older theme overrides. */
.mobile-search-trigger {
  display: none;
}

@media (max-width: 680px) {
  :root {
    --gm-topbar-height: 64px;
  }

  body.signed-in {
    padding-top: var(--gm-topbar-height) !important;
    overflow-x: hidden;
  }

  body.signed-in > .page-shell {
    padding-top: 0 !important;
    min-width: 0;
  }

  body.signed-in .app-topbar {
    height: var(--gm-topbar-height) !important;
    min-height: var(--gm-topbar-height);
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr;
    grid-template-areas: "left actions";
    align-content: center;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    box-sizing: border-box;
  }

  body.signed-in .app-topbar-left {
    grid-area: left;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  body.signed-in .app-topbar-actions {
    grid-area: actions;
    min-width: max-content;
    gap: 5px;
  }

  body.signed-in .mobile-search-trigger {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  body.signed-in .global-search {
    display: none;
  }

  body.signed-in.mobile-search-open .global-search {
    display: block;
    position: fixed;
    z-index: 1260;
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
  }

  body.signed-in.mobile-search-open .global-search > input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding-right: 44px;
    font-size: 16px;
  }

  body.signed-in.mobile-search-open .global-search > input::placeholder {
    color: #7184a1;
  }

  body.signed-in .global-search-results {
    position: fixed;
    z-index: 1261;
    left: 10px;
    right: 10px;
    top: 64px !important;
    max-height: calc(100dvh - 74px);
  }

  body.signed-in .app-topbar::after {
    bottom: 0;
  }

  body.signed-in .portal-app-shell {
    min-width: 0;
    min-height: calc(100dvh - var(--gm-topbar-height)) !important;
  }

  body.signed-in .portal-workspace {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 18px 12px 34px !important;
  }

  body.signed-in .app-sidebar-backdrop,
  body.signed-in.community-context .unified-sidebar,
  body.signed-in.global-context .global-drawer-sidebar,
  body.signed-in .message-drawer,
  body.signed-in .notification-drawer,
  body.signed-in .account-drawer {
    top: var(--gm-topbar-height) !important;
  }

  body.signed-in .topbar-community-menu {
    top: calc(var(--gm-topbar-height) + 6px) !important;
  }

  body.signed-in img,
  body.signed-in video,
  body.signed-in canvas {
    max-width: 100%;
  }

  body.signed-in .panel-heading,
  body.signed-in .split-heading,
  body.signed-in .premium-section-heading {
    min-width: 0;
  }

  body.signed-in input,
  body.signed-in select,
  body.signed-in textarea,
  body.signed-in button {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  body.signed-in .global-context .topbar-community-switcher > summary,
  body.signed-in.community-context .topbar-community-switcher > summary {
    width: 138px;
    min-width: 138px;
  }
}
