/* 2026-09-29 — stable mobile/tablet shell + integrated dashboard trigger v182 */
@media(max-width:860px){
  html:has(body.shell-app),
  body.shell-app{
    height:100%!important;
    min-height:100%!important;
    overflow:hidden!important;
    overscroll-behavior:none!important;
    background:#FAF8F3!important;
  }

  body.shell-app #appShell{
    height:100dvh!important;
    min-height:100dvh!important;
    overflow:hidden!important;
  }

  body.shell-app #appShell>.main{
    height:100dvh!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior-y:none!important;
    -webkit-overflow-scrolling:touch!important;
    padding-top:calc(env(safe-area-inset-top) + 72px)!important;
    scroll-padding-top:calc(env(safe-area-inset-top) + 72px)!important;
    background:transparent!important;
  }

  /* Keep the workspace header anchored to the viewport so iOS pull-down
     cannot expose a large gap between the status bar and the app. */
  body.shell-app .topbar{
    position:fixed!important;
    top:0!important;
    left:0!important;
    right:0!important;
    width:100%!important;
    box-sizing:border-box!important;
    margin:0!important;
    min-height:calc(env(safe-area-inset-top) + 62px)!important;
    padding-top:calc(env(safe-area-inset-top) + 8px)!important;
    padding-bottom:8px!important;
    padding-left:max(12px,env(safe-area-inset-left))!important;
    padding-right:max(12px,env(safe-area-inset-right))!important;
    background:rgba(250,248,243,.98)!important;
    border-bottom:1px solid rgba(25,25,25,.10)!important;
    backdrop-filter:blur(14px)!important;
    -webkit-backdrop-filter:blur(14px)!important;
    transform:translateZ(0);
    z-index:35!important;
  }

  /* Dashboard/menu trigger now lives inside the bar instead of floating
     separately over the page. */
  body.shell-app #menuToggle{
    position:static!important;
    inset:auto!important;
    transform:none!important;
    width:38px!important;
    min-width:38px!important;
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:0!important;
    border:1px solid rgba(25,25,25,.14)!important;
    border-radius:50%!important;
    background:#FFFFFF!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
    font-size:0!important;
    line-height:1!important;
  }
  body.shell-app #menuToggle::before{
    content:""!important;
    display:block!important;
    width:16px!important;
    height:12px!important;
    margin:auto!important;
    border-radius:1px!important;
    background:repeating-linear-gradient(
      to bottom,
      #191919 0 2px,
      transparent 2px 5px
    )!important;
  }
  body.shell-app #menuToggle:active{
    transform:scale(.96)!important;
  }

  body.shell-app .topbar:has(#backBtn:not([hidden])) #menuToggle{
    display:none!important;
  }

  body.shell-app.sidebar-is-open .topbar{
    z-index:35!important;
  }
}

@media(min-width:681px) and (max-width:860px){
  body.shell-app .topbar{
    display:flex!important;
    align-items:center!important;
    gap:10px!important;
  }
  body.shell-app .topbar-title{
    position:static!important;
    transform:none!important;
    flex:1 1 auto!important;
    min-width:0!important;
    width:auto!important;
    max-width:none!important;
    text-align:left!important;
    pointer-events:auto!important;
  }
  body.shell-app .topbar-title h1{
    text-align:left!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  body.shell-app .top-actions{
    margin-left:auto!important;
  }
}

@media(max-width:680px){
  body.shell-app #appShell>.main{
    padding-top:calc(env(safe-area-inset-top) + 66px)!important;
    scroll-padding-top:calc(env(safe-area-inset-top) + 66px)!important;
  }

  /* Reserve a real center column for the current page name.
     The right-side actions can no longer sit on top of long titles. */
  body.shell-app .topbar{
    display:grid!important;
    grid-template-columns:36px minmax(0,1fr) auto!important;
    align-items:center!important;
    column-gap:7px!important;
    min-height:calc(env(safe-area-inset-top) + 58px)!important;
    padding-top:calc(env(safe-area-inset-top) + 7px)!important;
    padding-bottom:7px!important;
    padding-left:max(12px,env(safe-area-inset-left))!important;
    padding-right:max(12px,env(safe-area-inset-right))!important;
  }

  body.shell-app #menuToggle,
  body.shell-app #backBtn{
    grid-column:1!important;
    position:relative!important;
    inset:auto!important;
    transform:none!important;
    z-index:2!important;
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    margin:0!important;
  }

  body.shell-app .topbar-title{
    grid-column:2!important;
    position:static!important;
    inset:auto!important;
    left:auto!important;
    top:auto!important;
    transform:none!important;
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    margin:0!important;
    padding:0 2px!important;
    text-align:center!important;
    pointer-events:none!important;
    z-index:1!important;
  }
  body.shell-app .topbar-title .eyebrow{display:none!important}
  body.shell-app .topbar-title h1{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    margin:0!important;
    color:#111!important;
    font-size:17px!important;
    line-height:36px!important;
    letter-spacing:-.035em!important;
    text-align:center!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  body.shell-app .top-actions{
    grid-column:3!important;
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    min-width:max-content!important;
    margin:0!important;
    position:relative!important;
    z-index:2!important;
  }
  body.shell-app .global-search-shell,
  body.shell-app #languageBtn{
    display:none!important;
  }
  body.shell-app .notification-shell{
    display:block!important;
    position:relative!important;
  }
  body.shell-app #notificationBellBtn,
  body.shell-app #appRefreshBtn{
    display:grid!important;
    place-items:center!important;
    width:34px!important;
    min-width:34px!important;
    height:34px!important;
    min-height:34px!important;
    padding:0!important;
  }
  body.shell-app #quickAddBtn{
    display:grid!important;
    place-items:center!important;
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0!important;
    border-radius:50%!important;
    font-size:0!important;
  }
}

@media(max-width:390px){
  body.shell-app .topbar{
    grid-template-columns:34px minmax(0,1fr) auto!important;
    column-gap:5px!important;
  }
  body.shell-app #menuToggle,
  body.shell-app #backBtn{
    width:34px!important;
    min-width:34px!important;
    height:34px!important;
    min-height:34px!important;
  }
  body.shell-app .topbar-title h1{
    font-size:16px!important;
    line-height:34px!important;
  }
  body.shell-app .top-actions{gap:4px!important}
  body.shell-app #notificationBellBtn,
  body.shell-app #appRefreshBtn{
    width:32px!important;
    min-width:32px!important;
    height:32px!important;
    min-height:32px!important;
  }
  body.shell-app #quickAddBtn{
    width:34px!important;
    min-width:34px!important;
    height:34px!important;
    min-height:34px!important;
  }
}
