/* MAXPDV 5.8.0 · camada responsiva global para celular, tablet e desktop */
:root{
  --adaptive-content-max:1600px;
  --adaptive-gutter-desktop:28px;
  --adaptive-gutter-tablet:18px;
  --adaptive-gutter-mobile:11px;
  --adaptive-touch:44px;
  --adaptive-line:#e2e8f0;
  --adaptive-muted:#64748b;
  --adaptive-surface:#fff;
  --adaptive-soft:#f8fafc;
  --adaptive-shadow:0 8px 26px rgba(15,23,42,.07)
}

html{width:100%;max-width:100%;overflow-x:clip;-webkit-text-size-adjust:100%}
body:not(.immersive-pdv){min-width:320px;max-width:100%;overflow-x:clip}
body:not(.immersive-pdv) *,body:not(.immersive-pdv) *::before,body:not(.immersive-pdv) *::after{box-sizing:border-box}
body:not(.immersive-pdv) :where(main,section,article,aside,header,footer,nav,form,fieldset,div,label,dl,details){min-width:0}
body:not(.immersive-pdv) :where(img,svg,video,canvas,iframe){max-width:100%;height:auto}
body:not(.immersive-pdv) :where(p,small,dd,td,th,a,b,strong,span){overflow-wrap:anywhere}
body:not(.immersive-pdv) :where(button,a,[role="button"],summary){touch-action:manipulation;-webkit-tap-highlight-color:transparent}
body:not(.immersive-pdv) :where(input,select,textarea){max-width:100%}

/* Conteúdo e superfícies fluidas */
body.maxpdv-brand:not(.immersive-pdv) .commercial-content,
body.admin-theme .content{width:100%!important;max-width:var(--adaptive-content-max)!important;margin-inline:auto!important}
body:not(.immersive-pdv) :where(.panel,.card,[class$="-panel"],[class$="-card"]){max-width:100%}
body:not(.immersive-pdv) :where(.panel-head,[class$="-head"],.toolbar,.form-actions,.document-actions,.quick-actions){min-width:0}
body:not(.immersive-pdv) :where(.panel-head,[class$="-head"])>div{min-width:0}
body:not(.immersive-pdv) :where(.panel-head,[class$="-head"]) h1,
body:not(.immersive-pdv) :where(.panel-head,[class$="-head"]) h2,
body:not(.immersive-pdv) :where(.panel-head,[class$="-head"]) h3{max-width:100%;text-wrap:balance}

