/* Detail cells use the quotation's edge-to-edge control and 8px text inset.
   This stylesheet intentionally does not target header forms, query tables,
   table headers/totals, action buttons, checkboxes or sliding switches. */
@media screen and (min-width:769px){
 #mainWrap .tab-page :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table){
  --detail-cell-input-height:39px;
 }
 /* These document families keep their existing compact row geometry. */
 #mainWrap .inventory-document-page .erp-document-design .ed-section .ed-table{
  /* The 32px declaration is expanded to 37px by the existing editable
     control. Preserve that rendered row height rather than shrinking it. */
  --detail-cell-input-height:36px;
 }
 /* Native M7 inventory controls retain 5px vertical cell padding before
    editing, so their rendered row is 41px rather than the SV editor's 37px. */
 #mainWrap .inventory-document-page.wuxi-m7-detail-page .erp-document-design .ed-section .ed-table>tbody>tr>td:has(input.cell-input.ed-input){
  --detail-cell-input-height:40px;
 }
 #mainWrap .tab-page .sv-funds-split .ed-section .ed-table{
  --detail-cell-input-height:33px;
 }
 /* An editable OP row currently measures 37px: 28px control, 8px old
    vertical cell padding and a 1px rule. Fill it without shrinking the row. */
 #mainWrap .tab-page .op-document-shell .op-table{
  --detail-cell-input-height:36px;
 }
 #mainWrap .tab-page .op-document-shell .op-document-table{
  --detail-cell-input-height:39px;
 }
 #mainWrap .tab-page :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table)>tbody>tr>td:not([data-col="short_meter_enabled"]):has(:is(input:not([type]),input[type="text"],input[type="number"],input[type="search"],input[type="tel"],input[type="url"],input[type="email"],input[type="password"],input[type="date"],input[type="datetime-local"],input[type="month"],input[type="week"],input[type="time"],textarea,select,.sv-cell-lookup)){
  padding:0!important;
 }
 #mainWrap .tab-page :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table)>tbody>tr>td:not([data-col="short_meter_enabled"]) :is(input:not([type]),input[type="text"],input[type="number"],input[type="search"],input[type="tel"],input[type="url"],input[type="email"],input[type="password"],input[type="date"],input[type="datetime-local"],input[type="month"],input[type="week"],input[type="time"],textarea,select,.sv-cell-lookup){
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0;
  max-width:100%;
  height:var(--detail-cell-input-height,39px)!important;
  min-height:0;
  margin:0!important;
  padding:0 8px!important;
 }
 /* Only the OP renderer relies on its original 75px input minimum when
    calculating automatic column widths. Do not reflow those columns. */
 #mainWrap .tab-page .op-document-shell .op-table:not(.detail-table-resizable)>tbody>tr>td .op-cell-input{
  min-width:75px;
 }
 /* Quotation controls already display as blocks; the legacy estimate uses
    bare inline inputs nested in a percentage-height wrapper instead. */
 #mainWrap #page-comparison #compItemBody>tr>td:is([data-col="actual_quantity"],[data-col="actual_unit_price"])>div{
  box-sizing:border-box;
  width:100%;
  height:100%!important;
  min-height:0;
  margin:0;
  padding:0;
 }
 #mainWrap #page-comparison #compItemBody>tr>td:is([data-col="actual_quantity"],[data-col="actual_unit_price"])>div>input{
  display:block;
  height:100%!important;
 }
 /* A lookup input keeps the space occupied by its existing in-field button.
    The wrapper fills the cell, while the button's size and position stay as is. */
 #mainWrap .tab-page .erp-document-design .ed-section .ed-table>tbody>tr>td>.ed-picker-control{
  box-sizing:border-box;
  width:100%;
  height:var(--detail-cell-input-height,39px);
  margin:0;
 }
 #mainWrap .tab-page .erp-document-design .ed-section .ed-table>tbody>tr>td .ed-picker-control>input{
  padding-right:31px!important;
 }
 #mainWrap .tab-page .quotation-line-table>tbody>tr>td .si-customer-lookup-control>input{
  padding-right:35px!important;
 }
 #mainWrap .tab-page .quotation-line-table>tbody>tr>td .inquiry-manager-field>input{
  padding-right:38px!important;
 }
 /* The checkbox is already 24px throughout the application. Reserve its
    full width in the compound short-meter cell without changing the control. */
 #mainWrap #compItemTable>tbody>tr>td[data-col="short_meter_enabled"]>div{
  grid-template-columns:24px minmax(0,1fr);
 }
}

