/* GV PNEUS 2.3.0 — adaptação por dispositivo sem ocultar funções */
:root{
  --gv-header-height:72px;
  --gv-viewport-height:100dvh;
  --gv-keyboard-offset:0px;
  --gv-touch:46px;
}
html,body{max-width:100%;}
body{overflow-x:clip!important;}
.topbar{min-height:var(--gv-header-height);}
.topbar-actions,.logout-form{display:flex!important;align-items:center!important;gap:8px!important;margin:0!important;}
.logout-form .btn{white-space:nowrap!important;}
.menu-backdrop{display:none;position:fixed;inset:var(--gv-header-height) 0 0;background:rgba(15,23,42,.55);backdrop-filter:blur(2px);z-index:58;}
.cancel-box{margin-top:18px;padding:16px;border:1px solid #fecaca;background:#fff7f7;border-radius:16px;display:grid;gap:10px;}
.cancel-box .actions{margin-top:2px;}
.table-wrap{overscroll-behavior-inline:contain;scrollbar-gutter:stable;}
.table-wrap>table{margin:0;}
.actions{max-width:100%;}
.actions>*{max-width:100%;}
button,.btn,input,select,textarea{touch-action:manipulation;}
button:focus-visible,.btn:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(14,116,144,.32)!important;outline-offset:2px;}
.gv-update-toast,.gv-ios-help{position:fixed;z-index:120;left:50%;transform:translateX(-50%);width:min(92vw,520px);border-radius:16px;box-shadow:0 20px 50px rgba(15,23,42,.3);}
.gv-update-toast{bottom:calc(16px + env(safe-area-inset-bottom,0px));background:#0f172a;color:#fff;padding:14px;display:flex;align-items:center;justify-content:space-between;gap:12px;}
.gv-update-toast button{flex:0 0 auto;}
.gv-ios-help{bottom:calc(14px + env(safe-area-inset-bottom,0px));background:#fff;color:#0f172a;border:1px solid #cbd5e1;padding:18px;}
.gv-ios-help .actions{margin-top:12px;justify-content:flex-end;}
.gv-offline-badge{position:fixed;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));z-index:100;background:#92400e;color:#fff;border-radius:999px;padding:8px 12px;font-size:12px;font-weight:850;box-shadow:0 8px 24px rgba(15,23,42,.24);}

@media (pointer:coarse){
  .btn,button,input,select{min-height:var(--gv-touch)!important;}
  .sidebar a{min-height:var(--gv-touch);}
}

@media(max-width:1100px){
  .grid-4{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .grid-3{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .pdv-shell{grid-template-columns:1fr!important;}
}

@media(max-width:900px){
  :root{--gv-touch:48px;}
  html{scroll-padding-top:calc(var(--gv-header-height) + 12px);}
  body{min-height:var(--gv-viewport-height)!important;padding-bottom:var(--gv-keyboard-offset);}
  body.menu-open{overflow:hidden!important;}
  .topbar{position:sticky!important;top:0!important;z-index:70!important;padding:calc(8px + env(safe-area-inset-top,0px)) 10px 8px!important;gap:8px!important;min-height:64px!important;}
  .menu-toggle{display:inline-grid!important;place-items:center!important;width:46px!important;min-width:46px!important;height:46px!important;padding:0!important;flex:0 0 46px!important;}
  .topbar .brand{flex:1 1 auto!important;min-width:0!important;gap:8px!important;}
  .topbar .brand img{width:38px!important;height:38px!important;border-radius:10px!important;}
  .topbar .brand span{font-size:14px!important;max-width:32vw!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
  .topbar-actions{flex:0 0 auto!important;gap:5px!important;width:auto!important;flex-wrap:nowrap!important;}
  .topbar .user-chip{display:none!important;}
  .topbar [data-install-pwa]:not([hidden]){display:inline-flex!important;width:auto!important;min-height:40px!important;padding:8px 10px!important;font-size:11.5px!important;white-space:nowrap!important;}
  .logout-form{width:auto!important;flex:0 0 auto!important;}
  .logout-form .btn{width:auto!important;min-height:40px!important;padding:8px 10px!important;font-size:12px!important;}
  .layout{display:block!important;min-height:calc(var(--gv-viewport-height) - var(--gv-header-height))!important;}
  .sidebar{position:fixed!important;top:var(--gv-header-height)!important;bottom:0!important;left:0!important;inset-inline-end:auto!important;width:min(88vw,330px)!important;max-width:330px!important;z-index:60!important;transform:translate3d(-105%,0,0)!important;transition:transform .22s ease!important;overflow-y:auto!important;overscroll-behavior:contain!important;padding:14px 12px calc(24px + env(safe-area-inset-bottom,0px))!important;box-shadow:16px 0 40px rgba(15,23,42,.28)!important;}
  body.menu-open .sidebar{transform:translate3d(0,0,0)!important;}
  body.menu-open .menu-backdrop{display:block!important;}
  .main{width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:14px 12px calc(18px + env(safe-area-inset-bottom,0px))!important;overflow:visible!important;}
  .card{width:100%!important;max-width:100%!important;min-width:0!important;margin-bottom:14px!important;padding:16px!important;border-radius:17px!important;overflow:visible!important;}
  .title-row{align-items:flex-start!important;gap:10px!important;margin-bottom:14px!important;}
  .title-row>div:first-child{min-width:0!important;flex:1 1 100%!important;}
  .title-row>.actions,.title-row>form.actions{width:100%!important;display:flex!important;}
  h1{font-size:clamp(1.45rem,6vw,1.85rem)!important;overflow-wrap:anywhere;}
  h2{font-size:clamp(1.15rem,5vw,1.45rem)!important;overflow-wrap:anywhere;}
  .grid,.grid-2,.grid-3,.grid-4{grid-template-columns:1fr!important;gap:12px!important;}
  .card.stat{min-height:94px!important;padding:16px!important;}
  .card.stat b{font-size:clamp(1.65rem,8vw,2.15rem)!important;}
  .form-grid{grid-template-columns:1fr!important;gap:13px!important;}
  .field,.field.span-2,.field.span-3,.field.span-4,.field.span-5,.field.span-6,.field.span-8,.field.span-9,.field.span-12{grid-column:1/-1!important;min-width:0!important;}
  .field{gap:7px!important;}
  .field label,label{font-size:13px!important;line-height:1.35!important;}
  input,select,textarea{width:100%!important;max-width:100%!important;min-width:0!important;font-size:16px!important;border-radius:13px!important;padding-left:13px!important;padding-right:13px!important;}
  textarea{min-height:105px!important;line-height:1.45!important;padding-top:12px!important;padding-bottom:12px!important;}
  input[type="checkbox"],input[type="radio"]{width:20px!important;min-width:20px!important;max-width:20px!important;height:20px!important;min-height:20px!important;padding:0!important;}
  .actions{display:flex!important;width:100%!important;gap:8px!important;flex-wrap:wrap!important;align-items:stretch!important;}
  .topbar .topbar-actions{width:auto!important;max-width:calc(100vw - 118px)!important;flex-wrap:nowrap!important;}
  .topbar .topbar-actions>*{flex:0 0 auto!important;}
  .actions>.btn,.actions>button{flex:1 1 140px!important;min-width:0!important;white-space:normal!important;text-align:center!important;}
  .topbar .topbar-actions>.btn,.topbar .topbar-actions>button{flex:0 0 auto!important;}
  .os-primary-actions{position:sticky!important;bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;z-index:20!important;background:rgba(255,255,255,.96)!important;border:1px solid #dbe4ee!important;border-radius:16px!important;padding:10px!important;box-shadow:0 10px 30px rgba(15,23,42,.15)!important;backdrop-filter:blur(8px);}
  .table-wrap{width:100%!important;max-width:100%!important;overflow-x:auto!important;overflow-y:visible!important;border-radius:14px!important;-webkit-overflow-scrolling:touch!important;}
  .table-wrap.gv-scroll-table::after{content:'Deslize para o lado para ver todas as colunas';display:block;position:sticky;left:0;padding:6px 10px;background:#f8fafc;color:#64748b;font-size:11px;}
  table:not(.gv-mobile-cards){min-width:680px!important;}
  th,td{padding:11px 10px!important;}
  table.gv-mobile-cards{display:block!important;width:100%!important;min-width:0!important;border-collapse:separate!important;}
  table.gv-mobile-cards thead{display:none!important;}
  table.gv-mobile-cards tbody{display:grid!important;gap:11px!important;padding:0!important;}
  table.gv-mobile-cards tr{display:grid!important;width:100%!important;border:1px solid #dbe4ee!important;border-radius:14px!important;background:#fff!important;overflow:hidden!important;box-shadow:0 5px 16px rgba(15,23,42,.06)!important;}
  table.gv-mobile-cards tr:hover td{background:transparent!important;}
  table.gv-mobile-cards td{display:grid!important;grid-template-columns:minmax(105px,42%) minmax(0,1fr)!important;align-items:start!important;gap:10px!important;width:100%!important;min-width:0!important;border:0!important;border-bottom:1px solid #eef2f7!important;padding:10px 12px!important;text-align:right!important;overflow-wrap:anywhere!important;}
  table.gv-mobile-cards td:last-child{border-bottom:0!important;}
  table.gv-mobile-cards td::before{content:attr(data-label);font-weight:900!important;color:#475569!important;text-align:left!important;font-size:11px!important;text-transform:uppercase!important;letter-spacing:.03em!important;}
  table.gv-mobile-cards td.actions{display:flex!important;grid-template-columns:none!important;justify-content:stretch!important;text-align:left!important;}
  table.gv-mobile-cards td.actions::before{display:none!important;}
  table.gv-mobile-cards td.actions .btn,table.gv-mobile-cards td.actions button{flex:1 1 120px!important;}
  table.gv-mobile-cards td[colspan]{grid-template-columns:1fr!important;text-align:left!important;}
  table.gv-mobile-cards td[colspan]::before{display:none!important;}
  .item-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important;width:100%!important;min-width:0!important;margin-bottom:12px!important;padding:12px!important;border:1px solid #dbe4ee!important;border-radius:15px!important;background:#f8fafc!important;}
  .item-row .os-product-search,.item-row select,.item-row input[name="item_description[]"]{grid-column:1/-1!important;}
  .item-row [data-remove-item]{grid-column:1/-1!important;width:100%!important;}
  .totals{grid-template-columns:1fr!important;gap:8px!important;}
  .total-box{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:12px!important;}
  .total-box strong{font-size:1.25rem!important;text-align:right!important;}
  .pay-grid-simple{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important;}
  .pay-btn{min-width:0!important;min-height:60px!important;padding:10px!important;}
  .pdv-total{align-items:center!important;flex-direction:row!important;}
  .doc-preview-table{overflow:auto!important;max-height:65dvh!important;}
  .document-reader{overflow:visible!important;}
  .login-page{min-height:var(--gv-viewport-height)!important;padding:calc(12px + env(safe-area-inset-top,0px)) 12px calc(12px + env(safe-area-inset-bottom,0px))!important;}
  .login-card{width:100%!important;max-width:440px!important;padding:22px 18px!important;border-radius:22px!important;}
}

@media(max-width:480px){
  .topbar .brand span{max-width:22vw!important;font-size:12px!important;}
  .topbar [data-install-pwa]:not([hidden]){max-width:84px!important;overflow:hidden!important;text-overflow:ellipsis!important;}
  .main{padding-left:8px!important;padding-right:8px!important;}
  .card{padding:13px!important;}
  .item-row{grid-template-columns:1fr!important;}
  .item-row>*{grid-column:1/-1!important;}
  .pay-grid-simple{grid-template-columns:1fr 1fr!important;}
  table.gv-mobile-cards td{grid-template-columns:minmax(92px,40%) minmax(0,1fr)!important;padding:9px 10px!important;}
}

@media(max-width:360px){
  .topbar .brand span{display:none!important;}
  .topbar [data-install-pwa]:not([hidden]){display:none!important;}
  .pay-grid-simple{grid-template-columns:1fr!important;}
}

@media(max-width:900px) and (orientation:landscape){
  .topbar{min-height:54px!important;padding-top:calc(4px + env(safe-area-inset-top,0px))!important;padding-bottom:4px!important;}
  .menu-toggle{height:40px!important;min-height:40px!important;}
  .topbar .brand img{width:34px!important;height:34px!important;}
  .sidebar{width:min(52vw,340px)!important;}
  .main{padding-top:9px!important;}
  .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .field,.field.span-2,.field.span-3,.field.span-4,.field.span-5,.field.span-6{grid-column:span 1!important;}
  .field.span-8,.field.span-9,.field.span-12{grid-column:1/-1!important;}
  .grid-2,.grid-3,.grid-4{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
}

@media(display-mode:standalone){
  body{overscroll-behavior-y:none;}
  .topbar{padding-top:calc(8px + env(safe-area-inset-top,0px))!important;}
}

@media print{
  .menu-backdrop,.gv-update-toast,.gv-ios-help,.gv-offline-badge,.cancel-box{display:none!important;}
  body{overflow:visible!important;padding:0!important;}
  table,table.gv-mobile-cards{display:table!important;min-width:0!important;}
  table.gv-mobile-cards thead{display:table-header-group!important;}
  table.gv-mobile-cards tbody{display:table-row-group!important;}
  table.gv-mobile-cards tr{display:table-row!important;border:0!important;box-shadow:none!important;}
  table.gv-mobile-cards td{display:table-cell!important;text-align:left!important;border-bottom:1px solid #ddd!important;}
  table.gv-mobile-cards td::before{display:none!important;}
}

/* GV PNEUS 2.3.0 — autocomplete da OS otimizado para PWA móvel */
@media(max-width:900px){
  .item-row .os-product-picker{grid-column:1/-1!important;position:relative!important;min-width:0!important;z-index:4!important;}
  .item-row.autocomplete-open{z-index:120!important;}
  .os-product-search{padding-right:51px!important;font-size:16px!important;}
  .os-product-clear{top:7px!important;right:7px!important;width:39px!important;min-width:39px!important;height:39px!important;min-height:39px!important;}
  .os-product-results.gv-mobile-popup{
    position:fixed!important;
    z-index:1000!important;
    margin:0!important;
    border-radius:17px!important;
    box-shadow:0 22px 60px rgba(15,23,42,.34)!important;
    padding:7px!important;
    background:#fff!important;
    overscroll-behavior:contain!important;
  }
  .os-product-result{
    grid-template-columns:minmax(0,1fr) auto!important;
    min-height:66px!important;
    padding:11px 12px!important;
    gap:9px!important;
  }
  .os-product-result-content strong{font-size:14px!important;white-space:normal!important;overflow:visible!important;}
  .os-product-result-content small{font-size:11px!important;white-space:normal!important;overflow:visible!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;}
  .os-product-result-values b{font-size:13px!important;}
  .os-product-result-values small{font-size:10px!important;}
  .os-product-hint{font-size:11px!important;margin-top:6px!important;}
  .os-product-selection{font-size:11.5px!important;}
}
@media(max-width:380px){
  .os-product-result{grid-template-columns:minmax(0,1fr)!important;gap:5px!important;}
  .os-product-result-values{grid-template-columns:auto auto!important;justify-content:space-between!important;justify-items:start!important;width:100%!important;}
}
