/* ========================================================================
   GaliVue V5.1.111 — MOBILE WORKSPACE FIXED TOP HEADER
   Presentation-only corrective patch.

   User contract on compact authenticated workspace screens:
   - top workspace header = fixed to the app viewport
   - bottom navigation = remains on the existing V5.1.110 anchored contract
   - only .gv39-dashboard-main content scrolls between them

   This patch deliberately does NOT alter .gv39-mobile-nav positioning.
   No auth/session, API, Worker, D1, R2, billing, project-state, Client
   Selection, Final Delivery, Admin or HERO business logic is changed.
   ======================================================================== */

@media (max-width:1100px) {
  /* The main remains the existing V3.9.61 compact-screen scroller. Reserve
     physical space for the header because a fixed element leaves document
     flow. Long destinations can now scroll without moving the header. */
  #dashboardPanel .gv39-dashboard-main {
    padding-top:calc(66px + env(safe-area-inset-top)) !important;
    scroll-padding-top:calc(66px + env(safe-area-inset-top)) !important;
  }

  /* Fixed means fixed: this is intentionally not sticky. Sticky depended on
     the active overflow ancestor and was therefore inconsistent between
     Dashboard and long destinations such as New Project. */
  #dashboardPanel .workspace-head,
  #dashboardPanel .workspace-head.gv5158-has-app-slot {
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    right:0 !important;
    bottom:auto !important;
    z-index:260 !important;
    width:100vw !important;
    max-width:100vw !important;
    min-width:0 !important;
    min-height:66px !important;
    height:calc(66px + env(safe-area-inset-top)) !important;
    margin:0 !important;
    padding:env(safe-area-inset-top) clamp(16px,3vw,28px) 0 !important;
    box-sizing:border-box !important;
    transform:none !important;
    will-change:auto !important;
    background:rgba(251,250,246,.97) !important;
    border-bottom:1px solid rgba(222,217,207,.88) !important;
    box-shadow:0 6px 22px rgba(24,23,20,.035) !important;
    backdrop-filter:blur(18px) !important;
    -webkit-backdrop-filter:blur(18px) !important;
  }
}

@media (max-width:767px) {
  #dashboardPanel .gv39-dashboard-main {
    padding-top:calc(62px + env(safe-area-inset-top)) !important;
    scroll-padding-top:calc(62px + env(safe-area-inset-top)) !important;
  }

  #dashboardPanel .workspace-head,
  #dashboardPanel .workspace-head.gv5158-has-app-slot {
    min-height:62px !important;
    height:calc(62px + env(safe-area-inset-top)) !important;
    padding:env(safe-area-inset-top) 14px 0 !important;
  }
}

/* Short landscape phones used to carry an old position:static exception.
   Fixed top navigation is now the app-wide rule there as well. */
@media (orientation:landscape) and (max-height:600px) and (max-width:1100px) {
  #dashboardPanel .workspace-head,
  #dashboardPanel .workspace-head.gv5158-has-app-slot {
    position:fixed !important;
    top:0 !important;
  }
}
