/* Prime Transportes v66 - Mobile real sem alterar desktop
   Atua somente até 900px. Desktop continua usando o style.css original. */
@media screen and (max-width: 900px) {
  html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body,
  body.retro-body {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    overflow-x: hidden !important;
    font-size: 16px;
    background: var(--bg, #98abc0);
  }

  *, *::before, *::after {
    box-sizing: border-box;
  }

  /* Cabeçalho/menu: deixa de ser desktop espremido e vira grade tocável */
  .topbar,
  .site-header,
  body > header {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 8px !important;
    overflow: hidden !important;
  }

  .topbar-inner,
  .site-header > div:first-child,
  body > header > div:first-child {
    width: 100% !important;
    max-width: 100% !important;
  }

  .topbar-inner {
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-height: auto !important;
  }

  .brand-right,
  .brand-left,
  .brand-link {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
  }

  .brand-logo {
    height: 34px !important;
    max-width: min(190px, 52vw) !important;
    object-fit: contain !important;
  }

  .nav-wrap,
  .site-nav,
  body > header nav {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    overflow: visible !important;
  }

  .nav-wrap a,
  .site-nav a,
  body > header nav a {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    padding: 10px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.1 !important;
    font-size: 16px !important;
  }

  /* Área útil: nada pode abrir largura maior que a tela */
  main.container,
  .container,
  .container.wide,
  .report-shell,
  .report-box {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 9px !important;
    padding-right: 9px !important;
    overflow-x: hidden !important;
  }

  .title-bar {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px !important;
    margin: 10px 0 !important;
  }

  .title-bar h2 {
    font-size: 24px !important;
    line-height: 1.15 !important;
  }

  .title-bar .btn,
  .title-bar button,
  .title-bar a.btn {
    width: 100% !important;
    text-align: center !important;
  }

  .panel,
  .card,
  .report-page,
  section {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .panel {
    padding: 14px 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .panel-title {
    font-size: 22px !important;
    line-height: 1.15 !important;
    margin-bottom: 12px !important;
  }

  /* Formulários: uma coluna real no celular */
  .form-grid,
  .form-grid.one-col,
  .horizontal-form,
  .horizontal-form.compact-form,
  .two-col,
  .two-col.horizontal-split,
  .detail-grid,
  .detail-grid.horizontal-4,
  .checkbox-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .form-grid > div,
  .horizontal-form > div,
  .horizontal-form.compact-form > div,
  .full-row,
  .align-end,
  form > div {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: auto !important;
  }

  label {
    font-size: 17px !important;
    line-height: 1.2 !important;
    margin-bottom: 6px !important;
  }

  input,
  select,
  textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    font-size: 18px !important;
    line-height: 1.2 !important;
    padding: 10px 12px !important;
  }

  textarea {
    min-height: 150px !important;
    white-space: pre-wrap !important;
  }

  button,
  .btn,
  input[type="submit"] {
    width: 100%;
    min-height: 48px !important;
    font-size: 18px !important;
    line-height: 1.15 !important;
    padding: 11px 14px !important;
    touch-action: manipulation;
  }

  .action-bar,
  .action-cell {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    white-space: normal !important;
  }

  .action-cell .btn,
  .action-cell button,
  .action-cell form {
    width: 100% !important;
  }

  /* Painel gerencial: impede sobreposição dos cards */
  .stats-grid,
  .stats-grid.horizontal-4,
  .stats-grid.horizontal-7 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .stat-box {
    min-width: 0 !important;
    min-height: 110px !important;
    padding: 12px 8px !important;
    overflow: hidden !important;
  }

  .stat-box strong,
  .stat-box .status-chip {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 34px !important;
    line-height: 1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .stat-box span {
    display: block !important;
    font-size: 15px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }

  /* Tabelas: rolagem fica só dentro da tabela, não na página toda */
  .table-wrap,
  .table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: #fff !important;
  }

  .table-wrap table,
  .table-responsive table,
  table.compact-table,
  table.manut-table,
  .report-table {
    width: max-content !important;
    min-width: 760px !important;
    max-width: none !important;
    table-layout: auto !important;
  }

  th,
  td,
  .table-wrap th,
  .table-wrap td,
  .report-table th,
  .report-table td {
    font-size: 16px !important;
    line-height: 1.25 !important;
    padding: 8px 10px !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  th,
  .nowrap,
  td.nowrap,
  th.nowrap,
  .col-os,
  .col-data,
  .col-placa,
  .col-status,
  .col-tempo,
  .col-km,
  .col-valor,
  .col-total,
  .col-qtd,
  .col-litros,
  .col-ton,
  .col-small {
    white-space: nowrap !important;
  }

  .col-desc,
  .col-descricao,
  .col-obs,
  .col-servico,
  .col-nome,
  .col-email,
  .col-historico,
  .col-wide {
    min-width: 190px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .status-chip {
    min-width: 112px !important;
    padding: 6px 8px !important;
  }

  .hint,
  .section-note,
  .small {
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  .login-panel,
  .login-centered {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media screen and (max-width: 420px) {
  .nav-wrap,
  .site-nav,
  body > header nav,
  .stats-grid,
  .stats-grid.horizontal-4,
  .stats-grid.horizontal-7 {
    grid-template-columns: 1fr !important;
  }

  .brand-logo {
    height: 30px !important;
    max-width: 60vw !important;
  }

  .title-bar h2,
  .panel-title {
    font-size: 21px !important;
  }
}

/* v67 - correção mobile apenas dos botões dentro da coluna Ações.
   A tabela continua rolando horizontalmente, mas os botões não viram blocos deslocados. */
@media screen and (max-width: 900px) {
  td.action-cell,
  .table-wrap td.action-cell,
  .table-responsive td.action-cell,
  .action-cell {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: none !important;
    white-space: nowrap !important;
    padding: 6px 8px !important;
  }

  .action-cell form,
  .table-wrap .action-cell form,
  .table-responsive .action-cell form {
    display: inline-flex !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .action-cell .btn,
  .action-cell button,
  .table-wrap .action-cell .btn,
  .table-wrap .action-cell button,
  .table-responsive .action-cell .btn,
  .table-responsive .action-cell button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
    min-width: 72px !important;
    min-height: 42px !important;
    padding: 8px 10px !important;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
}

/* v72 - ajustes finais para relatório mobile, produção, câmera e vínculo de veículo */
@media screen and (max-width: 900px) {
  .report-mobile-page,
  body.report-body {
    overflow-x: hidden !important;
    background: #9fb1c5 !important;
  }

  .report-geral-box,
  .report-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 10px !important;
    overflow-x: hidden !important;
  }

  .report-title-bar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .report-brand {
    display: grid !important;
    grid-template-columns: 130px 1fr !important;
    gap: 12px !important;
    align-items: center !important;
  }

  .report-brand .brand-logo {
    width: 130px !important;
    max-width: 130px !important;
    height: auto !important;
  }

  .report-brand-title h2 {
    font-size: 24px !important;
    line-height: 1.05 !important;
    margin: 0 !important;
  }

  .report-actions-mobile,
  .report-filter-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .report-checks {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    align-items: start !important;
  }

  .report-checks .check-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px !important;
    border: 1px solid #aeb7c2 !important;
    background: #f4f4f0 !important;
    min-height: 46px !important;
  }

  .report-checks input[type="checkbox"] {
    width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    flex: 0 0 auto !important;
  }

  .section-note {
    font-size: 16px !important;
    line-height: 1.35 !important;
    padding: 10px 6px !important;
  }

  .mini-title-bar h3,
  .report-section h3 {
    font-size: 22px !important;
    line-height: 1.15 !important;
  }

  .hist-pre {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    max-width: 100% !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  .metricas-periodo table,
  .report-section table {
    min-width: 760px !important;
  }

  .producao-panel .hint,
  .meu-veiculo-panel .hint,
  #ocr-status {
    display: block !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
    color: #394a5f !important;
    margin-top: 5px !important;
  }

  .camera-tools {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 12px !important;
  }

  #video-placa {
    width: 100% !important;
    max-height: 48vh !important;
    background: #000 !important;
    border: 2px solid #2b3e55 !important;
  }
}

@media print {
  .no-print, .topbar, #os-alert { display: none !important; }
  body.report-body { background: #fff !important; }
  .report-box, .report-geral-box { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .panel, .report-section { page-break-inside: avoid; }
  .hist-pre { white-space: pre-wrap !important; }
}


/* v87 - Modo aplicativo: menu compacto e sino de notificações */
@media screen and (max-width: 900px) {
  .topbar{position:sticky;top:0;z-index:9000;overflow:visible!important;padding:6px 8px!important}
  .topbar-inner{display:grid!important;grid-template-columns:1fr auto!important;grid-template-areas:"menu logo" "nav nav"!important;align-items:center!important;gap:6px!important}
  .brand-right,.brand-left,.brand-link{grid-area:logo!important;width:auto!important;justify-content:flex-end!important}
  .brand-logo{height:32px!important;max-width:145px!important}
  .app-menu-toggle{grid-area:menu!important;display:inline-flex!important;width:auto!important;min-width:118px!important;max-width:170px!important;min-height:44px!important;align-items:center!important;justify-content:center!important;font-size:17px!important;padding:9px 14px!important}
  .nav-wrap,.site-nav,body > header nav{
    grid-area:nav!important;
    display:none!important;
    grid-template-columns:1fr!important;
    gap:6px!important;
    max-height:calc(100vh - 76px)!important;
    overflow-y:auto!important;
    padding:8px 0 2px!important;
  }
  .nav-wrap.is-open,.site-nav.is-open,body > header nav.is-open{display:grid!important}
  .nav-wrap a,.site-nav a,body > header nav a{min-height:42px!important;font-size:16px!important;padding:9px 10px!important}
  main.container,.container.wide{padding-top:8px!important}
  .os-alert.os-alert-compact{right:12px!important;bottom:12px!important;left:auto!important;width:auto!important;background:transparent!important;padding:0!important;border:0!important;box-shadow:none!important}
  .os-alert-bell{width:52px!important;height:52px!important;min-height:52px!important;border-radius:50%!important;padding:0!important}
  .os-alert-popover{right:0!important;bottom:62px!important;width:min(330px, calc(100vw - 24px))!important}
}

/* v94 */
@media (max-width: 760px) {
  .search-row { flex-direction: column; align-items: stretch; }
  .search-row input, .search-row button { width: 100%; }
  .multi-select { min-height: 140px; }
}


/* v109 - app/mobile: evitar travamento da rolagem ao voltar para o topo */
@media screen and (max-width: 900px) {
  html, body { overflow-x: hidden !important; overflow-y: auto !important; height: auto !important; }
  main.container, .container, .container.wide { overflow: visible !important; height: auto !important; min-height: 100vh !important; }
  .panel .table-wrap, .table-wrap, .table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}


/* v113 - ajustes pontuais: relatórios no celular, compartilhar por cópia e rolagem sem recarregar */
html, body {
  height: auto !important;
  min-height: 100% !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
}
body {
  touch-action: pan-x pan-y !important;
}
.table-wrap,
.table-responsive,
.relatorio-table-wrap,
.report-geral-box .table-wrap,
.report-maint-page .table-wrap {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}
@media screen and (max-width: 700px) {
  .report-actions-mobile,
  .report-maint-actions,
  .report-maint-page .report-head .action-bar,
  .report-title-bar .action-bar,
  .report-geral-box .action-bar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 14px 0 18px 0 !important;
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }
  .report-actions-mobile a,
  .report-actions-mobile button,
  .report-maint-actions a,
  .report-maint-actions button,
  .report-maint-page .report-head .action-bar a,
  .report-maint-page .report-head .action-bar button,
  .report-title-bar .action-bar a,
  .report-title-bar .action-bar button,
  .report-geral-box .action-bar a,
  .report-geral-box .action-bar button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 58px !important;
    min-height: 58px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-align: center !important;
  }
  .report-maint-page .report-head {
    display: grid !important;
    grid-template-columns: 130px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
  }
  .report-maint-page .report-head img {
    width: 130px !important;
    max-width: 130px !important;
  }
  .report-maint-page .report-head h2 {
    font-size: 28px !important;
    line-height: 1.05 !important;
    margin: 0 0 8px 0 !important;
  }
  .report-maint-page .report-head p {
    font-size: 18px !important;
    line-height: 1.2 !important;
  }
  .report-maint-page .report-head .report-maint-actions {
    grid-column: 1 / -1 !important;
    order: 3 !important;
  }
  .report-maint-page .report-shell,
  .report-geral-box,
  .report-box {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    overflow-x: visible !important;
  }
  .report-maint-page table,
  .report-geral-box table,
  .report-section table,
  .metricas-periodo table {
    min-width: 760px !important;
  }
}


/* v114 - celular: tabelas rolam pela página, sem puxar para recarregar por engano */
@media screen and (max-width: 900px) {
  html, body {
    overscroll-behavior-y: none !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100% !important;
  }
  body.report-body,
  body.retro-body {
    overscroll-behavior-y: none !important;
    touch-action: pan-y pinch-zoom !important;
  }
  main.container,
  .container,
  .container.wide,
  .report-maint-page,
  .report-geral-box,
  .report-box {
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
  }
  .table-wrap,
  .table-responsive,
  .relatorio-table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap {
    display: block !important;
    max-height: none !important;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior-x: contain !important;
    overscroll-behavior-y: none !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }
  .table-wrap table,
  .table-responsive table,
  .relatorio-table-wrap table,
  .report-geral-box table,
  .report-maint-page table {
    max-height: none !important;
  }
}

/* v115 - correção real da rolagem no celular: sem trava no retorno para cima */
@media screen and (max-width: 900px) {
  html, body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }
  body.report-body,
  body.retro-body,
  main.container,
  .container,
  .container.wide,
  .report-maint-page,
  .report-geral-box,
  .report-box {
    overflow-y: visible !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    touch-action: auto !important;
  }
  .table-wrap,
  .table-responsive,
  .relatorio-table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap {
    display: block !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    overscroll-behavior-y: auto !important;
    touch-action: auto !important;
  }
}

/* v115 - painel de fallback para compartilhar PDF quando o navegador/apk não aceita anexo direto */
#share-choice-box[hidden] { display: none !important; }
#share-choice-box .share-choice-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  z-index: 9998;
}
#share-choice-box .share-choice-panel {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(360px, calc(100vw - 28px));
  background: #fff;
  color: #111;
  border: 1px solid #9aa8b5;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
#share-choice-box h3 { margin: 0 0 6px 0; font-size: 20px; }
#share-choice-box p { margin: 0 0 12px 0; font-size: 14px; line-height: 1.25; }
#share-choice-box button {
  width: 100%;
  min-height: 48px;
  margin: 6px 0;
  font-size: 17px;
  font-weight: 700;
}
#share-choice-box button.secondary { font-weight: 500; }


/* v116 - correção prioritária: botões de relatório logo abaixo do cabeçalho e rolagem livre no celular */
@media screen and (max-width: 900px) {
  html, body {
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: auto !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }

  body,
  body.report-body,
  body.retro-body,
  main,
  main.container,
  .container,
  .container.wide,
  .report-mobile-page,
  .report-maint-page,
  .report-geral-box,
  .report-box,
  .report-shell,
  .report-section {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: visible !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }

  .report-maint-page .report-head,
  .report-title-bar {
    display: grid !important;
    grid-template-columns: 130px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
  }

  .report-maint-page .report-head img,
  .report-brand .brand-logo {
    width: 130px !important;
    max-width: 130px !important;
    height: auto !important;
  }

  .report-maint-actions,
  .report-maint-actions-top,
  .report-actions-mobile,
  .report-title-bar .action-bar,
  .report-geral-box .action-bar,
  .report-maint-page .action-bar,
  .report-maint-page .report-head .action-bar {
    grid-column: 1 / -1 !important;
    order: 99 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 14px 0 20px 0 !important;
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .report-maint-actions a,
  .report-maint-actions button,
  .report-actions-mobile a,
  .report-actions-mobile button,
  .report-title-bar .action-bar a,
  .report-title-bar .action-bar button,
  .report-geral-box .action-bar a,
  .report-geral-box .action-bar button,
  .report-maint-page .action-bar a,
  .report-maint-page .action-bar button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 58px !important;
    height: 58px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-align: center !important;
  }

  .table-wrap,
  .table-responsive,
  .relatorio-table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    overscroll-behavior-y: auto !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }

  .table-wrap table,
  .table-responsive table,
  .relatorio-table-wrap table,
  .report-geral-box table,
  .report-maint-page table {
    min-width: 760px !important;
  }
}


/* v117 - tentativa anterior da rolagem no celular/APK
   Mantém o visual atual; apenas impede que a tabela "prenda" o toque vertical. */
@media screen and (max-width: 900px) {
  html, body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overscroll-behavior-y: none !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y pinch-zoom !important;
  }

  body,
  body.report-body,
  body.retro-body,
  main,
  main.container,
  .container,
  .container.wide,
  .report-mobile-page,
  .report-maint-page,
  .report-geral-box,
  .report-box,
  .report-shell,
  .report-section {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: visible !important;
    overscroll-behavior-y: none !important;
  }

  .table-wrap,
  .table-responsive,
  .relatorio-table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    overscroll-behavior-y: none !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }
}


