/* WB Representações v0.1.36 — ergonomia em celular: retrato e paisagem.
   Alterações exclusivamente de apresentação; nenhuma regra comercial ou cálculo. */
.mp-brand picture{display:block;width:100%;min-width:0}
@media (max-width:760px), (min-width:761px) and (max-width:900px) and (pointer:coarse), (min-width:901px) and (max-width:1100px) and (max-height:600px) and (pointer:coarse){
  .mp-app,.mp-main,.mp-content,.mp-content-scroll,.mp-workspace,.mp-panel{min-width:0}
  .mp-body .mp-panel{max-width:100%}
  .mp-topbar{isolation:isolate}
  .mp-topbar-start{min-width:0;flex:1 1 140px}
  .wb-global-search,.wb-search-field,.wb-search-field input{min-width:0}
  .wb-search-field input{font-size:16px!important}
  .wb-quick-actions{z-index:45}
  .wb-quick-menu{left:0;right:auto;width:min(280px,calc(100vw - 28px));max-height:calc(100dvh - 125px);overflow-y:auto;overscroll-behavior:contain}
  .wb-quick-menu a{min-height:43px;white-space:normal}
  .mp-content .mp-sectionhead{min-width:0;gap:9px}
  .mp-content .mp-sectionhead h2{overflow-wrap:anywhere}
  .mp-pages,.mp-page-links{min-width:0;max-width:100%;flex-wrap:wrap;justify-content:center}
  .mp-pages-info{white-space:normal}
  /* Lixeira: todas as categorias estão visíveis, sem rolagem horizontal. */
  .wb-trash-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;max-width:100%;overflow:visible;padding:2px 0 8px}
  .wb-trash-tab{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;min-width:0;width:100%;min-height:42px;padding:7px 6px;white-space:normal;overflow-wrap:anywhere;text-align:center;line-height:1.25}
  .wb-trash-tab span{flex-shrink:0}
  .wb-trash-row,.wb-trash-row-info{min-width:0}
  .wb-trash-row-info strong,.wb-trash-row-info small{overflow:visible;white-space:normal;overflow-wrap:anywhere;max-width:100%;line-height:1.4}
  .wb-trash-restore{flex:0 0 auto;margin:0}
  .wb-restore-button{min-height:42px}
  /* Cadastros e filtros: campos de toque legíveis, sem zoom espontâneo no Safari. */
  .mp-modal input:not([type="checkbox"]):not([type="radio"]),.mp-modal select,.mp-modal textarea,
  .wb-order-dialog input:not([type="checkbox"]):not([type="radio"]),.wb-order-dialog select,.wb-order-dialog textarea,
  .mp-record-search input,.mp-search input,.wb-doc-filters input,.wb-doc-filters select{font-size:16px!important}
  .mp-modal .mp-record-actions{display:flex;flex-wrap:wrap;gap:9px;justify-content:stretch}
  .mp-modal .mp-record-actions .mp-btn{flex:1 1 135px;min-height:43px;width:auto}
  .mp-record-row{min-width:0;max-width:100%}
  .mp-record-info{min-width:0}
  .mp-record-info strong,.mp-record-info small{white-space:normal;overflow-wrap:anywhere;overflow:visible;line-height:1.35}
  .mp-record-search label{min-width:0;flex:1 1 100%}
  .mp-record-search input,.mp-record-search select{min-width:0;width:100%}
  /* Novo pedido: componentes empilhados e botões sempre acessíveis. */
  .wb-order-dialog{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;inset:0;overflow:auto;border-radius:0;padding-bottom:env(safe-area-inset-bottom);overscroll-behavior:contain}
  .wb-order-dialog .wb-order-workflow{padding:12px!important;min-width:0}
  .wb-order-dialog .wb-order-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:8px 0 12px}
  .wb-order-dialog .wb-order-step{min-width:0;min-height:38px;padding:7px 4px;font-size:12px;line-height:1.25}
  .wb-order-dialog .wb-order-actions{position:sticky;bottom:0;background:var(--mp-surface);z-index:4;gap:8px;padding:10px 0 max(10px,env(safe-area-inset-bottom));margin-top:10px}
  .wb-order-dialog .wb-order-actions .mp-btn{flex:1 1 105px;min-height:43px}
  .wb-product-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:11px;min-width:0}
  .wb-catalog-card,.wb-order-picked{padding:12px;min-width:0}
  .wb-catalog-heading{align-items:flex-start;flex-wrap:wrap}
  .wb-catalog-results{min-height:70px;max-height:34dvh}
  .wb-catalog-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:10px;min-width:0}
  .wb-catalog-info strong{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;line-height:1.42}
  .wb-catalog-info span{white-space:normal;overflow-wrap:anywhere}
  .wb-catalog-add{min-height:42px;padding:8px 10px;align-self:center}
  .wb-catalog-pagination{flex-wrap:wrap}
  .wb-order-picked .mp-table-wrap{max-height:none;overflow:visible;min-width:0}
  .wb-order-picked .wb-items{display:block;width:100%;min-width:0!important;background:transparent}
  .wb-order-picked .wb-items thead{display:none}
  .wb-order-picked .wb-items tbody{display:grid;gap:9px}
  .wb-order-picked .wb-items tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:8px;min-width:0;padding:11px;border-radius:13px;background:var(--mp-surface);box-shadow:var(--mp-card-shadow)}
  .wb-order-picked .wb-items td{min-width:0;display:flex;flex-direction:column;gap:5px;overflow-wrap:anywhere;padding:0!important;box-shadow:none}
  .wb-order-picked .wb-items td:first-child{grid-column:1/-1}
  .wb-order-picked .wb-items td:first-child strong{font-size:13px;color:var(--mp-strong)}
  .wb-order-picked .wb-items small{white-space:normal;overflow:visible;text-overflow:clip;max-width:none;line-height:1.4}
  .wb-order-picked .wb-items td:nth-child(2)::before{content:'Quantidade'}
  .wb-order-picked .wb-items td:nth-child(3)::before{content:'Preço unitário'}
  .wb-order-picked .wb-items td:nth-child(4)::before{content:'Total do item'}
  .wb-order-picked .wb-items td:nth-child(2)::before,.wb-order-picked .wb-items td:nth-child(3)::before,.wb-order-picked .wb-items td:nth-child(4)::before{font-size:12px;font-weight:600;color:var(--mp-muted)}
  .wb-order-picked .wb-items td:nth-child(4){align-self:end;font-weight:700}
  .wb-order-picked .wb-items td:last-child{align-self:end;align-items:flex-end}
  .wb-order-picked .wb-items td:last-child [data-wb-remove]{min-height:42px;min-width:98px}
  .wb-order-picked .wb-items td:last-child [data-wb-remove]::after{content:' Remover';font-size:12px}
  .wb-order-picked .wb-items input[name="item_price[]"]{width:100%!important;max-width:none;min-height:42px!important}
  .wb-order-picked .wb-items .wb-qty-stepper{width:100%;max-width:156px;min-height:42px}
  .wb-order-picked .wb-qty-controls{flex-basis:34px}
  .wb-order-picked .wb-qty-controls button{min-height:18px}
  .wb-order-picked .wb-item-custom-fields{min-width:0;max-width:100%}
  .wb-order-picked .wb-item-custom-fields input,.wb-order-picked .wb-item-custom-fields select{min-width:0;max-width:100%;width:100%}
  /* Tabelas comerciais: cartões responsivos, preservando links e ações. */
  .mp-products-table-wrap,.wb-orders-current .mp-table-wrap,.wb-history-orders~.mp-table-wrap{max-width:100%;overflow:visible}
  .mp-products-table,.wb-orders-current .mp-table,.wb-history-orders,.wb-history-items-table,.wb-doc-table,.wb-catalog-history-table{display:block;min-width:0!important;width:100%}
  .mp-products-table thead,.wb-orders-current .mp-table thead,.wb-history-orders thead,.wb-history-items-table thead,.wb-doc-table thead,.wb-catalog-history-table thead{display:none}
  .mp-products-table tbody,.wb-orders-current .mp-table tbody,.wb-history-orders tbody,.wb-history-items-table tbody,.wb-doc-table tbody,.wb-catalog-history-table tbody{display:grid;gap:9px}
  .mp-products-table tbody tr,.wb-orders-current .mp-table tbody tr,.wb-history-orders tbody tr,.wb-history-items-table tbody tr,.wb-doc-table tbody tr,.wb-catalog-history-table tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0;padding:11px;background:var(--mp-raised);border-radius:13px;box-shadow:var(--mp-card-shadow)}
  .mp-products-table tbody td,.wb-orders-current .mp-table tbody td,.wb-history-orders tbody td,.wb-history-items-table tbody td,.wb-doc-table tbody td,.wb-catalog-history-table tbody td{display:flex;flex-direction:column;align-items:flex-start;gap:3px;min-width:0;max-width:100%;padding:0!important;overflow-wrap:anywhere;white-space:normal!important;border:0!important;background:transparent!important;border-radius:0!important;box-shadow:none!important}
  .mp-products-table tbody td:before,.wb-orders-current .mp-table tbody td:before,.wb-history-orders tbody td:before,.wb-history-items-table tbody td:before,.wb-doc-table tbody td:before,.wb-catalog-history-table tbody td:before{font-size:12px;font-weight:600;color:var(--mp-muted);line-height:1.3}
  /* Colunas de descrição/cliente: linhas completas sem truncamento. */
  .mp-products-table td:nth-child(2),.wb-orders-current .mp-table td:nth-child(3),.wb-orders-current .mp-table td:nth-child(4),.wb-history-orders td:nth-child(2),.wb-history-orders td:nth-child(3),.wb-history-items-table td:nth-child(2),.wb-doc-table td:nth-child(1),.wb-catalog-history-table td:nth-child(2){grid-column:1/-1}
  .mp-products-table td:nth-child(1)::before{content:'Código'}
  .mp-products-table td:nth-child(2)::before{content:'Peça'}
  .mp-products-table td:nth-child(3)::before{content:'Unidade'}
  .mp-products-table td:nth-child(4)::before{content:'Preço histórico'}
  .mp-products-table td:nth-child(5)::before{content:'Ativo no legado'}
  .mp-products-table .mp-product-description{max-width:100%;white-space:normal;text-align:left;overflow-wrap:anywhere}
  .wb-orders-current .mp-table td:nth-child(1)::before{content:'Pedido'}
  .wb-orders-current .mp-table td:nth-child(2)::before{content:'Criado em'}
  .wb-orders-current .mp-table td:nth-child(3)::before{content:'Cliente'}
  .wb-orders-current .mp-table td:nth-child(4)::before{content:'Representada'}
  .wb-orders-current .mp-table td:nth-child(5)::before{content:'Total'}
  .wb-orders-current .mp-table td:nth-child(6)::before{content:'Situação'}
  .wb-orders-current .mp-table td:nth-child(7)::before{content:'Ações'}
  .wb-orders-current .mp-table td:nth-child(7){grid-column:1/-1}
  .wb-orders-current .wb-order-list-actions{justify-content:flex-start;flex-wrap:wrap}
  .wb-history-orders td:nth-child(1)::before{content:'Pedido histórico'}
  .wb-history-orders td:nth-child(2)::before{content:'Representada'}
  .wb-history-orders td:nth-child(3)::before{content:'Cliente'}
  .wb-history-orders td:nth-child(4)::before{content:'Data'}
  .wb-history-orders td:nth-child(5)::before{content:'Total histórico'}
  .wb-history-orders td:nth-child(6)::before{content:'Itens'}
  .wb-history-orders td:nth-child(7)::before{content:'PDF'}
  .wb-history-items-table td:nth-child(1)::before{content:'Código'}
  .wb-history-items-table td:nth-child(2)::before{content:'Descrição'}
  .wb-history-items-table td:nth-child(3)::before{content:'Quantidade'}
  .wb-history-items-table td:nth-child(4)::before{content:'Preço unitário'}
  .wb-history-items-table td:nth-child(5)::before{content:'Total histórico'}
  .wb-doc-table td:nth-child(1)::before{content:'Documento'}
  .wb-doc-table td:nth-child(2)::before{content:'Representada / origem'}
  .wb-doc-table td:nth-child(3)::before{content:'Estado'}
  .wb-doc-table td:nth-child(4)::before{content:'Ações'}
  .wb-doc-table td:nth-child(4){grid-column:1/-1}
  .wb-catalog-history-table td:nth-child(1)::before{content:'Representada'}
  .wb-catalog-history-table td:nth-child(2)::before{content:'Arquivo'}
  .wb-catalog-history-table td:nth-child(3)::before{content:'Produtos'}
  .wb-catalog-history-table td:nth-child(4)::before{content:'Estado'}
  .wb-catalog-history-table td:nth-child(5)::before{content:'Data'}
  .mp-products-table tbody tr:has(td[colspan]),.wb-history-orders tbody tr:has(td[colspan]),.wb-catalog-history-table tbody tr:has(td[colspan]){display:block}
  .mp-products-table tbody td[colspan],.wb-history-orders tbody td[colspan],.wb-catalog-history-table tbody td[colspan]{display:block}
  .mp-products-table tbody td[colspan]::before,.wb-history-orders tbody td[colspan]::before,.wb-catalog-history-table tbody td[colspan]::before{content:none}
}
@media(max-width:520px){
  .wb-trash-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}
  .wb-trash-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}
  .wb-trash-row-info{min-width:0}
  .wb-trash-restore{justify-self:end}
  .wb-order-dialog .wb-order-workflow{padding:11px!important}
  .wb-order-picked .wb-items td:last-child [data-wb-remove]{min-width:98px}
  .wb-order-dialog .wb-order-step{font-size:12px}
  .mp-record-row{gap:7px}
  .mp-record-state{font-size:12px}
}
/* Tablet e iPhone paisagem: ações rápidas se ancoram na área útil, não na sidebar. */
@media(min-width:761px) and (max-width:1100px){
  .wb-quick-menu{left:0;right:auto;max-height:calc(100dvh - 125px);overflow-y:auto}
  .wb-trash-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;overflow:visible}
  .wb-trash-tab{display:flex;justify-content:center;flex-wrap:wrap;white-space:normal;min-width:0;overflow-wrap:anywhere;text-align:center}
}
@media(min-width:761px) and (max-width:1100px) and (max-height:600px){
  .mp-topbar{z-index:55}
  .wb-quick-actions{z-index:60}
  .wb-quick-menu{left:0;right:auto;width:min(275px,calc(100vw - 275px));max-height:calc(100dvh - 120px);overflow-y:auto;overscroll-behavior:contain}
  .wb-quick-menu a{min-height:40px}
  .mp-sidebar{z-index:40}
}
/* Paisagem com tela sensível ao toque: pedido e cadastros aproveitam a área vertical reduzida. */
@media(min-width:761px) and (max-width:1100px) and (max-height:600px) and (pointer:coarse){
  .wb-order-dialog{max-height:100dvh;height:100dvh;width:min(100vw,980px);border-radius:0}
  .wb-order-dialog .wb-order-workflow{padding:12px 17px}
  .wb-order-dialog .wb-order-steps{margin:6px 0 9px}
  .wb-order-dialog .wb-catalog-results{max-height:40dvh;min-height:65px}
  .wb-order-dialog .wb-order-actions{position:sticky;bottom:0;background:var(--mp-surface);z-index:4;padding:10px 0 max(9px,env(safe-area-inset-bottom))}
  .mp-modal[open]{max-height:96dvh}
  .mp-modal input:not([type="checkbox"]):not([type="radio"]),.wb-order-dialog input:not([type="checkbox"]):not([type="radio"]){font-size:16px}
}