/* Tabelas: nenhuma página pode aumentar a largura da viewport */
body:not(.immersive-pdv) :where(.table-wrap,.table-responsive,[class*="-table-wrap"],.adaptive-table-wrap){
  position:relative;width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden;
  overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;
  scrollbar-color:#b9c5d2 transparent
}
body:not(.immersive-pdv) :where(.table-wrap,.table-responsive,[class*="-table-wrap"],.adaptive-table-wrap)::-webkit-scrollbar{height:8px}
body:not(.immersive-pdv) :where(.table-wrap,.table-responsive,[class*="-table-wrap"],.adaptive-table-wrap)::-webkit-scrollbar-thumb{border:2px solid transparent;border-radius:999px;background:#b9c5d2;background-clip:padding-box}
body:not(.immersive-pdv) .adaptive-table-wrap{border:1px solid var(--adaptive-line);border-radius:12px;background:#fff}
body:not(.immersive-pdv) .adaptive-table-wrap>table{width:100%;min-width:680px;margin:0}
body:not(.immersive-pdv) .adaptive-scroll-region{scroll-padding-inline:12px}
body:not(.immersive-pdv) .adaptive-scroll-region.is-overflowing{box-shadow:inset -12px 0 12px -14px rgba(15,23,42,.32)}
body:not(.immersive-pdv) .adaptive-scroll-region:focus-visible{outline:3px solid rgba(37,99,235,.24)!important;outline-offset:3px!important}
body:not(.immersive-pdv) table{font-variant-numeric:tabular-nums}

/* Formulários e ações compartilhados */
body:not(.immersive-pdv) :where(.form-grid,.dialog-grid,.suite-form-grid,.finance-filter-grid,.finance-dialog-grid,.purchase-meta-grid,.purchase-cost-grid,.purchase-finance-grid,.store-settings-grid)>*{min-width:0}
body:not(.immersive-pdv) :where(.form-actions,.toolbar,.quick-actions,.document-actions,.split-actions,.inline-form,.report-filter,.customer-row-actions,.service-show-actions){max-width:100%}
body:not(.immersive-pdv) :where(.form-actions,.toolbar,.quick-actions,.document-actions,.split-actions,.inline-form,.report-filter,.customer-row-actions,.service-show-actions)>*{min-width:0}
body:not(.immersive-pdv) :where(.btn,button,input[type="button"],input[type="submit"],summary){white-space:normal}
body:not(.immersive-pdv) :where(.money-input,.document-field,.select-with-action,.product-code-field,.purchase-supplier-control){max-width:100%;min-width:0}
body:not(.immersive-pdv) :where(.money-input,.document-field,.select-with-action,.product-code-field,.purchase-supplier-control)>:first-child{min-width:0}

/* Diálogos sempre cabem na tela disponível */
body:not(.immersive-pdv) dialog.adaptive-dialog{max-width:calc(100vw - 24px);max-height:calc(var(--adaptive-viewport-height,100dvh) - 24px);overscroll-behavior:contain}
body:not(.immersive-pdv) dialog.adaptive-dialog>:first-child{max-width:100%;max-height:calc(var(--adaptive-viewport-height,100dvh) - 24px);overflow:auto;overscroll-behavior:contain}
body:not(.immersive-pdv).adaptive-dialog-open{overflow:hidden}

/* Tablet amplo */
@media (min-width:901px) and (max-width:1180px){
  body.maxpdv-brand:not(.immersive-pdv) .commercial-content,
  body.admin-theme .content{padding:20px var(--adaptive-gutter-tablet) 34px!important}
  body:not(.immersive-pdv) :where(.stats-grid,.stats-grid.five,.stats-grid.six,.executive-metrics,.maxpdv-kpi-grid,.finance-kpi-grid,.inventory-kpi-grid,.report-kpi-grid,.cash-kpis,.ar-kpis,.customer360-kpis,.access-summary-grid,.service-summary-grid,.suite-metrics,.purchase-meta-cards){grid-template-columns:repeat(3,minmax(0,1fr))!important}
  body:not(.immersive-pdv) :where(.detail-grid,.suite-grid-2,.suite-grid-3,.service-detail-grid,.checkout-layout,.store-product-detail){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body:not(.immersive-pdv) :where(.form-grid,.dialog-grid,.suite-form-grid,.finance-filter-grid,.finance-dialog-grid,.purchase-meta-grid,.purchase-cost-grid,.purchase-finance-grid,.store-settings-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body:not(.immersive-pdv) :where(.span-2,.span-3,.full){grid-column:1/-1!important}
  body:not(.immersive-pdv) :where(.panel-head,.customers-pro-toolbar,.finance-ledger-head,.purchase-section-head,.ops-panel-head){gap:12px!important;flex-wrap:wrap!important}
  body:not(.immersive-pdv) :where(.toolbar,.report-filter){align-items:end!important}
}

/* Tablet de 901 a 1024 px: menu lateral em gaveta, mantendo a área de trabalho livre */
@media (min-width:901px) and (max-width:1024px){
  body.maxpdv-brand:not(.immersive-pdv){padding-bottom:0!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-app-shell,
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-app-shell{display:block!important;grid-template-columns:1fr!important;min-height:100dvh!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-main-wrap{width:100%!important;min-height:100dvh!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar,
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-sidebar{
    position:fixed!important;inset:0 auto 0 0!important;z-index:145!important;display:flex!important;
    width:min(328px,86vw)!important;height:100dvh!important;padding:15px 12px!important;
    border-radius:0 20px 20px 0!important;transform:translateX(-105%)!important;
    box-shadow:22px 0 54px rgba(15,23,42,.24)!important;transition:transform .2s ease!important
  }
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar.open{transform:translateX(0)!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar-backdrop{position:fixed!important;inset:0!important;z-index:140!important;display:block!important;border:0!important;background:rgba(15,23,42,.52)!important;opacity:0!important;visibility:hidden!important;transition:opacity .18s ease,visibility .18s ease!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar-backdrop.visible{opacity:1!important;visibility:visible!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) :where(.commercial-logo-full,.commercial-sale-cta b,.commercial-sale-cta kbd,.commercial-nav-copy,.commercial-nav kbd,.commercial-sidebar-operator>span:last-child,.commercial-sidebar-footer form){display:block!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-logo-symbol{display:none!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-sidebar-brand{justify-content:space-between!important;padding:0 4px!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-sale-cta{width:auto!important;grid-template-columns:30px minmax(0,1fr) auto!important;justify-items:stretch!important;margin-inline:4px!important;padding:7px 9px!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-nav-group{justify-items:stretch!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-nav a{width:auto!important;grid-template-columns:34px minmax(0,1fr) auto!important;justify-items:stretch!important;padding:5px 8px!important}
  body.maxpdv-brand.commercial-sidebar-collapsed:not(.immersive-pdv) .commercial-sidebar-footer{display:grid!important;justify-content:stretch!important;padding:9px 4px 0!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar-brand>button{display:grid!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar-brand>button .commercial-collapse-icon{display:none!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-sidebar-brand>button .commercial-close-icon{display:block!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-header{padding-inline:18px!important;gap:12px!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-header-collapse{display:grid!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-global-search{display:none!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-mobile-nav{display:none!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-page-title h1{max-width:42vw!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
}

/* Tablet compacto e celular em paisagem */
@media (max-width:900px){
  :root{--adaptive-gutter-current:var(--adaptive-gutter-mobile)}
  body:not(.immersive-pdv) :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){width:100%;min-height:46px}
  body:not(.immersive-pdv) :where(.btn,button,[role="button"],summary){min-height:var(--adaptive-touch)}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-content,
  body.admin-theme .content{width:100%!important;max-width:860px!important;padding-inline:max(var(--adaptive-gutter-mobile),env(safe-area-inset-left,0px))!important}
  body:not(.immersive-pdv) :where(.panel,.card,[class$="-panel"],[class$="-card"]){max-width:100%!important}
  body:not(.immersive-pdv) :where(.detail-grid,.suite-grid,.suite-grid-2,.suite-grid-3,.service-detail-grid,.checkout-layout,.store-product-detail,.ops-main-grid,.ops-priority-grid,.inventory-main-grid,.customer360-grid,.cash-open-layout,.cash-operation-grid,.service-orders-layout,.access-profile-grid,.plans-grid){grid-template-columns:1fr!important}
  body:not(.immersive-pdv) :where(.form-grid,.dialog-grid,.suite-form-grid,.finance-filter-grid,.finance-dialog-grid,.purchase-meta-grid,.purchase-cost-grid,.purchase-finance-grid,.store-settings-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body:not(.immersive-pdv) :where(.span-2,.span-3,.full){grid-column:1/-1!important}
  body:not(.immersive-pdv) :where(.panel-head,.customers-pro-toolbar,.finance-ledger-head,.purchase-section-head,.ops-panel-head){align-items:stretch!important;flex-direction:column!important;gap:10px!important}
  body:not(.immersive-pdv) :where(.panel-head,.customers-pro-toolbar,.finance-ledger-head,.purchase-section-head,.ops-panel-head)>:where(a,button,.btn,form){max-width:100%!important}
  body:not(.immersive-pdv) :where(.toolbar,.report-filter,.form-actions,.document-actions,.quick-actions,.split-actions){flex-wrap:wrap!important}
  body:not(.immersive-pdv) :where(.toolbar,.report-filter)>:where(input,select,label){flex:1 1 220px!important;max-width:none!important}
  body:not(.immersive-pdv) dialog.adaptive-dialog{width:min(720px,calc(100vw - 20px))!important;margin:auto!important}
  body.store-page .store-header{padding-inline:max(12px,env(safe-area-inset-left,0px))!important}
  body.store-page .store-header nav{flex:0 0 auto!important}
  body.store-page .store-main{width:100%!important;max-width:100%!important}
  body.sales-site :where(.sales-shell,.auth-shell,.login-shell),body.renewal-page :where(.renewal-shell,.renewal-card){max-width:100%!important}
}

/* Celular */
@media (max-width:600px){
  body:not(.immersive-pdv) :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){font-size:16px!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-content,
  body.admin-theme .content{padding-inline:max(9px,env(safe-area-inset-left,0px))!important}
  body:not(.immersive-pdv) :where(.panel,.card,[class$="-panel"],[class$="-card"]){border-radius:14px!important}
  body:not(.immersive-pdv) :where(.form-grid,.dialog-grid,.suite-form-grid,.finance-filter-grid,.finance-dialog-grid,.purchase-meta-grid,.purchase-cost-grid,.purchase-finance-grid,.store-settings-grid){grid-template-columns:1fr!important}
  body:not(.immersive-pdv) :where(.form-grid,.dialog-grid,.suite-form-grid,.finance-filter-grid,.finance-dialog-grid,.purchase-meta-grid,.purchase-cost-grid,.purchase-finance-grid,.store-settings-grid)>*{grid-column:auto!important}
  body:not(.immersive-pdv) :where(.form-actions,.toolbar,.quick-actions,.document-actions,.split-actions,.report-filter,.customer-row-actions,.service-show-actions){display:grid!important;grid-template-columns:1fr!important;align-items:stretch!important;gap:8px!important;width:100%!important}
  body:not(.immersive-pdv) :where(.form-actions,.toolbar,.quick-actions,.document-actions,.split-actions,.report-filter,.customer-row-actions,.service-show-actions)>*{width:100%!important;max-width:none!important;margin:0!important}
  body:not(.immersive-pdv) :where(.form-actions,.toolbar,.quick-actions,.document-actions,.split-actions,.report-filter,.customer-row-actions,.service-show-actions) form :where(.btn,button){width:100%!important}
  body:not(.immersive-pdv) :where(.stats-grid,.maxpdv-kpi-grid,.executive-metrics,.usage-grid,.finance-kpi-grid,.inventory-kpi-grid,.report-kpi-grid,.cash-kpis,.ar-kpis,.service-kpi-grid,.customer360-kpis,.access-summary-grid,.service-summary-grid,.ops-today-grid,.ops-v31-monitor-grid,.ops-stock-metrics,.suite-metrics,.suite-dre,.purchase-meta-cards){grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
  body:not(.immersive-pdv) :where(.stats-grid,.maxpdv-kpi-grid,.executive-metrics,.usage-grid,.finance-kpi-grid,.inventory-kpi-grid,.report-kpi-grid,.cash-kpis,.ar-kpis,.service-kpi-grid,.customer360-kpis,.access-summary-grid,.service-summary-grid,.ops-today-grid,.ops-v31-monitor-grid,.ops-stock-metrics,.suite-metrics,.suite-dre,.purchase-meta-cards)>*{min-width:0!important;padding:13px!important}
  body:not(.immersive-pdv) :where(.stats-grid,.maxpdv-kpi-grid,.executive-metrics,.usage-grid,.finance-kpi-grid,.inventory-kpi-grid,.report-kpi-grid,.cash-kpis,.ar-kpis,.service-kpi-grid,.customer360-kpis,.access-summary-grid,.service-summary-grid) :where(strong,.value){font-size:clamp(17px,5.5vw,23px)!important}
  body:not(.immersive-pdv) :where(.suite-tabs,.finance-quick-nav,.ar-quick-filters,.upgrade-admin-tabs,.report-tabs){display:flex!important;flex-wrap:nowrap!important;width:auto!important;margin-inline:-9px!important;padding-inline:9px!important;overflow-x:auto!important;scroll-snap-type:x proximity!important;scrollbar-width:none!important}
  body:not(.immersive-pdv) :where(.suite-tabs,.finance-quick-nav,.ar-quick-filters,.upgrade-admin-tabs,.report-tabs)::-webkit-scrollbar{display:none!important}
  body:not(.immersive-pdv) :where(.suite-tabs,.finance-quick-nav,.ar-quick-filters,.upgrade-admin-tabs,.report-tabs)>*{flex:0 0 auto!important;white-space:nowrap!important;scroll-snap-align:start!important}
  body:not(.immersive-pdv) dialog.adaptive-dialog{width:100vw!important;max-width:100vw!important;height:var(--adaptive-viewport-height,100dvh)!important;max-height:var(--adaptive-viewport-height,100dvh)!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important}
  body:not(.immersive-pdv) dialog.adaptive-dialog>:first-child{width:100%!important;max-width:none!important;min-height:100%!important;max-height:100%!important;margin:0!important;padding:max(16px,env(safe-area-inset-top,0px)) max(13px,env(safe-area-inset-right,0px)) calc(16px + env(safe-area-inset-bottom,0px)) max(13px,env(safe-area-inset-left,0px))!important;border-radius:0!important;overflow-y:auto!important}
  body:not(.immersive-pdv) dialog.adaptive-dialog footer{position:sticky;bottom:calc(-16px - env(safe-area-inset-bottom,0px));z-index:2;display:grid!important;grid-template-columns:1fr!important;gap:8px!important;margin-inline:-13px!important;padding:12px 13px calc(12px + env(safe-area-inset-bottom,0px))!important;background:#fff!important;border-top:1px solid var(--adaptive-line)!important}
  body:not(.immersive-pdv) dialog.adaptive-dialog footer>:where(.btn,button){width:100%!important}
  body.store-page .store-header{min-height:64px!important;gap:7px!important}
  body.store-page .store-brand b{max-width:38vw!important;font-size:13px!important}
  body.store-page .store-header nav>a{padding-inline:9px!important;font-size:12px!important}
  body.store-page .store-products{grid-template-columns:1fr!important;padding-inline:9px!important}
  body.store-page .store-footer{align-items:flex-start!important;flex-direction:column!important;gap:12px!important}
  body.sales-site{padding-inline:10px!important}
  body.sales-site :where(.login-card,.sales-login-card){width:100%!important;padding:22px 18px!important;border-radius:18px!important}
  body.renewal-page{padding-inline:10px!important}
  body.renewal-page :where(.renewal-shell,.renewal-card){width:100%!important;padding-inline:0!important}
}

@media (max-width:380px){
  body:not(.immersive-pdv) :where(.stats-grid,.maxpdv-kpi-grid,.executive-metrics,.usage-grid,.finance-kpi-grid,.inventory-kpi-grid,.report-kpi-grid,.cash-kpis,.ar-kpis,.service-kpi-grid,.customer360-kpis,.access-summary-grid,.service-summary-grid,.ops-today-grid,.ops-v31-monitor-grid,.ops-stock-metrics,.suite-metrics,.suite-dre,.purchase-meta-cards){grid-template-columns:1fr!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-page-title h1{max-width:44vw!important;font-size:15px!important}
  body.store-page .store-brand b{max-width:32vw!important}
}

@media (max-width:900px) and (orientation:landscape) and (max-height:520px){
  body:not(.immersive-pdv) dialog.adaptive-dialog{height:100dvh!important;max-height:100dvh!important}
  body.maxpdv-brand:not(.immersive-pdv) .commercial-content,
  body.admin-theme .content{padding-bottom:76px!important}
}

@media (pointer:coarse){
  body:not(.immersive-pdv) :where(.btn,button,[role="button"],summary,a.nav-link){min-height:var(--adaptive-touch)}
}

@media (prefers-reduced-motion:reduce){
  body:not(.immersive-pdv) *,body:not(.immersive-pdv) *::before,body:not(.immersive-pdv) *::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
