/* Keep catalog suggestions and show the complete product name below the search field. */
#sheet td.product{vertical-align:middle}
#sheet td.product input[data-k="product"]{position:static;inset:auto;height:36px;min-height:36px;width:100%;padding:6px 7px;white-space:nowrap}
#sheet td.product .product-full-name{padding:4px 7px 9px;white-space:normal;overflow-wrap:anywhere;line-height:1.35;font-size:14px;font-weight:600;color:var(--ink)}
#sheet td.product .product-full-name:empty{display:none}
.client-number-field{display:flex;align-items:center;min-width:0;border-top:1px solid}
.client-number-field .screen-order-number{flex:none;padding:5px 0 5px 7px;font-weight:800;white-space:nowrap}
.client-number-field input[data-meta="client"]{flex:1;min-width:0;border-top:0;padding-left:4px}
.change-order-number{flex:none;border:0;border-left:1px solid #ebcfb2;padding:5px;background:#fff7ed;color:#9a4f0a;font-size:11px;cursor:pointer}
#sheet td.product:has(.product-full-name:not(:empty)):not(:focus-within) input[data-k="product"]{position:absolute;inset:0;height:100%;opacity:0;cursor:text}
#sheet td.product:focus-within .product-full-name{display:none}
/* Keep editor rules from changing the saved-order tables. */
@media screen and (max-width:1250px){
  .orders-modal table{display:table}
  .orders-modal thead{display:table-header-group}
  .orders-modal tbody{display:table-row-group}
  .orders-modal tbody tr{display:table-row;margin:0;border-radius:0}
  .orders-modal tbody td{display:table-cell;min-height:0}
  .orders-modal tbody td::before{content:none;display:none}
  .orders-modal .preview-table{min-width:850px}
  .orders-modal .items-summary-table{min-width:700px}
  #sheet td.product{display:block;min-height:100px;padding:8px!important}
  #sheet td.product::before{display:block;margin-bottom:6px}
  #sheet td.product textarea,#sheet td.product input[data-k="product"]{position:static;min-height:60px;height:auto;padding:8px;overflow:auto}
}
@media screen and (max-width:800px){
  .toolbar button,.toolbar-link,.toolbar select,.toolbar input,.orders-modal button{min-height:44px}
  #sheet input,#sheet textarea,.toolbar input,.toolbar select,.orders-tools input,.orders-tools select{font-size:16px}
  #sheet .details{min-width:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #sheet .detail{min-width:0;grid-template-columns:minmax(0,1fr) 70px;grid-template-rows:1fr}
  #sheet .detail input{min-width:0;min-height:44px}
  #sheet .detail .qty{border-top:0;border-left:1px solid #b9a7a0}
  .orders-modal .orders-tools{grid-template-columns:minmax(0,1fr)!important;padding:12px}
  .orders-tools>*{min-width:0;width:100%}
  .orders-list{padding:12px}
  .order-card{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .order-card>*{min-width:0;overflow-wrap:anywhere}
  .order-actions{flex-wrap:wrap}
  .order-actions button{flex:1}
  .preview-bar{padding:10px;gap:6px}
  .preview-bar strong{flex-basis:100%;overflow-wrap:anywhere}
  .preview-bar button{flex:1 1 100px}
  .preview-body{min-height:0;min-width:0;padding:8px}
  .preview-meta{grid-template-columns:85px minmax(0,1fr)}
  .preview-meta>*{min-width:0;overflow-wrap:anywhere}
  .preview-total{flex-wrap:wrap;gap:8px}
  .orders-modal .preview-table{display:block;min-width:0}
  .orders-modal .preview-table thead{display:none}
  .orders-modal .preview-table tbody{display:block}
  .orders-modal .preview-table tbody tr{display:block;margin:8px;border:1px solid #ebcfb2;border-radius:8px}
  .orders-modal .preview-table tbody td{display:grid;grid-template-columns:90px minmax(0,1fr);text-align:left;border:0;border-bottom:1px solid #ebcfb2;padding:8px;overflow-wrap:anywhere}
  .orders-modal .preview-table tbody td::before{display:block;font-weight:700;color:#9a4f0a}
  .orders-modal .preview-table td:nth-child(1)::before{content:'Item'}
  .orders-modal .preview-table td:nth-child(2)::before{content:'Produto'}
  .orders-modal .preview-table td:nth-child(3)::before{content:'Unidade'}
  .orders-modal .preview-table td:nth-child(4)::before{content:'Códigos e quantidades';margin-bottom:8px}
  .orders-modal .preview-table td:nth-child(4){display:block}
  .orders-modal .preview-table td:nth-child(5)::before{content:'Quantidade'}
  .orders-modal .preview-table td:nth-child(6)::before{content:'Unitário'}
  .orders-modal .preview-table td:nth-child(7)::before{content:'Total'}
  .preview-details{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .preview-detail,.preview-detail:last-child{border:1px solid #ebcfb2;text-align:center;min-width:0}
  .preview-head{font-size:16px}
}
