/*
 * Contrato único del armazón de escritorio SmartSuite.
 *
 * Esta capa se carga la última para que ningún módulo vuelva a redefinir la
 * geometría compartida. Cada producto únicamente aporta su color, identidad,
 * opciones autorizadas y contenido de negocio.
 */
:root{
  --module-shell-sidebar-width:264px;
  --module-shell-header-height:58px;
  --module-shell-workspace-padding:20px;
  --module-shell-canvas:#f4f7fb;
  --module-shell-line:#d8e3f0;
}

/* Familias de shell existentes: dos columnas, cabecera continua y un único
   lienzo de trabajo. La navegación nunca se desplaza con el contenido. */
@media (min-width:901px){
  :is(.warehouse.desktop,.envios-desktop.desktop,.vision-shell.desktop,.gmao.desktop){
    --module-shell-sidebar-width:264px;
    display:grid!important;
    grid-template-columns:var(--module-shell-sidebar-width) minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    width:100%!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
    background:var(--module-shell-canvas)!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop)>.side,
  .vision-shell>.vision-side{
    position:static!important;
    grid-column:1!important;
    grid-row:1!important;
    width:var(--module-shell-sidebar-width)!important;
    min-width:var(--module-shell-sidebar-width)!important;
    max-width:var(--module-shell-sidebar-width)!important;
    height:100dvh!important;
    min-height:0!important;
    box-sizing:border-box!important;
    overflow:hidden auto!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop)>.desktop-main,
  .vision-shell>.vision-main{
    grid-column:2!important;
    grid-row:1!important;
    display:grid!important;
    grid-template-rows:var(--module-shell-header-height) minmax(0,1fr)!important;
    width:auto!important;
    min-width:0!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop) .side .brand,
  .vision-shell .vision-side .brand{
    box-sizing:border-box!important;
    min-height:var(--module-shell-header-height)!important;
    height:var(--module-shell-header-height)!important;
    margin:0!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop) .topbar,
  .vision-shell .vision-top{
    grid-column:1!important;
    box-sizing:border-box!important;
    min-height:var(--module-shell-header-height)!important;
    height:var(--module-shell-header-height)!important;
    margin:0!important;
    border-radius:0!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop) .desk-content,
  .vision-shell .vision-content{
    grid-column:1!important;
    min-width:0!important;
    min-height:0!important;
    width:auto!important;
    max-width:none!important;
    height:100%!important;
    margin:0!important;
    padding:var(--module-shell-workspace-padding)!important;
    overflow:auto!important;
    overscroll-behavior:contain;
  }

  /* DataPlan y SmartReceptionAI comparten el mismo armazón aunque su menú
     conserve la identidad visual propia. */
  .dp-desktop-app{
    --module-shell-sidebar-width:264px;
    display:grid!important;
    grid-template-columns:var(--module-shell-sidebar-width) minmax(0,1fr)!important;
    width:100%!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  .dp-desktop-app>.dp-desktop-sidebar{
    position:static!important;
    grid-column:1!important;
    grid-row:1!important;
    width:var(--module-shell-sidebar-width)!important;
    min-width:var(--module-shell-sidebar-width)!important;
    max-width:var(--module-shell-sidebar-width)!important;
    height:100dvh!important;
    min-height:0!important;
    box-sizing:border-box!important;
    overflow:hidden auto!important;
  }
  .dp-desktop-app>.dp-desktop-main{
    grid-column:2!important;
    grid-row:1!important;
    display:grid!important;
    grid-template-rows:var(--module-shell-header-height) minmax(0,1fr)!important;
    width:auto!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  .dp-desktop-app .dp-desktop-brand,
  .dp-desktop-app .dp-desktop-topbar{
    box-sizing:border-box!important;
    min-height:var(--module-shell-header-height)!important;
    height:var(--module-shell-header-height)!important;
  }
  .dp-desktop-app .dp-desktop-brand{width:var(--module-shell-sidebar-width)!important}
  .dp-desktop-app .dp-desktop-content{
    min-width:0!important;
    min-height:0!important;
    width:auto!important;
    max-width:none!important;
    height:100%!important;
    margin:0!important;
    padding:var(--module-shell-workspace-padding)!important;
    overflow:auto!important;
    overscroll-behavior:contain;
  }

  /* SmartProveedores es otro módulo de negocio y se ajusta al mismo marco. */
  .sp-shell{
    --module-shell-sidebar-width:264px;
    display:grid!important;
    grid-template-columns:var(--module-shell-sidebar-width) minmax(0,1fr)!important;
    width:100%!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  .sp-sidebar{
    position:static!important;
    grid-column:1!important;
    grid-row:1!important;
    width:var(--module-shell-sidebar-width)!important;
    min-width:var(--module-shell-sidebar-width)!important;
    max-width:var(--module-shell-sidebar-width)!important;
    height:100dvh!important;
    min-height:0!important;
    box-sizing:border-box!important;
    overflow:hidden auto!important;
  }
  .sp-main{
    grid-column:2!important;
    grid-row:1!important;
    display:grid!important;
    grid-template-rows:var(--module-shell-header-height) minmax(0,1fr)!important;
    min-width:0!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  .sp-topbar{
    box-sizing:border-box!important;
    min-height:var(--module-shell-header-height)!important;
    height:var(--module-shell-header-height)!important;
  }
  .sp-work{
    min-width:0!important;
    min-height:0!important;
    width:auto!important;
    max-width:none!important;
    height:100%!important;
    margin:0!important;
    padding:var(--module-shell-workspace-padding)!important;
    overflow:auto!important;
    overscroll-behavior:contain;
  }

  /* SmartCore y todas sus superficies respetan las mismas medidas. */
  .smartcore-shell{
    grid-template-columns:var(--module-shell-sidebar-width) minmax(0,1fr)!important;
    width:100%!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  .smartcore-shell__sidebar{
    width:var(--module-shell-sidebar-width)!important;
    min-width:var(--module-shell-sidebar-width)!important;
    max-width:var(--module-shell-sidebar-width)!important;
    min-height:0!important;
    box-sizing:border-box!important;
    overflow:hidden auto!important;
  }
  .smartcore-shell__surface{grid-template-rows:var(--module-shell-header-height) minmax(0,1fr)!important;height:100dvh!important;overflow:hidden!important}
  .smartcore-shell__topbar{box-sizing:border-box!important;min-height:var(--module-shell-header-height)!important;height:var(--module-shell-header-height)!important;margin:0!important}
  .smartcore-shell__content{min-width:0!important;min-height:0!important;max-width:none!important;height:100%!important;margin:0!important;padding:var(--module-shell-workspace-padding)!important;overflow:auto!important;overscroll-behavior:contain}

  /* SmartAdministración: el encabezado replica exactamente la partición del
     menú lateral y el formulario aprovecha todo el rectángulo restante. */
  .basic-portal.suite-admin-scroll-shell{
    --module-shell-sidebar-width:264px;
    --suite-admin-header-height:var(--module-shell-header-height);
    display:grid!important;
    grid-template-columns:var(--module-shell-sidebar-width) minmax(0,1fr)!important;
    grid-template-rows:var(--module-shell-header-height) minmax(0,1fr)!important;
    width:100%!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  .basic-portal.suite-admin-scroll-shell>.suite-admin-unified-header{
    grid-column:1/-1!important;
    grid-row:1!important;
    grid-template-columns:var(--module-shell-sidebar-width) minmax(0,1fr) 300px!important;
    box-sizing:border-box!important;
    min-height:var(--module-shell-header-height)!important;
    height:var(--module-shell-header-height)!important;
    margin:0!important;
  }
  .basic-portal.suite-admin-scroll-shell>.suite-admin-sidebar{
    grid-column:1!important;
    grid-row:2!important;
    width:var(--module-shell-sidebar-width)!important;
    min-width:var(--module-shell-sidebar-width)!important;
    max-width:var(--module-shell-sidebar-width)!important;
    min-height:0!important;
    box-sizing:border-box!important;
    overflow:hidden auto!important;
  }
  .basic-portal.suite-admin-scroll-shell>.suite-admin-scroll-content{
    grid-column:2!important;
    grid-row:2!important;
    width:auto!important;
    max-width:none!important;
    height:100%!important;
    max-height:none!important;
    min-height:0!important;
    margin:0!important;
    padding:var(--module-shell-workspace-padding)!important;
    overflow:auto!important;
    overscroll-behavior:contain;
  }
}

/* Punto de almacén usa su propio flujo táctil dentro del lateral común;
   Android conserva su navegación nativa. */
.warehouse-point-shell{--module-shell-header-height:58px}

/* Estado y sincronización es siempre una ficha interna del menú. Las hojas
   antiguas la situaban en absoluto: esta regla final impide que pueda tomar el
   ancho del lienzo de trabajo o superponerse al formulario. */
@media (min-width:901px){
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop)>.side,
  .vision-shell>.vision-side,
  .dp-desktop-app>.dp-desktop-sidebar,
  .sp-shell>.sp-sidebar,
  .smartcore-shell>.smartcore-shell__sidebar,
  .basic-portal.suite-admin-scroll-shell>.suite-admin-sidebar{
    display:flex!important;
    flex-direction:column!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop)>.side>.side-nav,
  .vision-shell>.vision-side>.side-nav,
  .dp-desktop-app>.dp-desktop-sidebar>nav,
  .sp-shell>.sp-sidebar>nav,
  .smartcore-shell>.smartcore-shell__sidebar>.smartcore-shell__navigation{
    min-height:0!important;
    overflow:auto!important;
  }
  :is(.warehouse.desktop,.envios-desktop.desktop,.gmao.desktop)>.side>.suite-sidebar-status,
  .vision-shell>.vision-side>.suite-sidebar-status,
  .dp-desktop-app>.dp-desktop-sidebar>.suite-sidebar-status,
  .sp-shell>.sp-sidebar>.suite-sidebar-status,
  .smartcore-shell>.smartcore-shell__sidebar>.suite-sidebar-status,
  .basic-portal.suite-admin-scroll-shell>.suite-admin-sidebar>.suite-sidebar-status{
    position:static!important;
    inset:auto!important;
    z-index:auto!important;
    flex:0 0 auto!important;
    width:calc(100% - 24px)!important;
    max-width:calc(100% - 24px)!important;
    min-height:64px!important;
    margin:12px!important;
    margin-top:auto!important;
    box-sizing:border-box!important;
  }
}

@media (max-width:900px){
  :root{--module-shell-workspace-padding:14px}
}

/* Standalone web modules share exactly the same desktop geometry. */
.smartcore-shell__sidebar>[data-suite-status-host]{margin-top:auto;flex:0 0 auto;min-width:0}
.smartcore-shell__sidebar>[data-suite-status-host]>.suite-sidebar-status{position:static!important;inset:auto!important;width:100%!important;max-width:100%!important;margin:12px 0 0!important}
body.granja-shell{height:100dvh;overflow:hidden}
body.granja-shell>aside.side{position:fixed;inset:0 auto 0 0;width:var(--module-shell-sidebar-width);height:100dvh;min-height:0;z-index:40}
body.granja-shell>#suiteTop{position:fixed;top:0;left:var(--module-shell-sidebar-width);right:0;height:var(--module-shell-header-height)}
body.granja-shell>main{position:fixed;inset:var(--module-shell-header-height) 0 0 var(--module-shell-sidebar-width);margin:0;width:auto;height:auto;max-width:none;min-width:0;min-height:0;padding:var(--module-shell-workspace-padding);overflow:auto;display:flex;flex-direction:column;gap:18px}
@media(max-width:900px){body.granja-shell>aside.side{width:var(--module-shell-sidebar-width);transform:translateX(-100%);transition:transform .18s ease;box-shadow:12px 0 36px #102b5d33}body.granja-shell.menu-open>aside.side{transform:translateX(0)}body.granja-shell>#suiteTop{left:0;padding-left:8px}body.granja-shell>main{left:0;padding:14px}body.granja-shell.menu-open>#menuShade{position:fixed;inset:0;display:block;z-index:35;background:#102b5d66}}
