/* ========================================================================== */
/* ARKYN HOTFIX 2026-10-07 — MOBILE APP SHELL BOUNDARY                        */
/* BottomBar is a structural viewport boundary, symmetric to desktop LeftBar.  */
/* Application surfaces live only between the fixed HighBar and BottomBar.      */
/* ========================================================================== */

@media (max-width:767px){
  :root{
    --arkyn-mobile-topbar-content:56px;
    --arkyn-mobile-topbar-height:calc(var(--arkyn-mobile-topbar-content) + env(safe-area-inset-top,0px));
    --arkyn-mobile-bottom-content:64px;
    --arkyn-mobile-bottom-height:calc(var(--arkyn-mobile-bottom-content) + env(safe-area-inset-bottom,0px));
    --arkyn-mobile-app-height:calc(100dvh - var(--arkyn-mobile-topbar-height) - var(--arkyn-mobile-bottom-height));
    --swat-workspace-top:var(--arkyn-mobile-topbar-height);
    --swat-mobile-nav-height:var(--arkyn-mobile-bottom-content);
    --swat-mobile-nav-gap:0px;
  }

  html.swat-mobile,
  body.arkyn-mobile-shell{
    width:100%!important;
    height:100dvh!important;
    min-height:100dvh!important;
    max-width:100%!important;
    margin:0!important;
    overflow:hidden!important;
    overscroll-behavior:none!important;
  }

  body.arkyn-mobile-shell #root{
    width:100%!important;
    height:100dvh!important;
    min-height:0!important;
    max-height:100dvh!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }

  /* Fixed application chrome. The BottomBar is never a floating card. */
  body.arkyn-mobile-shell .swat-workspace-topbar{
    position:fixed!important;
    z-index:2147482450!important;
    top:0!important;right:0!important;left:0!important;
    width:100%!important;
    height:var(--arkyn-mobile-topbar-height)!important;
    min-height:var(--arkyn-mobile-topbar-height)!important;
    padding-top:env(safe-area-inset-top,0px)!important;
    box-sizing:border-box!important;
  }
  body.arkyn-mobile-shell .swat-navigation-rail{display:none!important}
  body.arkyn-mobile-shell .swat-bottom-navigation{
    display:grid!important;
    position:fixed!important;
    z-index:2147482500!important;
    left:0!important;right:0!important;bottom:0!important;
    width:100%!important;
    height:var(--arkyn-mobile-bottom-height)!important;
    min-height:var(--arkyn-mobile-bottom-height)!important;
    margin:0!important;
    padding:4px 6px env(safe-area-inset-bottom,0px)!important;
    box-sizing:border-box!important;
    border-radius:0!important;
    transform:none!important;
  }

  /* Canonical application viewport: nothing owned by a module may cross it. */
  body.arkyn-mobile-shell .swat-sdk-workspace,
  body.arkyn-mobile-shell.swat-scanner-open .swat-scanner-module,
  body.arkyn-mobile-shell .swat-scanner-module:not([hidden]){
    position:fixed!important;
    z-index:1380!important;
    inset:var(--arkyn-mobile-topbar-height) 0 var(--arkyn-mobile-bottom-height) 0!important;
    top:var(--arkyn-mobile-topbar-height)!important;
    right:0!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;
    left:0!important;
    width:auto!important;
    height:auto!important;
    min-width:0!important;
    min-height:0!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  body.arkyn-mobile-shell .swat-sdk-layout{
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-height:100%!important;
    overflow:hidden!important;
  }
  body.arkyn-mobile-shell .swat-sdk-main{
    min-width:0!important;
    min-height:0!important;
    max-height:100%!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    padding-bottom:12px!important;
    scroll-padding-bottom:16px!important;
    overscroll-behavior-y:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }
  body.arkyn-mobile-shell .swat-sdk-main :is([data-module-root],.moduleSurface,.swat-module-surface,.swat-dashboard-v33,.swat-dashboard-canvas){
    min-height:0!important;
    max-block-size:100%!important;
    box-sizing:border-box!important;
  }

  /* Hub and app-owned full surfaces use the exact same bounded viewport. */
  body.arkyn-mobile-shell .swat-global-hub-backdrop,
  body.arkyn-mobile-shell .swat-mobile-filter-sheet,
  body.arkyn-mobile-shell .swat-mobile-filter-backdrop:has(+.swat-mobile-filter-sheet.swat-mobile-filter-open),
  body.arkyn-mobile-shell .ja-inspector-portal,
  body.arkyn-mobile-shell .ja-inspector-portal.is-wide,
  body.arkyn-mobile-shell .swat-quick-view-back,
  body.arkyn-mobile-shell .ja-command-backdrop,
  body.arkyn-mobile-shell .ja-design-lab-backdrop,
  body.arkyn-mobile-shell .ja-modal-backdrop{
    position:fixed!important;
    top:var(--arkyn-mobile-topbar-height)!important;
    right:0!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;
    left:0!important;
    width:auto!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    box-sizing:border-box!important;
  }
  body.arkyn-mobile-shell .swat-global-hub,
  body.arkyn-mobile-shell .swat-quick-view,
  body.arkyn-mobile-shell .ja-inspector-drawer{
    min-height:0!important;
    max-height:100%!important;
  }
  body.arkyn-mobile-shell .swat-global-hub main,
  body.arkyn-mobile-shell .swat-quick-view,
  body.arkyn-mobile-shell .ja-inspector-drawer>main{
    min-height:0!important;
    overflow-y:auto!important;
    overscroll-behavior-y:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }

  /* ContextLeft/Right drawers are application surfaces, never screen overlays. */
  body.arkyn-mobile-shell .ja-context-panel{
    position:fixed!important;
    top:var(--arkyn-mobile-topbar-height)!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;
    left:0!important;
    height:auto!important;
    max-height:none!important;
    min-height:0!important;
  }
  body.arkyn-mobile-shell .ja-drawer{
    max-height:var(--arkyn-mobile-app-height)!important;
  }

  /* Floating application utilities stay inside the application area. */
  body.arkyn-mobile-shell .swat-settings-menu{
    top:calc(var(--arkyn-mobile-topbar-height) + 6px)!important;
    max-height:calc(var(--arkyn-mobile-app-height) - 12px)!important;
    overflow:auto!important;
  }
  body.arkyn-mobile-shell .swat-ux-notice-panel{
    top:calc(var(--arkyn-mobile-topbar-height) + 8px)!important;
    max-height:calc(var(--arkyn-mobile-app-height) - 16px)!important;
  }
  body.arkyn-mobile-shell .swat-ux-core-toast{
    bottom:calc(var(--arkyn-mobile-bottom-height) + 12px)!important;
  }
  body.arkyn-mobile-shell .swat-page-hub-return,
  body.arkyn-mobile-shell .swat-nav-toast{
    bottom:calc(var(--arkyn-mobile-bottom-height) + 10px)!important;
  }

  /* Widget SDK contract: the provider may request a larger mobile surface. */
  body.arkyn-mobile-shell .swat-sdk-widget[data-mobile-layout="chart"]{
    min-height:var(--swat-widget-mobile-min-height,340px)!important;
  }
  body.arkyn-mobile-shell .swat-sdk-widget[data-mobile-layout="large"]{
    min-height:var(--swat-widget-mobile-min-height,220px)!important;
  }
}

