
/* =========================================================
   GranHub 2.9 — estabilidade, menus, segurança visual e previews
   ========================================================= */

/* ---------- Sidebars: sem barras feias, mas com rolagem por roda/toque ---------- */
.portal-sidebar,
.admin-sidebar{
  overflow:hidden!important;
}
.portal-sidebar .sidebar-nav,
.admin-sidebar .sidebar-nav{
  overflow-y:auto!important;
  overflow-x:hidden!important;
  scrollbar-width:none!important;
  -ms-overflow-style:none!important;
  overscroll-behavior:contain!important;
}
.portal-sidebar .sidebar-nav::-webkit-scrollbar,
.admin-sidebar .sidebar-nav::-webkit-scrollbar{
  width:0!important;height:0!important;display:none!important;
}
.portal-sidebar .nav-link,
.admin-sidebar .nav-link{
  max-width:100%!important;
  min-width:0!important;
}
.portal-sidebar .nav-link>span:not(.nav-count),
.admin-sidebar .nav-link>span:not(.nav-count){
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

/* Desktop mantém a lateral estável sem scrollbar visível */
@media(min-width:861px){
  .portal-sidebar,.admin-sidebar{
    position:fixed!important;
    top:0!important;bottom:0!important;left:0!important;
    height:100dvh!important;
  }
}

/* ---------- Mobile do portal ---------- */
@media(max-width:860px){
  html.gh-menu-open,body.gh-menu-open{
    overflow:hidden!important;
    height:100%!important;
    touch-action:none!important;
  }
  .portal-sidebar,.admin-sidebar{
    position:fixed!important;
    top:0!important;bottom:0!important;left:0!important;
    width:min(300px,88vw)!important;
    height:100dvh!important;
    max-height:100dvh!important;
    transform:translate3d(-104%,0,0)!important;
    transition:transform .24s cubic-bezier(.2,.8,.2,1)!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
    z-index:1200!important;
    box-shadow:24px 0 54px rgba(8,34,70,.20)!important;
  }
  .portal-sidebar.open,.admin-sidebar.open{
    transform:translate3d(0,0,0)!important;
  }
  .portal-sidebar .sidebar-brand,
  .admin-sidebar .sidebar-brand{
    flex:0 0 auto!important;
    min-height:58px!important;
  }
  .portal-sidebar .sidebar-nav,
  .admin-sidebar .sidebar-nav{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    padding-bottom:16px!important;
    -webkit-overflow-scrolling:touch!important;
  }
  .portal-sidebar .sidebar-foot,
  .admin-sidebar .sidebar-foot{
    flex:0 0 auto!important;
  }
  .mobile-overlay{
    position:fixed!important;
    inset:0!important;
    z-index:1150!important;
    background:rgba(6,23,45,.36)!important;
    backdrop-filter:blur(2px)!important;
    -webkit-backdrop-filter:blur(2px)!important;
  }
  .mobile-overlay.show{display:block!important}
  .mobile-top-brand{display:flex!important}
  .mobile-top-brand img{width:116px!important;max-height:32px!important}
  .portal-topbar .top-company-menu{display:block!important}
  .portal-topbar .top-company-profile{
    display:grid!important;
    place-items:center!important;
    width:40px!important;
    min-width:40px!important;
    height:40px!important;
    padding:3px!important;
  }
  .portal-topbar .top-company-profile .company-avatar{
    display:grid!important;
    width:32px!important;height:32px!important;
  }
  .portal-topbar .top-company-profile .company-avatar img{
    width:100%!important;height:100%!important;object-fit:contain!important;
  }
  .top-company-popover{
    position:fixed!important;
    top:68px!important;
    right:8px!important;
    left:auto!important;
    width:min(330px,calc(100vw - 16px))!important;
    max-height:calc(100dvh - 82px)!important;
    overflow:auto!important;
  }
}

/* ---------- Admin mobile: header limpo + drawer funcional ---------- */
@media(max-width:860px){
  .admin-main{margin-left:0!important;width:100%!important}
  .admin-topbar{
    position:sticky!important;top:0!important;z-index:800!important;
    min-height:64px!important;height:64px!important;
    padding:0 10px!important;gap:8px!important;
  }
  .admin-topbar .mobile-menu{display:grid!important;flex:0 0 auto!important}
  .admin-top-title-wrap{min-width:0!important;margin-right:auto!important}
  .admin-top-title-wrap small{display:none!important}
  .admin-top-title-wrap .top-title{
    font-size:.82rem!important;
    overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
    max-width:42vw!important;
  }
  .admin-topbar .brasilia-clock,.admin-environment-chip{display:none!important}
  .admin-topbar .user-chip{width:40px!important;min-width:40px!important;max-width:40px!important;padding:3px!important}
  .admin-topbar .user-chip>span:not(.avatar){display:none!important}
  .admin-topbar .user-chip .avatar{width:32px!important;height:32px!important}
  .admin-content{padding:14px 10px 28px!important}
}

/* ---------- Toasts / notificações: volta ao estilo clean bonito ---------- */
.toast-host{
  position:fixed!important;
  top:18px!important;
  right:18px!important;
  left:auto!important;
  bottom:auto!important;
  width:min(376px,calc(100vw - 28px))!important;
  height:auto!important;
  max-height:calc(100dvh - 36px)!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  gap:9px!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  padding:0!important;
  pointer-events:none!important;
  overflow:visible!important;
  z-index:130000!important;
}
.toast.gh27-toast{
  position:relative!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
  min-height:72px!important;
  max-height:none!important;
  margin:0!important;
  padding:11px 10px 11px 11px!important;
  display:grid!important;
  grid-template-columns:42px minmax(0,1fr) 28px!important;
  grid-template-rows:auto!important;
  align-items:center!important;
  gap:10px!important;
  border-radius:17px!important;
  background:rgba(255,255,255,.94)!important;
  color:#17375f!important;
  border:1px solid rgba(210,225,243,.96)!important;
  border-left:1px solid rgba(210,225,243,.96)!important;
  box-shadow:0 18px 50px rgba(13,45,88,.18),inset 0 1px rgba(255,255,255,.85)!important;
  backdrop-filter:blur(20px) saturate(1.25)!important;
  -webkit-backdrop-filter:blur(20px) saturate(1.25)!important;
  overflow:hidden!important;
  pointer-events:auto!important;
  animation:gh29ToastIn .42s cubic-bezier(.18,.86,.2,1.08) both!important;
}
.toast.gh27-toast.leaving{animation:gh29ToastOut .22s ease both!important}
.gh27-toast-icon{
  width:42px!important;height:42px!important;
  border-radius:13px!important;
  display:grid!important;place-items:center!important;
  background:#eef6ff!important;color:#0972ff!important;
  box-shadow:inset 0 0 0 1px rgba(9,114,255,.08)!important;
}
.gh27-toast-icon svg{width:19px!important;height:19px!important}
.gh27-toast-copy{min-width:0!important;overflow:visible!important}
.toast.gh27-toast strong{
  display:block!important;margin:0 0 3px!important;
  color:#17375f!important;font-size:.78rem!important;font-weight:820!important;
}
.toast.gh27-toast p{
  display:block!important;margin:0!important;
  color:#667f9d!important;font-size:.68rem!important;line-height:1.42!important;
  overflow-wrap:anywhere!important;
  -webkit-line-clamp:unset!important;
}
.gh27-toast-close{
  width:28px!important;height:28px!important;border:0!important;
  border-radius:8px!important;background:transparent!important;color:#8ba0b7!important;
  display:grid!important;place-items:center!important;
}
.gh27-toast-close:hover{background:#edf4fc!important;color:#2c5d94!important}
.toast.success .gh27-toast-icon{background:#eaf9f2!important;color:#098258!important}
.toast.error .gh27-toast-icon{background:#fff0f2!important;color:#c63849!important}
.toast.warning .gh27-toast-icon{background:#fff7e8!important;color:#b47708!important}
.toast.info .gh27-toast-icon{background:#eef6ff!important;color:#0972ff!important}
.gh27-toast-progress{
  position:absolute!important;left:0!important;bottom:0!important;
  width:100%!important;height:3px!important;
  background:linear-gradient(90deg,#0972ff,#69b2ff)!important;
  transform-origin:left!important;
}
.toast.success .gh27-toast-progress{background:linear-gradient(90deg,#0b9b68,#65d6ae)!important}
.toast.error .gh27-toast-progress{background:linear-gradient(90deg,#d94050,#ff9ba6)!important}
.toast.warning .gh27-toast-progress{background:linear-gradient(90deg,#c38312,#ffd072)!important}
@keyframes gh29ToastIn{
  from{opacity:0;transform:translateX(30px) translateY(-4px) scale(.965);filter:blur(3px)}
  to{opacity:1;transform:none;filter:none}
}
@keyframes gh29ToastOut{to{opacity:0;transform:translateX(22px) scale(.97)}}
@media(max-width:620px){
  .toast-host{top:9px!important;right:9px!important;width:calc(100vw - 18px)!important}
  .toast.gh27-toast{min-height:66px!important;border-radius:15px!important}
}

/* Dropdown de notificações internas */
.top-notification-popover{
  overflow:hidden!important;
  border-radius:16px!important;
  box-shadow:0 22px 60px rgba(12,48,92,.18)!important;
}
.top-notification-list{
  max-height:420px!important;
  overflow-y:auto!important;
  scrollbar-width:none!important;
}
.top-notification-list::-webkit-scrollbar{display:none!important}
.top-notification-item{
  transition:background .18s ease,transform .18s ease!important;
}
.top-notification-item:hover{transform:translateX(2px)!important}

/* ---------- Preview de PDF: ligeiramente menor que a revisão anterior ---------- */
@media(min-width:900px){
  .modal-lg{
    width:min(1180px,calc(100vw - 52px))!important;
    max-height:calc(100dvh - 44px)!important;
  }
  .gh27-document-preview,
  .gh27-document-preview iframe{
    min-height:74dvh!important;
    height:74dvh!important;
  }
  .gh27-document-preview img{max-height:74dvh!important}
}
@media(max-width:899px){
  .gh27-document-preview,.gh27-document-preview iframe{
    min-height:62dvh!important;height:62dvh!important;
  }
}

/* ---------- Status operacional ---------- */
.gh29-live-dot{
  width:8px;height:8px;border-radius:50%;
  display:inline-block;background:#0aa76f;
  box-shadow:0 0 0 0 rgba(10,167,111,.35);
  animation:gh29Pulse 1.8s ease-out infinite;
}
@keyframes gh29Pulse{70%{box-shadow:0 0 0 7px rgba(10,167,111,0)}100%{box-shadow:0 0 0 0 rgba(10,167,111,0)}}

/* ---------- Legal interno ---------- */
.gh-internal-legal-guard{visibility:hidden}
.gh-internal-legal-guard.verified{visibility:visible}

/* ---------- Segurança/UX: esconder qualquer barra horizontal acidental ---------- */
.portal-app,.admin-app,.portal-main,.admin-main,.portal-content,.admin-content{
  overflow-x:clip!important;
}


/* GranHub 2.9.1 - animações perceptíveis também em desktops rápidos */
html.gh27-motion-enabled .gh27-motion-item{
  transition-property:opacity,transform,box-shadow,border-color!important;
  transition-duration:.48s,.48s,.22s,.22s!important;
  transition-timing-function:cubic-bezier(.2,.8,.2,1)!important;
}
@media (min-width:861px){
  html.gh27-motion-enabled .gh27-motion-item{
    transform:translate3d(0,14px,0) scale(.991)!important;
  }
  html.gh27-motion-enabled .gh27-motion-item.gh27-inview{
    transform:translate3d(0,0,0) scale(1)!important;
  }
  .btn,.icon-btn,.nav-link,.service-shortcut,.theme-option{
    transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease,background-color .2s ease!important;
  }
}