/* Mobile cards keep their own field heights, labels, grid gaps and cell
   positions. Only the text inset follows the quotation; mixed short-meter
   checkbox/percentage cells retain their reserved layout. */
@media screen and (max-width:768px){
 /* Documents that remain tables on phones follow the same cell edges.
    Estimate/quotation cards keep their existing label and grid spacing. */
 #mainWrap .tab-page:not(.mobile-document-layout):not(:where(#page-comparison)) :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table){
  --detail-cell-input-height:39px;
 }
 #mainWrap .inventory-document-page .erp-document-design .ed-section .ed-table{
  --detail-cell-input-height:36px;
 }
 #mainWrap .inventory-document-page.wuxi-m7-detail-page .erp-document-design .ed-section .ed-table>tbody>tr>td:has(input.cell-input.ed-input){
  --detail-cell-input-height:40px;
 }
 #mainWrap .tab-page .sv-funds-split .ed-section .ed-table{
  --detail-cell-input-height:33px;
 }
 #mainWrap .tab-page .op-document-shell .op-table{
  --detail-cell-input-height:36px;
 }
 #mainWrap .tab-page .op-document-shell .op-document-table{
  --detail-cell-input-height:39px;
 }
 #mainWrap .tab-page:not(.mobile-document-layout):not(:where(#page-comparison)) :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table)>tbody>tr>td:has(:is(input:not([type]),input[type="text"],input[type="number"],input[type="search"],input[type="tel"],input[type="url"],input[type="email"],input[type="password"],input[type="date"],input[type="datetime-local"],input[type="month"],input[type="week"],input[type="time"],textarea,select,.sv-cell-lookup)){
  padding:0!important;
 }
 #mainWrap .tab-page:not(.mobile-document-layout):not(:where(#page-comparison)) :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table)>tbody>tr>td :is(input:not([type]),input[type="text"],input[type="number"],input[type="search"],input[type="tel"],input[type="url"],input[type="email"],input[type="password"],input[type="date"],input[type="datetime-local"],input[type="month"],input[type="week"],input[type="time"],textarea,select,.sv-cell-lookup){
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0;
  max-width:100%;
  height:var(--detail-cell-input-height,39px)!important;
  min-height:0;
  margin:0!important;
 }
 #mainWrap .tab-page .op-document-shell .op-table:not(.detail-table-resizable)>tbody>tr>td .op-cell-input{
  min-width:75px;
 }
 #mainWrap .tab-page .erp-document-design .ed-section .ed-table>tbody>tr>td>.ed-picker-control{
  box-sizing:border-box;
  width:100%;
  height:var(--detail-cell-input-height,39px);
  margin:0;
 }
 #mainWrap .tab-page :where(.quotation-line-table,.erp-document-design .ed-section .ed-table,.op-document-shell .op-table)>tbody>tr>td:not([data-col="short_meter_enabled"]) :is(input:not([type]),input[type="text"],input[type="number"],input[type="search"],input[type="tel"],input[type="url"],input[type="email"],input[type="password"],input[type="date"],input[type="datetime-local"],input[type="month"],input[type="week"],input[type="time"],textarea,select,.sv-cell-lookup),
 #mainWrap #page-comparison #compItemBody>tr>td:not([data-col="short_meter_enabled"]) input[type="text"]{
  padding:0 8px!important;
 }
 #mainWrap .tab-page .erp-document-design .ed-section .ed-table>tbody>tr>td .ed-picker-control>input{
  padding-right:31px!important;
 }
 #mainWrap .tab-page .quotation-line-table>tbody>tr>td .si-customer-lookup-control>input{
  padding-right:35px!important;
 }
 #mainWrap .tab-page .quotation-line-table>tbody>tr>td .inquiry-manager-field>input{
  padding-right:38px!important;
 }
}