/* v118 - correção cirúrgica da rolagem mobile
   Visual preservado. Remove a rolagem vertical interna das tabelas e deixa o body controlar a subida/descida. */
@media screen and (max-width: 900px) {
  html {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y pinch-zoom !important;
  }

  body {
    position: relative !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: auto !important;
    touch-action: pan-y pinch-zoom !important;
  }

  body.report-body,
  body.retro-body,
  main,
  main.container,
  .container,
  .container.wide,
  .report-mobile-page,
  .report-maint-page,
  .report-geral-box,
  .report-box,
  .report-shell,
  .report-section,
  .panel,
  .maintenance-board {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: visible !important;
    overscroll-behavior-y: contain !important;
  }

  .table-wrap,
  .table-responsive,
  .relatorio-table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap,
  .retro-body .panel .table-wrap,
  .retro-body .report-section .table-wrap,
  .maintenance-board .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior-x: contain !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }

  .table-wrap table,
  .table-responsive table,
  .relatorio-table-wrap table,
  .report-geral-box table,
  .report-maint-page table {
    min-width: 760px !important;
  }

  .os-alert,
  .os-alert.os-alert-compact {
    touch-action: manipulation !important;
  }
}


/* v119 - CORREÇÃO DEFINITIVA DE ROLAGEM MOBILE
   Não usa JavaScript para rolar. Não bloqueia touchmove.
   Regra: a página rola verticalmente; tabelas só ajudam no deslocamento horizontal. */
