/* SISTEMA DE GERENCIAMENTO OPERACIONAL
   V1.03.8.48 - UX mobile: filtros em bottom sheet + scroll único + correções visuais.
   Escopo exclusivamente mobile. Desktop permanece intacto. */
@media (max-width:900px) {
  html.sgo-mobile-native-v846,
  html.sgo-mobile-native-v846 body {
    min-height:100dvh!important;
    height:auto!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-y:contain!important;
    scroll-behavior:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }

  html.sgo-mobile-native-v846 body.sgo48-filter-open { overflow:hidden!important; }

  /* O filtro inline antigo não ocupa mais a tela. O ícone do cabeçalho abre a gaveta. */
  html.sgo-mobile-native-v846 #menuHost .mobile-filter-toggle-v124 { display:none!important; }
  html.sgo-mobile-native-v846 #menuHost .mobile-collapsible-v124.mobile-collapsed-v124 { display:none!important; }

  /* Conteúdo principal com uma única rolagem vertical, sem “scroll dentro de scroll”. */
  html.sgo-mobile-native-v846 #appView,
  html.sgo-mobile-native-v846 #appView .main,
  html.sgo-mobile-native-v846 #menuHost,
  html.sgo-mobile-native-v846 #menuHost > *,
  html.sgo-mobile-native-v846 .det-page,
  html.sgo-mobile-native-v846 .gos-page,
  html.sgo-mobile-native-v846 .materiais-page,
  html.sgo-mobile-native-v846 .fac-page,
  html.sgo-mobile-native-v846 .monit-page,
  html.sgo-mobile-native-v846 .disp-page {
    overflow-x:hidden!important;
    overflow-y:visible!important;
    height:auto!important;
    max-height:none!important;
  }

  html.sgo-mobile-native-v846 #menuHost {
    padding-bottom:8px!important;
    touch-action:pan-y!important;
  }

  html.sgo-mobile-native-v846 .table-shell,
  html.sgo-mobile-native-v846 .table-wrap,
  html.sgo-mobile-native-v846 .table-container,
  html.sgo-mobile-native-v846 .gos-table-shell,
  html.sgo-mobile-native-v846 .fac-table-shell,
  html.sgo-mobile-native-v846 .materiais-table-shell,
  html.sgo-mobile-native-v846 .monit-audit-table-wrap,
  html.sgo-mobile-native-v846 .mat-consulta-table-wrap {
    max-height:none!important;
    height:auto!important;
    overflow:visible!important;
    overscroll-behavior:auto!important;
    -webkit-overflow-scrolling:auto!important;
  }

  /* Componentes que realmente precisam de eixo horizontal ficam explícitos e curtos. */
  html.sgo-mobile-native-v846 .gos-tabs,
  html.sgo-mobile-native-v846 .mat-view-switcher,
  html.sgo-mobile-native-v846 .monit-queue-filters,
  html.sgo-mobile-native-v846 .det-toolbar-actions,
  html.sgo-mobile-native-v846 .fac-tabs,
  html.sgo-mobile-native-v846 .mobile-report-shortcuts-v103847 {
    overflow-x:auto!important;
    overflow-y:hidden!important;
    max-width:100%!important;
    scrollbar-width:none!important;
    overscroll-behavior-inline:contain!important;
    scroll-snap-type:x proximity!important;
    -webkit-overflow-scrolling:touch!important;
  }
  html.sgo-mobile-native-v846 .gos-tabs::-webkit-scrollbar,
  html.sgo-mobile-native-v846 .mat-view-switcher::-webkit-scrollbar,
  html.sgo-mobile-native-v846 .monit-queue-filters::-webkit-scrollbar,
  html.sgo-mobile-native-v846 .det-toolbar-actions::-webkit-scrollbar,
  html.sgo-mobile-native-v846 .fac-tabs::-webkit-scrollbar { display:none!important; }
  html.sgo-mobile-native-v846 .gos-tabs > *,
  html.sgo-mobile-native-v846 .mat-view-switcher > *,
  html.sgo-mobile-native-v846 .monit-queue-filters > *,
  html.sgo-mobile-native-v846 .det-toolbar-actions > *,
  html.sgo-mobile-native-v846 .fac-tabs > * { flex:0 0 auto!important; scroll-snap-align:start!important; }

  /* Menos altura desperdiçada em heros/cabeçalhos internos. */
  html.sgo-mobile-native-v846 .gos-hero,
  html.sgo-mobile-native-v846 .mat-command-hero-p26,
  html.sgo-mobile-native-v846 .fac-hero,
  html.sgo-mobile-native-v846 .monit-command-hero,
  html.sgo-mobile-native-v846 .status-hero-v166 {
    min-height:0!important;
    padding:11px!important;
    margin-bottom:8px!important;
    border-radius:14px!important;
  }
  html.sgo-mobile-native-v846 .gos-hero h2,
  html.sgo-mobile-native-v846 .mat-command-hero-p26 h2,
  html.sgo-mobile-native-v846 .fac-hero h2 { font-size:17px!important; line-height:1.15!important; }
  html.sgo-mobile-native-v846 .gos-hero p,
  html.sgo-mobile-native-v846 .mat-command-hero-p26 p,
  html.sgo-mobile-native-v846 .fac-hero p { font-size:10px!important; line-height:1.35!important; }

  /* Alocação: filtros/status deixam de empurrar o grid para baixo. */
  html.sgo-mobile-native-v846 .det-toolbar {
    margin:0 0 7px!important;
    min-height:0!important;
    padding:0!important;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
  }
  html.sgo-mobile-native-v846 .det-toolbar .det-status-legend { display:none!important; }
  html.sgo-mobile-native-v846 .det-toolbar-actions {
    display:flex!important;
    gap:6px!important;
    padding:0 0 2px!important;
    white-space:nowrap!important;
  }
  html.sgo-mobile-native-v846 .det-toolbar-actions .btn { min-height:37px!important; padding:7px 9px!important; font-size:9px!important; }

  /* Filtros movidos para a gaveta recebem layout vertical e confortável. */
  .sgo48-filter-backdrop {
    position:fixed; inset:0; z-index:3350; display:none; align-items:flex-end; justify-content:center;
    background:rgba(3,22,15,.5); backdrop-filter:blur(3px);
  }
  .sgo48-filter-backdrop.open { display:flex; }
  .sgo48-filter-sheet {
    width:min(100%,520px); max-height:86dvh; display:flex; flex-direction:column;
    border-radius:22px 22px 0 0; background:#f3f6f4; box-shadow:0 -22px 70px rgba(3,31,21,.28);
    overflow:hidden;
  }
  .sgo48-filter-head {
    flex:0 0 auto; display:grid; grid-template-columns:minmax(0,1fr) 38px; gap:8px; align-items:center;
    padding:11px 12px 9px; color:#fff; background:linear-gradient(120deg,#07382b,#0b4a37 58%,#116245);
  }
  .sgo48-filter-head b { display:block; font-size:13px; line-height:1.15; }
  .sgo48-filter-head small { display:block; margin-top:3px; color:#cfe2d9; font-size:8.5px; }
  .sgo48-filter-close { width:36px; height:36px; border:1px solid rgba(255,255,255,.16); border-radius:10px; background:rgba(255,255,255,.08); color:#fff; font-size:21px; }
  .sgo48-filter-body {
    flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden; padding:10px 10px 12px;
    overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  }
  .sgo48-filter-body > .sgo48-filter-section,
  .sgo48-filter-body > .filters,
  .sgo48-filter-body > .mobile-collapsible-v124,
  .sgo48-filter-body > section,
  .sgo48-filter-body > div {
    width:100%!important; max-width:100%!important; margin:0 0 9px!important;
  }
  .sgo48-filter-body .mobile-collapsible-v124,
  .sgo48-filter-body .mobile-collapsible-v124.mobile-collapsed-v124 { display:grid!important; }
  .sgo48-filter-body .consultas-filters,
  .sgo48-filter-body .det-filters,
  .sgo48-filter-body .disp-filters,
  .sgo48-filter-body .gos-filters,
  .sgo48-filter-body .fac-filters,
  .sgo48-filter-body .materiais-filters,
  .sgo48-filter-body .monit-filters,
  .sgo48-filter-body .monit-dashboard-filters {
    display:grid!important; grid-template-columns:1fr!important; gap:8px!important; padding:0!important;
    overflow:visible!important; max-height:none!important; height:auto!important;
  }
  .sgo48-filter-body .det-status-legend {
    display:flex!important; flex-wrap:wrap!important; gap:6px!important; padding:8px!important;
    background:#fff!important; border:1px solid #dce6e1!important; border-radius:12px!important;
  }
  .sgo48-filter-body .det-status-filter { flex:1 1 44%!important; min-height:38px!important; font-size:9px!important; }
  .sgo48-filter-body input,
  .sgo48-filter-body select,
  .sgo48-filter-body textarea,
  .sgo48-filter-body .ms-filter-button { min-height:44px!important; font-size:16px!important; }
  .sgo48-filter-foot {
    flex:0 0 auto; display:grid; grid-template-columns:1fr 1fr; gap:8px;
    padding:9px 10px calc(9px + env(safe-area-inset-bottom,0px)); border-top:1px solid #dce6e1; background:#fff;
  }
  .sgo48-filter-foot button { min-height:42px; border-radius:10px; font-size:10px; font-weight:850; }
  .sgo48-filter-foot .sgo48-filter-done { border:1px solid #197a51; background:#197a51; color:#fff; }
  .sgo48-filter-foot .sgo48-filter-clear { border:1px solid #d7e2dd; background:#fff; color:#43564d; }

  /* Indicador discreto de filtros ativos no botão do cabeçalho. */
  html.sgo-mobile-native-v846 [data-sgo-mobile-filter] { position:relative!important; }
  html.sgo-mobile-native-v846 [data-sgo-mobile-filter][data-sgo48-count]:not([data-sgo48-count="0"])::after {
    content:attr(data-sgo48-count); position:absolute; right:-3px; top:-3px; min-width:16px; height:16px; padding:0 4px;
    display:grid; place-items:center; border-radius:999px; background:#f0b429; color:#233128; border:2px solid #0d3d2e;
    font-size:8px; font-weight:950; line-height:1;
  }

  /* Redução de quebras e estouros visuais. */
  html.sgo-mobile-native-v846 * { min-width:0; }
  html.sgo-mobile-native-v846 img, html.sgo-mobile-native-v846 svg, html.sgo-mobile-native-v846 canvas { max-width:100%; }
  html.sgo-mobile-native-v846 .card,
  html.sgo-mobile-native-v846 .gos-card,
  html.sgo-mobile-native-v846 .fac-card,
  html.sgo-mobile-native-v846 .monit-card,
  html.sgo-mobile-native-v846 .materiais-chart-card,
  html.sgo-mobile-native-v846 .mat-filter-panel,
  html.sgo-mobile-native-v846 .gos-filter-panel,
  html.sgo-mobile-native-v846 .fac-filter-panel { margin-bottom:8px!important; }

  /* A antiga barra “deslize/tela cheia” some quando a tabela já virou card. */
  html.sgo-mobile-native-v846 .mobile-table-toolbar-v124:has(+ table.sgo-mobile-card-table-v846),
  html.sgo-mobile-native-v846 .mobile-table-toolbar-v124:has(~ table.sgo-mobile-card-table-v846) { display:none!important; }
}