@media (max-width:767px){
  body.arkyn-mobile-shell .ja-command-backdrop .ja-command-palette,
  body.arkyn-mobile-shell .ja-design-lab-backdrop .ja-design-lab{
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
  }
  body.arkyn-mobile-shell .ja-modal-backdrop .ja-modal{
    min-height:0!important;
    max-height:calc(100% - 28px)!important;
  }
}


/* ========================================================================== */
/* ARKYN CORE HOTFIX 2026-10-07 RC8 — DASHBOARD-SAFE MOBILE BOUNDARY          */
/* Workspace remains physically bounded by HighBar/BottomBar.                  */
/* Dashboard root geometry is owned by Dashboard, never absolutely positioned  */
/* by the Core.                                                                 */
/* ========================================================================== */
@media (max-width:767px){
  body.arkyn-mobile-shell .swat-sdk-workspace,
  body.arkyn-mobile-shell.swat-scanner-open .swat-scanner-module,
  body.arkyn-mobile-shell .swat-scanner-module:not([hidden]){
    top:var(--arkyn-mobile-topbar-height)!important;
    right:0!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;
    left:0!important;
    inset:var(--arkyn-mobile-topbar-height) 0 var(--arkyn-mobile-bottom-height) 0!important;
    width:auto!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:hidden!important;
  }

  body.arkyn-mobile-shell .swat-sdk-workspace[data-module="dashboard"] .swat-sdk-layout{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-height:100%!important;
    overflow:hidden!important;
  }

  body.arkyn-mobile-shell .swat-sdk-workspace[data-module="dashboard"] .swat-sdk-main{
    position:relative!important;
    display:block!important;
    flex:1 1 auto!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-height:100%!important;
    padding:0!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
}
