/* SouPrimeiroAC V22.3.27 / build 2350 — Android compatibility hardening.
   Loaded after historical CSS. The sentinel :not() IDs intentionally do not exist:
   they only raise specificity so old ID + !important hotfixes cannot shrink touch targets. */

html[data-device-family="android"]{
  --spac-touch-target:46px;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
html[data-device-family="android"] body{
  min-height:var(--device-safe-vh,100dvh)!important;
  padding-bottom:max(env(safe-area-inset-bottom),0px);
}

html[data-device-family="android"] body
:is(button,.btn,a.btn,[role="button"],[data-action],[data-op],[data-tab],[data-page]):not(#__spac_touch_guard_a):not(#__spac_touch_guard_b){
  min-width:var(--spac-touch-target)!important;
  min-height:var(--spac-touch-target)!important;
  touch-action:manipulation;
  -webkit-tap-highlight-color:rgba(255,212,0,.14);
}
html[data-device-family="android"] body
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea):not(#__spac_field_guard_a):not(#__spac_field_guard_b){
  min-height:var(--spac-touch-target)!important;
  font-size:16px!important;
  scroll-margin-top:calc(116px + env(safe-area-inset-top));
  scroll-margin-bottom:min(36dvh,280px);
}
html[data-device-family="android"] body
:is(.remember-row,.terms-row,.signup-plan-card,.admin-check,.admin-switch,.admin-auto-trigger,.import-history-toggle,.job-time-toggle,#quotePackageLabel):not(#__spac_check_guard_a):not(#__spac_check_guard_b){
  min-height:var(--spac-touch-target)!important;
  touch-action:manipulation;
}
html[data-device-family="android"] :is(summary,label.workflow-photo-name-upload){
  min-height:var(--spac-touch-target)!important;
  touch-action:manipulation;
}

/* Texto que hotfixes antigos comprimiam para 8–10 px. */
html[data-device-family="android"] body #notificationsDialog:is(#notificationsDialog) :is(.notifications-actions .btn,.notification-setup-actions .btn),
html[data-device-family="android"] body #orcamentoView:is(#orcamentoView) .quote-summary-actions .btn,
html[data-device-family="android"] body #shareJobDialog:is(#shareJobDialog) .btn,
html[data-device-family="android"] body #bhImportDialog:is(#bhImportDialog) .bh-results-toggle{
  font-size:12px!important;
  line-height:1.15!important;
}

html[data-device-family="android"] dialog[open]{
  max-width:calc(100vw - 12px)!important;
  max-height:calc(var(--device-safe-vh,100dvh) - max(12px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom)))!important;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
html[data-device-family="android"] :is(.dialog-card,.upgrade-card,.project-hub-card,.bh-catalog-card){max-width:100%}
html[data-device-family="android"] :is(.so-tabs,.set-mode-tabs,.pro-tabs,.camera-filter-row,.tech-filter-row,.report-presets){
  touch-action:pan-x;
  overscroll-behavior-inline:contain;
}
html[data-device-family="android"] :is(.equipment-card,.catalog-card,.camera-list-item,.tech-list-item,.report-calendar-job,.report-period-job){touch-action:manipulation}
html[data-device-family="android"] img,
html[data-device-family="android"] video,
html[data-device-family="android"] canvas{max-width:100%}

/* Standalone offline/portal pages do not load app.js, so coarse pointer is the fallback. */
@media (pointer:coarse) and (max-width:1100px){
  body{min-height:100dvh}
  body :is(button,.btn,a.btn,[role="button"]):not(#__spac_coarse_touch_a):not(#__spac_coarse_touch_b){
    min-width:46px!important;
    min-height:46px!important;
    touch-action:manipulation;
  }
  body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea):not(#__spac_coarse_field_a):not(#__spac_coarse_field_b){
    min-height:46px!important;
    font-size:16px!important;
  }
  body :is(.remember-row,.terms-row,.signup-plan-card,.admin-check,.admin-switch,.admin-auto-trigger,.import-history-toggle,.job-time-toggle,#quotePackageLabel):not(#__spac_coarse_check_a):not(#__spac_coarse_check_b){
    min-height:46px!important;
    touch-action:manipulation;
  }
  dialog[open]{
    max-width:calc(100vw - 12px)!important;
    max-height:calc(100dvh - 16px)!important;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
  }
}

@media (orientation:landscape) and (pointer:coarse) and (max-height:560px){
  html[data-device-family="android"] :is(input,select,textarea){scroll-margin-bottom:46dvh}
  html[data-device-family="android"] dialog[open]{max-height:calc(var(--device-safe-vh,100dvh) - 8px)!important}
}
html[data-device-family="android"] body :is(.password-toggle,#forgotPasswordBtn){font-size:12px!important;line-height:1.15!important}
@media (pointer:coarse) and (max-width:1100px){body :is(.password-toggle,#forgotPasswordBtn){font-size:12px!important;line-height:1.15!important}}
