/* COMASA 3.12.13.33 - tablet drawer and CRM submenu correction.
   Scoped to COMASA. No global header changes, no database changes. */

/* A minimized desktop sidebar contains ONLY its nav icons. Never show clipped funnel names. */
body.sidebar-collapsed:not(.ui33DrawerMode) #app>header #nav .crm38Sidebar,
body.sidebar-collapsed:not(.ui33DrawerMode) #app>header #nav .ui30NavSection {
  display:none!important;
}
#app>header #nav .crm38Sidebar:not(.open){display:none!important}
#app>header #nav .crm38Sidebar.open{
  display:grid!important;gap:2px!important;
  min-width:0;max-width:100%;
  margin:1px 0 7px 42px!important;padding:2px 4px 4px 2px!important;
}
#app>header #nav .crm38SideFunnel,
#app>header #nav .crm38CreateSide{
  min-width:0!important;max-width:100%!important;
  grid-template-columns:17px minmax(0,1fr)!important;
  gap:5px!important;padding:7px 8px!important;
  line-height:1.3!important;overflow-wrap:anywhere;
}
#app>header #nav button[data-tab="crm"]{position:relative}
#app>header #nav button[data-tab="crm"][aria-expanded="true"]:after{
  content:'';position:absolute;right:10px;top:50%;width:5px;height:5px;
  transform:translateY(-50%);border-radius:50%;background:#6bdcf5;
}

/* Touch tablets and small screens: fully off-canvas, never a 76px 'broken' column.
   Enabled by JS only at tablet widths with touch capabilities, or phone widths. */
body.ui33DrawerMode #app>header{
  position:fixed!important;top:0!important;left:0!important;right:auto!important;bottom:0!important;
  width:min(332px,calc(100vw - 58px))!important;
  height:100vh!important;height:100dvh!important;
  max-width:calc(100vw - 58px)!important;
  padding:14px 13px 16px!important;
  transform:translate3d(calc(-100% - 28px),0,0)!important;
  visibility:hidden!important;pointer-events:none!important;
  z-index:121!important;overflow:hidden!important;
  transition:transform .22s ease, visibility .22s ease!important;
  box-shadow:13px 0 38px rgba(2,12,29,.28)!important;
}
body.ui33DrawerMode.sidebar-open #app>header{
  transform:translate3d(0,0,0)!important;
  visibility:visible!important;pointer-events:auto!important;
}
body.ui33DrawerMode #app>main{
  margin-left:0!important;
  min-width:0!important;
  padding-top:70px!important;
}
body.ui33DrawerMode #app>header #nav{
  margin-top:6px!important;
  padding:0 7px 22px 0!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  min-height:0!important;
}
body.ui33DrawerMode #app>header #nav .ui30NavSection{display:flex!important}
body.ui33DrawerMode #app>header #nav .sideNavItem{
  display:grid!important;grid-template-columns:38px minmax(0,1fr)!important;
  justify-items:stretch!important;padding:5px 11px 5px 7px!important;
}
body.ui33DrawerMode #app>header #nav .sideNavLabel{
  display:block!important;min-width:0!important;
}
body.ui33DrawerMode #app>header .brandIdentity{
  display:grid!important;grid-template-columns:39px minmax(0,1fr)!important;
  min-height:57px!important;padding:3px 39px 9px 3px!important;
  justify-items:stretch!important;
}
body.ui33DrawerMode #app>header .brandIdentity>div{display:block!important}
body.ui33DrawerMode #app>header .userbox.ui31Ready{
  display:block!important;position:relative!important;
}
body.ui33DrawerMode #app>header .sidebarCollapseToggle{
  display:grid!important;position:absolute!important;
  top:16px!important;right:13px!important;
  width:33px!important;height:33px!important;
  padding:0!important;border-radius:10px!important;
  font-size:22px!important;z-index:12!important;
}
body.ui33DrawerMode.ui33AuthReady:not(.sidebar-open) #sidebarMobileToggle{
  display:grid!important;place-items:center!important;
  position:fixed!important;top:12px!important;left:12px!important;
  width:43px!important;height:43px!important;
  padding:0!important;z-index:123!important;
  border-radius:11px!important;
  background:#10243c!important;color:#e8f5ff!important;
  border:1px solid rgba(170,207,229,.4)!important;
  box-shadow:0 5px 18px rgba(12,27,48,.16)!important;
}
body.ui33DrawerMode:not(.ui33AuthReady) #sidebarMobileToggle,
body.ui33DrawerMode.sidebar-open #sidebarMobileToggle{display:none!important}
body.ui33DrawerMode #sidebarOverlay{display:none!important}
body.ui33DrawerMode.sidebar-open #sidebarOverlay{
  display:block!important;position:fixed!important;inset:0!important;
  background:rgba(5,17,34,.52)!important;
  z-index:119!important;
}
body.ui33DrawerMode.sidebar-open{overflow:hidden!important}
body.ui33DrawerMode .security-fab{left:12px!important}
body.ui33DrawerMode .modal{left:0!important;right:0!important;width:100%!important}
body.ui33DrawerMode #crm38AutomationModal.crm38AutomationSurface{
  left:0!important;width:100%!important;
}
body.ui33DrawerMode #v18ScrollMirror{left:14px!important;right:14px!important}
body.ui33DrawerMode #app>header #nav .crm38Sidebar.open{
  margin-left:43px!important;
}
#sidebarMobileToggle:focus-visible,
#app>header #nav [data-tab="crm"]:focus-visible,
#app>header #nav .crm38SideFunnel:focus-visible{
  outline:2px solid #8bdfff!important;outline-offset:2px!important;
}
@media(max-width:600px){
  body.ui33DrawerMode #app>header{width:min(315px,calc(100vw - 48px))!important;max-width:calc(100vw - 48px)!important}
  body.ui33DrawerMode #app>main{padding-left:12px!important;padding-right:12px!important}
}
@media(prefers-reduced-motion:reduce){
  body.ui33DrawerMode #app>header{transition:none!important}
}
@media print{
  body.ui33DrawerMode #app>header,
  body.ui33DrawerMode #sidebarMobileToggle,
  body.ui33DrawerMode #sidebarOverlay{display:none!important}
  body.ui33DrawerMode #app>main{margin:0!important;padding:0!important}
}
/* Unlike individual funnels, 'Criar Funil' contains a plain text node.
   Flex layout avoids the 16px grid cell that split it into three lines. */
#app>header #nav .crm38CreateSide{
  display:flex!important;align-items:center!important;
  white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
}
