/* ========================================================================
   GaliVue V5.1.130 — TABLET WORKSPACE FINISH

   Scope: authenticated tablet workspace presentation only (768–1100px).
   Phone/mobile geometry remains owned by the approved V5.1.129 baseline.

   Tablet corrections:
   1) keep logo + page title, App install strip, language + profile on one
      physical header row;
   2) reserve the settled tablet rail before Dashboard content so the welcome
      heading cannot be obscured;
   3) make the 7-stage workflow readable at portrait-tablet widths without a
      clipped final card;
   4) reserve the fixed bottom dock and use the full lower-dashboard width.

   No route, auth, API, D1/R2, billing, Client Selection, Final Delivery,
   Admin, desktop or phone behavior changes are introduced here.
   ======================================================================== */

@media (min-width:768px) and (max-width:1100px) {
  html body #dashboardPanel {
    --gv51130-tablet-head-h:70px;
  }

  /* One real tablet header row. V5.1.112 uses two columns while the App slot
     adds a third child; that allowed account controls to auto-place on a
     second row. Give the three existing regions explicit tracks instead. */
  html body #dashboardPanel .workspace-head,
  html body #dashboardPanel .workspace-head.gv5158-has-app-slot,
  html body #dashboardPanel.gv51112-rails-ready > .workspace-head,
  html body #dashboardPanel.gv51112-rails-ready > .workspace-head.gv5158-has-app-slot {
    height:var(--gv51130-tablet-head-h)!important;
    min-height:var(--gv51130-tablet-head-h)!important;
    padding:0 clamp(18px,3vw,28px)!important;
    display:grid!important;
    grid-template-columns:auto minmax(150px,1fr) auto!important;
    grid-template-rows:1fr!important;
    align-items:center!important;
    column-gap:12px!important;
    row-gap:0!important;
    overflow:visible!important;
  }

  html body #dashboardPanel .workspace-head > .workspace-brand,
  html body #dashboardPanel .workspace-head.gv5158-has-app-slot > .workspace-brand {
    grid-column:1!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    gap:12px!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
  }

  html body #dashboardPanel .workspace-head .workspace-brand-copy {
    position:static!important;
    inset:auto!important;
    top:auto!important;
    left:auto!important;
    transform:none!important;
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:210px!important;
    margin:0!important;
    padding:0!important;
    text-align:left!important;
    pointer-events:auto!important;
  }
  html body #dashboardPanel .workspace-head .workspace-brand-copy > small,
  html body #dashboardPanel .workspace-head .workspace-client-portal-shortcut {
    display:none!important;
  }
  html body #dashboardPanel .workspace-head .workspace-title-nav,
  html body #dashboardPanel .workspace-head #dashboardTitle {
    position:static!important;
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:210px!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    text-align:left!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  html body #dashboardPanel .workspace-head > .gv5158-app-slot,
  html body #dashboardPanel .workspace-head.gv5158-has-app-slot > .gv5158-app-slot {
    grid-column:2!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
  }
  html body #dashboardPanel .workspace-head .gv5158-app-strip {
    max-width:220px!important;
    min-width:0!important;
  }

  html body #dashboardPanel .workspace-head > .workspace-head-actions,
  html body #dashboardPanel .workspace-head.gv5158-has-app-slot > .workspace-head-actions {
    grid-column:3!important;
    grid-row:1!important;
    position:static!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:8px!important;
    width:auto!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
  }

  /* Header is shell-anchored, so the middle scroller must begin after exactly
     one tablet rail. Keep extra breathing room for the welcome card. */
  html body #dashboardDialog #dashboardPanel.gv51112-rails-ready .gv39-dashboard-main,
  html body #dashboardDialog #dashboardPanel .gv39-dashboard-main {
    padding-top:calc(var(--gv51130-tablet-head-h) + 14px)!important;
    scroll-padding-top:calc(var(--gv51130-tablet-head-h) + 14px)!important;
    padding-bottom:calc(122px + env(safe-area-inset-bottom))!important;
  }

  /* The bottom dock itself is not moved. The extra content reserve above means
     the final Dashboard sections can scroll fully clear of the dock. */
  html body #dashboardPanel .gv39-mobile-nav {
    position:absolute!important;
  }
}

/* Portrait / medium tablet: use two compact rows rather than clipping the last
   stage off-screen. Wider tablets keep the existing seven-column rail. */
@media (min-width:768px) and (max-width:899px) {
  html body #dashboardPanel .gv3961-stage-rail {
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:8px!important;
    width:100%!important;
    overflow:visible!important;
    padding:2px 1px 5px!important;
  }
  html body #dashboardPanel .gv3961-stage-chip {
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    flex:none!important;
  }

  /* Avoid a half-width Recent Activity card beside empty space on portrait
     tablets; lower Dashboard cards use the available width. */
  html body #dashboardPanel .gv391-dashboard-columns {
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:12px!important;
  }
  html body #dashboardPanel .gv391-dashboard-columns > * {
    grid-column:1!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
}