@media screen and (max-width: 900px) {
  html,
  body {
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: auto !important;
  }

  body,
  body.report-body,
  body.retro-body,
  main,
  main.container,
  .container,
  .container.wide,
  .content,
  .page,
  .panel,
  .report-mobile-page,
  .report-maint-page,
  .report-geral-box,
  .report-box,
  .report-shell,
  .report-section,
  .maintenance-board,
  .central-relatorios {
    position: static !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: auto !important;
  }

  .table-wrap,
  .table-responsive,
  .relatorio-table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap,
  .retro-body .panel .table-wrap,
  .retro-body .report-section .table-wrap,
  .maintenance-board .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-x: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: auto !important;
  }

  .table-wrap table,
  .table-responsive table,
  .relatorio-table-wrap table,
  .report-geral-box table,
  .report-maint-page table,
  .maintenance-board table {
    min-width: 760px !important;
    max-height: none !important;
    touch-action: auto !important;
  }

  .os-alert,
  .os-alert * {
    touch-action: manipulation !important;
  }
}


/* v126 - estética mobile dos relatórios sem alterar a rolagem funcional da v119 */
@media screen and (max-width: 900px) {
  .report-title-bar,
  .report-maint-page .report-head {
    display: grid !important;
    grid-template-columns: 130px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
  }
  .report-brand .brand-logo,
  .report-maint-page .report-head img {
    width: 130px !important;
    max-width: 130px !important;
    height: auto !important;
  }
  .report-brand-title h2,
  .report-maint-page .report-head h2 {
    font-size: 28px !important;
    line-height: 1.05 !important;
    margin: 0 0 8px 0 !important;
  }
  .report-meta,
  .report-maint-page .report-head p { font-size: 18px !important; line-height: 1.2 !important; }
  .report-title-bar .action-bar,
  .report-actions-mobile,
  .report-maint-actions-top {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 14px 0 20px 0 !important;
    padding: 0 !important;
  }
  .report-title-bar .action-bar a,
  .report-title-bar .action-bar button,
  .report-actions-mobile a,
  .report-actions-mobile button,
  .report-maint-actions-top a,
  .report-maint-actions-top button {
    width: 100% !important;
    min-height: 58px !important;
    height: 58px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
  }
}


