/* =========================================================
   GranHub 2.8 — mobile, topbar, perfil, notificações e monitoramento
   ========================================================= */

/* Topbar superior realmente fixa durante a rolagem */
.portal-topbar{
  position:fixed!important;
  top:0!important;
  left:var(--gh-sidebar)!important;
  right:0!important;
  width:auto!important;
  height:var(--gh-header)!important;
  z-index:700!important;
  background:rgba(249,252,255,.94)!important;
  backdrop-filter:blur(18px) saturate(1.1)!important;
  -webkit-backdrop-filter:blur(18px) saturate(1.1)!important;
  box-shadow:0 8px 24px rgba(12,49,96,.055)!important;
}
.portal-content{padding-top:calc(var(--gh-header) + 22px)!important}
.mobile-top-brand{display:none;align-items:center;min-width:0}
.mobile-top-brand img{width:118px;height:auto;max-height:34px;object-fit:contain;object-position:left center}

/* Lateral desktop volta ao comportamento estável/original */
@media(min-width:861px){
  .portal-sidebar{position:fixed!important;top:0!important;bottom:0!important;left:0!important;height:100vh!important;transform:none!important;overflow:hidden!important}
  .portal-sidebar .sidebar-nav{overflow-y:auto!important;min-height:0!important}
  .portal-main{margin-left:var(--gh-sidebar)!important}
  .mobile-overlay,.mobile-sidebar-close{display:none!important}
}