/* v129 - CORREÇÃO URGENTE: rolagem no PC e preservação da rolagem mobile v119
   Não usa JavaScript. Remove travas de altura/overflow em páginas de relatório. */
@media screen {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    overscroll-behavior: auto !important;
    touch-action: auto !important;
  }

  body.report-body,
  body.report-mobile-page,
  body.retro-body,
  main,
  main.container,
  .container,
  .container.wide,
  .content,
  .page,
  .panel,
  .report-box,
  .report-shell,
  .report-geral-box,
  .report-maint-page,
  .report-mobile-page,
  .report-section,
  .central-relatorios,
  .maintenance-board {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  .report-box .table-wrap,
  .report-geral-box .table-wrap,
  .report-maint-page .table-wrap,
  .report-section .table-wrap,
  .central-relatorios .table-wrap,
  .panel .table-wrap,
  .maintenance-board .table-wrap,
  .table-responsive,
  .relatorio-table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: auto !important;
    touch-action: auto !important;
  }
}

@media screen and (min-width: 901px) {
  /* No desktop, nada pode esconder a rolagem vertical da página. */
  body,
  main,
  main.container,
  .container,
  .container.wide,
  .report-box,
  .report-geral-box,
  .report-section,
  .panel {
    overflow-y: visible !important;
    max-height: none !important;
  }
}