/* Perfil superior: menu compacto */
.top-company-menu{position:relative}
.top-company-popover{
  position:absolute;right:0;top:calc(100% + 10px);width:min(320px,calc(100vw - 22px));
  background:rgba(255,255,255,.98);border:1px solid #dbe8f8;border-radius:14px;
  box-shadow:0 20px 50px rgba(13,53,103,.16);padding:10px;z-index:900;
  animation:gh28Popover .2s ease both
}
.top-company-popover.hidden{display:none!important}
.top-company-popover-head{display:grid;grid-template-columns:46px minmax(0,1fr);gap:10px;align-items:center;padding:8px}
.top-company-popover-logo{width:46px;height:46px;border:1px solid #dbe8f8;border-radius:11px;background:#fff;padding:4px;display:grid;place-items:center}
.top-company-popover-logo img{width:100%;height:100%;object-fit:contain}
.top-company-popover-head strong,.top-company-popover-head small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-company-popover-head strong{font-size:.78rem;color:#173d6b}.top-company-popover-head small{font-size:.65rem;color:#7890ab;margin-top:2px}
.top-company-popover-actions{display:grid;gap:5px;border-top:1px solid #edf3fa;padding-top:8px}
.top-company-popover-actions a,.top-company-popover-actions button{min-height:38px;border:0;border-radius:9px;background:transparent;color:#315d8f;padding:0 10px;display:flex;align-items:center;gap:8px;font-size:.72rem;font-weight:720;text-align:left}
.top-company-popover-actions a:hover,.top-company-popover-actions button:hover{background:#f1f7ff;color:#0a66d2}
@keyframes gh28Popover{from{opacity:0;transform:translateY(-5px) scale(.985)}to{opacity:1;transform:none}}

/* Drawer mobile robusto */
.mobile-sidebar-close{display:none}
@media(max-width:860px){
  html.gh-menu-open,body.gh-menu-open{overflow:hidden!important;height:100%!important;overscroll-behavior:none!important}
  .portal-topbar{left:0!important;height:64px!important;min-height:64px!important;padding:0 10px!important;gap:7px!important}
  .portal-content{padding:80px 12px 30px!important}
  .mobile-menu{display:grid!important;width:40px!important;height:40px!important;flex:0 0 auto!important}
  .mobile-top-brand{display:flex!important;margin-right:auto}
  .global-search{display:none!important}
  .portal-topbar>.topbar-actions{margin-left:0!important;gap:6px!important}
  .portal-topbar .brasilia-clock,.portal-topbar .topbar-actions>a[aria-label="Central de ajuda"]{display:none!important}
  .portal-topbar .top-company-profile{width:42px!important;min-width:42px!important;max-width:42px!important;height:42px!important;padding:3px!important;border-radius:11px!important}
  .portal-topbar .top-company-profile>span:not(.company-avatar),.portal-topbar .top-company-profile>svg{display:none!important}
  .portal-topbar .top-company-profile .company-avatar{width:34px!important;height:34px!important;border-radius:9px!important;margin:0!important}
  .portal-topbar .icon-btn{width:40px!important;height:40px!important;border-radius:11px!important}
  .portal-sidebar{
    position:fixed!important;inset:0 auto 0 0!important;width:min(310px,88vw)!important;height:100dvh!important;max-height:100dvh!important;
    transform:translate3d(-105%,0,0)!important;transition:transform .25s cubic-bezier(.2,.8,.2,1)!important;
    z-index:1100!important;background:#fff!important;box-shadow:25px 0 55px rgba(8,35,72,.22)!important;
    display:flex!important;flex-direction:column!important;overflow:hidden!important;padding:12px 12px max(10px,env(safe-area-inset-bottom))!important
  }
  .portal-sidebar.open{transform:translate3d(0,0,0)!important}
  .portal-sidebar .sidebar-brand{height:58px!important;min-height:58px!important;padding:0 4px 0 8px!important;margin:0 0 8px!important;display:flex!important;justify-content:space-between!important;gap:8px!important}
  .portal-sidebar .sidebar-brand .logo-image{width:136px!important;max-height:38px!important}
  .mobile-sidebar-close{display:grid!important;width:38px;height:38px;border:1px solid #dbe8f8;border-radius:10px;background:#f7fbff;color:#295f9a;place-items:center;flex:0 0 auto}
  .portal-sidebar .sidebar-company-card{flex:0 0 auto!important;margin:0 2px 8px!important}
  .portal-sidebar .sidebar-nav{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important;padding:2px 2px 18px!important}
  .portal-sidebar .sidebar-foot{flex:0 0 auto!important;margin-top:0!important;padding-top:9px!important;background:inherit!important}
  .mobile-overlay{position:fixed!important;inset:0!important;z-index:1050!important;background:rgba(4,19,39,.38)!important;backdrop-filter:blur(2px)!important;-webkit-backdrop-filter:blur(2px)!important;display:none!important}
  .mobile-overlay.show{display:block!important;animation:gh28Overlay .18s ease both}
  @keyframes gh28Overlay{from{opacity:0}to{opacity:1}}
  .top-company-popover{position:fixed!important;top:70px!important;right:10px!important;width:min(330px,calc(100vw - 20px))!important}
}

/* Mobile: nada sobreposto, cards confortáveis */
@media(max-width:760px){
  .page-head{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:8px!important;margin-bottom:13px!important}
  .page-head .eyebrow{font-size:.62rem!important}.page-head h1{font-size:1.45rem!important;line-height:1.08!important}.page-head p{font-size:.73rem!important;line-height:1.5!important}
  .page-actions{display:grid!important;grid-template-columns:1fr!important;width:100%!important;gap:7px!important}.page-actions>*{width:100%!important;min-width:0!important}
  .dashboard-welcome{grid-template-columns:1fr!important;gap:10px!important}
  .dashboard-welcome-main{padding:17px 14px!important;border-radius:13px!important}.dashboard-welcome-main h1{font-size:1.5rem!important}.dashboard-welcome-main p{font-size:.76rem!important}
  .dashboard-welcome-actions{display:grid!important;grid-template-columns:1fr!important;gap:7px!important}.dashboard-welcome-actions .btn{width:100%!important}
  .gh27-home-benefits{display:grid!important;grid-template-columns:1fr 1fr!important;gap:6px!important}.gh27-home-benefits span{font-size:.59rem!important;min-width:0!important}
  .dashboard-quick-panel{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}.dashboard-quick-card{min-width:0!important;padding:12px!important}
  .company-hero-renewed{min-height:260px!important;border-radius:13px!important}.company-hero-renewed .company-hero-content{height:260px!important;padding:15px!important;display:grid!important;grid-template-columns:58px minmax(0,1fr)!important;grid-template-rows:auto auto!important;align-content:end!important;gap:10px!important}.company-hero-renewed .company-logo{width:58px!important;height:58px!important}.company-hero-renewed .company-info{min-width:0!important}.company-hero-renewed .company-info h2{font-size:1rem!important}.company-hero-renewed .company-meta{grid-column:1/-1!important;display:flex!important;flex-wrap:wrap!important}.company-profile-link{grid-column:1/-1!important;width:100%!important;margin:0!important}
  .home-section-head,.section-head{align-items:flex-start!important;gap:8px!important;flex-wrap:wrap!important}.section-head>div{min-width:0!important}.section-head>a{font-size:.67rem!important}
  .service-shortcut-grid{grid-template-columns:1fr!important;gap:9px!important}.service-shortcut{display:grid!important;grid-template-columns:112px minmax(0,1fr)!important;min-height:112px!important}.service-shortcut-image{height:112px!important}.service-shortcut-body{padding:11px!important}.service-shortcut-body p{display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;font-size:.65rem!important}
  .viewer-highlight{min-height:190px!important;border-radius:13px!important;padding:16px!important}.viewer-highlight-copy{max-width:72%!important}.viewer-highlight-copy strong{font-size:1rem!important}.viewer-highlight-action{position:absolute!important;right:12px!important;bottom:12px!important;font-size:.64rem!important}
  .metric-grid,.compact-metrics{grid-template-columns:1fr 1fr!important;gap:8px!important}.metric-card{padding:11px!important;min-width:0!important}.metric-card strong{font-size:1.05rem!important}
  .home-summary-grid,.dashboard-grid,.area-dashboard-grid,.profile-layout,.profile-layout-renewed,.ticket-layout{grid-template-columns:1fr!important;gap:10px!important}
  .card,.section-card,.profile-card,.profile-form{min-width:0!important;max-width:100%!important;border-radius:12px!important}
  .project-cards,.doc-grid,.tutorial-grid{grid-template-columns:1fr!important}
  .project-card-actions,.doc-actions,.area-project-actions,.area-doc-actions,.settings-actions,.table-actions{display:grid!important;grid-template-columns:1fr!important;gap:6px!important;width:100%!important}.project-card-actions .btn,.doc-actions .btn,.area-project-actions .btn,.settings-actions .btn,.table-actions .btn{width:100%!important;min-width:0!important;margin:0!important}
  .project-facts{grid-template-columns:1fr!important;gap:7px!important}.project-facts>span{padding:7px;border-radius:8px;background:#f8fbff!important}
  .calendar-card{padding:12px!important}.calendar-toolbar{align-items:center!important}.calendar-toolbar-actions{margin-left:auto!important}.calendar-weekdays,.calendar-grid{gap:3px!important}.calendar-day{min-height:48px!important;padding:4px!important}.calendar-event-mini{display:none!important}.calendar-day:has(.calendar-event-mini):after{content:"";position:absolute;width:5px;height:5px;border-radius:50%;background:var(--gh-blue);bottom:5px;left:50%;transform:translateX(-50%)}
  .profile-company-hero{height:210px!important}.profile-company-content{left:14px!important;right:14px!important;bottom:14px!important}.profile-company-logo{width:60px!important;height:60px!important}.profile-company-content h2{font-size:1rem!important}
  .gh26-profile-toolbar{align-items:flex-start!important;gap:10px!important;flex-direction:column!important}.gh26-edit-profile{width:100%!important}.gh26-edit-actions{width:100%!important;grid-template-columns:1fr 1fr!important;gap:7px!important}.gh26-edit-actions .btn{width:100%!important}
  .theme-grid{grid-template-columns:1fr!important}
  .gh27-status-grid{grid-template-columns:1fr 1fr!important;gap:8px!important}.gh27-status-card{padding:12px!important}.gh27-status-card>strong{font-size:.95rem!important}
  .gh27-social-icons{gap:8px!important}.gh27-social-icon{width:44px!important;height:44px!important}.gh27-social-icon span{display:none!important}
  .modal-backdrop{padding:6px!important;align-items:flex-end!important}.modal{width:100%!important;max-width:100%!important;max-height:94dvh!important;border-radius:16px 16px 0 0!important}.modal-head{position:sticky!important;top:0!important;z-index:4!important;background:#fff!important}.modal-body{overflow-y:auto!important}.modal-foot{display:grid!important;grid-template-columns:1fr!important;gap:7px!important}.modal-foot .btn{width:100%!important}
  .top-notification-popover{top:70px!important;right:8px!important;left:8px!important;width:auto!important;max-height:70dvh!important}
}
@media(max-width:430px){
  .mobile-top-brand img{width:104px}
  .portal-topbar{padding:0 7px!important;gap:5px!important}.portal-topbar .icon-btn{width:38px!important;height:38px!important}.portal-topbar .top-company-profile{width:38px!important;min-width:38px!important;max-width:38px!important;height:38px!important}.portal-topbar .top-company-profile .company-avatar{width:31px!important;height:31px!important}
  .gh27-home-benefits,.metric-grid,.compact-metrics,.gh27-status-grid{grid-template-columns:1fr!important}
  .service-shortcut{grid-template-columns:96px minmax(0,1fr)!important}.service-shortcut-image{height:100%!important;min-height:108px!important}
}

/* Perfil: controles realmente ocultos até clicar em Editar */
.profile-form .gh26-edit-actions{display:none!important}
.profile-form.is-editing .gh26-edit-actions{display:flex!important}
.profile-form.is-editing .gh26-edit-profile{display:none!important}
.profile-form.is-readonly .gh26-edit-profile{display:inline-flex!important}
.profile-form.is-readonly input[readonly]{background:#f8fbff!important;color:#486684!important;cursor:default!important}

/* Toasts/notificações: compactos e elegantes */
.toast-host{position:fixed!important;top:16px!important;right:16px!important;left:auto!important;width:min(382px,calc(100vw - 24px))!important;max-width:382px!important;height:auto!important;max-height:calc(100dvh - 32px)!important;display:flex!important;flex-direction:column!important;gap:9px!important;align-items:stretch!important;z-index:130000!important;pointer-events:none!important;background:transparent!important}
.toast.gh27-toast{position:relative!important;width:100%!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:66px!important;max-height:128px!important;padding:10px 10px!important;margin:0!important;display:grid!important;grid-template-columns:40px minmax(0,1fr) 26px!important;gap:9px!important;align-items:center!important;border-radius:15px!important;background:rgba(252,254,255,.95)!important;border:1px solid rgba(211,225,243,.96)!important;color:#17375f!important;box-shadow:0 16px 42px rgba(12,45,87,.16)!important;backdrop-filter:blur(16px) saturate(1.15)!important;-webkit-backdrop-filter:blur(16px) saturate(1.15)!important;overflow:hidden!important;pointer-events:auto!important}
.gh27-toast-icon{width:40px!important;height:40px!important;border-radius:11px!important}.gh27-toast-copy{min-width:0!important;overflow:hidden!important}.toast.gh27-toast strong{font-size:.75rem!important}.toast.gh27-toast p{font-size:.66rem!important;line-height:1.38!important;display:-webkit-box!important;-webkit-line-clamp:3!important;-webkit-box-orient:vertical!important;overflow:hidden!important}.gh27-toast-close{width:26px!important;height:26px!important}
@media(max-width:620px){.toast-host{top:8px!important;right:8px!important;width:calc(100vw - 16px)!important;max-width:none!important}.toast.gh27-toast{min-height:62px!important}}

/* Login mais visual, sem cards artificiais */
.gh26-login-visual-overlay{background:linear-gradient(105deg,rgba(3,35,77,.58) 0%,rgba(5,68,143,.42) 48%,rgba(9,114,255,.28) 100%)!important;backdrop-filter:blur(.35px)!important}
.gh26-login-visual-image{filter:saturate(.93) contrast(1.03) brightness(.94)!important}
.gh26-visual-head>span,.gh26-visual-tag,.gh27-login-benefits{display:none!important}
.gh28-login-copy{position:relative;z-index:3;margin:auto 0 54px;max-width:650px}.gh28-login-copy>span{display:block;font-size:.72rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:rgba(255,255,255,.76);margin-bottom:9px}.gh28-login-copy h1{margin:0;color:#fff;font-size:clamp(2.5rem,4.8vw,4.9rem);line-height:.96;letter-spacing:-.052em;text-shadow:0 10px 30px rgba(0,28,70,.2)}.gh28-login-copy p{margin:13px 0 0;color:rgba(255,255,255,.84);max-width:580px;font-size:.86rem;line-height:1.6}.gh28-typing-line{display:flex!important;align-items:center!important;gap:7px!important;margin-top:20px!important;font-size:clamp(.9rem,1.3vw,1.12rem)!important;font-weight:760!important;color:#fff!important;letter-spacing:0!important;text-transform:none!important}.gh28-typing-line:after{content:"";width:2px;height:1.05em;background:#fff;animation:gh28Caret .75s steps(1) infinite}@keyframes gh28Caret{50%{opacity:0}}
@media(max-width:760px){.gh28-login-copy{margin:auto 0 10px;max-width:72%}.gh28-login-copy>span{display:none}.gh28-login-copy h1{font-size:1.48rem}.gh28-login-copy p{display:none}.gh28-typing-line{display:flex!important;font-size:.72rem!important;margin-top:8px!important;max-width:100%!important}}

/* Loading rápido e leve */
.gh-page-loader .gh-loader-logo{width:min(152px,46vw)!important;margin-bottom:20px!important}.gh-page-loader .gh-loader-motion{width:40px!important;height:40px!important;animation-duration:.62s!important}.gh27-loader-brand:after{animation-duration:1s!important}.gh27-loading-ring{width:42px!important;height:42px!important;animation-duration:.62s!important}

/* Preview grande no desktop */
@media(min-width:900px){.modal-lg{width:min(1320px,calc(100vw - 28px))!important;max-height:calc(100dvh - 24px)!important}.gh27-document-preview,.gh27-document-preview iframe{min-height:82dvh!important;height:82dvh!important}.gh27-document-preview img{max-height:82dvh!important}}

/* Monitoramento admin */
.gh28-monitor-hero{display:grid;grid-template-columns:52px minmax(0,1fr) auto;gap:14px;align-items:center;padding:17px;margin-bottom:14px}.gh28-monitor-hero>span:first-child{width:52px;height:52px;border-radius:13px;background:#eaf4ff;color:#0972ff;display:grid;place-items:center}.gh28-monitor-hero h2{margin:2px 0 4px;font-size:1.16rem}.gh28-monitor-hero p{margin:0;color:var(--gh-muted);font-size:.72rem}.gh28-monitor-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px}.gh28-monitor-card{padding:14px}.gh28-monitor-card-head{display:flex;align-items:center;gap:8px}.gh28-monitor-card-head span{width:34px;height:34px;border-radius:9px;background:#edf5ff;color:#0972ff;display:grid;place-items:center}.gh28-monitor-card small{display:block;color:#869ab2;font-size:.6rem}.gh28-monitor-card strong{display:block;margin-top:12px;font-size:1rem;color:#173f70}.gh28-monitor-card p{margin:4px 0 0;font-size:.64rem;line-height:1.4;color:#7489a3}.gh28-monitor-log{margin-top:14px}.gh28-monitor-row{display:grid;grid-template-columns:90px 110px minmax(0,1fr) 140px;gap:10px;align-items:center;padding:10px;border-bottom:1px solid #edf2f8;font-size:.68rem}.gh28-monitor-row:last-child{border-bottom:0}.gh28-monitor-status{display:inline-flex;width:max-content;padding:4px 7px;border-radius:999px;background:#ecfaf4;color:#087c57;font-weight:800}.gh28-monitor-status.warn{background:#fff7e8;color:#9b6909}.gh28-monitor-status.error{background:#fff0f2;color:#b62d3b}.gh28-monitor-actions{display:flex;gap:7px;flex-wrap:wrap}.gh28-cache-note{font-size:.65rem;color:#7a91aa;line-height:1.45;margin-top:7px}
@media(max-width:1100px){.gh28-monitor-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:700px){.gh28-monitor-hero{grid-template-columns:44px minmax(0,1fr)}.gh28-monitor-hero>.gh28-monitor-actions{grid-column:1/-1}.gh28-monitor-grid{grid-template-columns:1fr}.gh28-monitor-row{grid-template-columns:1fr;gap:4px;padding:11px 8px}.gh28-monitor-row>*{min-width:0}}

/* Dark/SST compatibilidade mobile e popovers */
html[data-gh-theme="escuro"] .top-company-popover,html[data-gh-theme="escuro"] .modal-head{background:#2b2f36!important;border-color:#404650!important;color:#f2f5f8!important}html[data-gh-theme="escuro"] .top-company-popover-actions a,html[data-gh-theme="escuro"] .top-company-popover-actions button{color:#d8e0e9!important}html[data-gh-theme="escuro"] .toast.gh27-toast{background:rgba(43,47,54,.97)!important;border-color:#454c56!important;color:#fff!important}html[data-gh-theme="escuro"] .toast.gh27-toast strong{color:#fff!important}html[data-gh-theme="escuro"] .toast.gh27-toast p{color:#c2ccd8!important}
html[data-gh-theme="sst"] .gh27-social-icon:hover{background:#0d9662!important;border-color:#0d9662!important}

/* Drawer administrativo no mobile segue a mesma lógica estável */
@media(max-width:860px){
  .admin-sidebar{position:fixed!important;inset:0 auto 0 0!important;width:min(310px,88vw)!important;height:100dvh!important;max-height:100dvh!important;transform:translate3d(-105%,0,0)!important;transition:transform .25s cubic-bezier(.2,.8,.2,1)!important;z-index:1100!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;padding-bottom:max(10px,env(safe-area-inset-bottom))!important}
  .admin-sidebar.open{transform:translate3d(0,0,0)!important}
  .admin-sidebar .sidebar-brand{display:flex!important;justify-content:space-between!important;align-items:center!important;flex:0 0 58px!important}.admin-sidebar .mobile-sidebar-close{display:grid!important;width:38px;height:38px;border:1px solid rgba(255,255,255,.12);border-radius:10px;background:rgba(255,255,255,.06);color:#fff;place-items:center}
  .admin-sidebar .sidebar-nav{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important}.admin-sidebar .sidebar-foot{flex:0 0 auto!important;margin-top:0!important}
}
.monitor-warning{border-color:#f1cfd4!important;background:#fffafb!important}.monitor-warning .gh28-monitor-card-head span{background:#fff0f2!important;color:#bd3545!important}

/* O GranHub mantém microanimações leves também em desktop/tablet. */
html.gh27-motion-enabled .gh27-motion-item{transition:opacity .46s cubic-bezier(.2,.8,.2,1),transform .46s cubic-bezier(.2,.8,.2,1),box-shadow .22s ease,border-color .22s ease!important}
@media(prefers-reduced-motion:reduce){
  html.gh27-motion-enabled .gh27-motion-item{transition-duration:.28s!important}
  .btn,.icon-btn,.nav-link,.service-shortcut{transition-duration:.18s!important}
}
