/* Default-off audited forms. Preserve existing widths, business colors,
   numeric alignment and multiline controls; only compact presentation changes. */
body.emro-app-shell .emro-form-workbench {
    --emro-color-action: #4f46e5;
    --emro-color-action-hover: #4338ca;
    --emro-color-action-soft: #eef2ff;
    font-family: var(--emro-font-family);
    min-width: 0;
}

/* Full module adapters keep the original renderer geometry and field widths. */
body.emro-app-shell .emro-full-workbench .emro-full-field,
body.emro-app-shell .emro-full-workbench .emro-form-field {
    display: contents;
}

body.emro-app-shell .emro-full-workbench .emro-full-primary-fields {
    display: flow-root;
    flex: 1 1 auto;
    min-width: 0;
}

body.emro-app-shell .emro-full-workbench .emro-form-section {
    display: flow-root;
    padding-block: 0.5rem;
    border-top: 1px solid var(--emro-color-border, #d5dce5);
}

/* The PO query header's identity row retains native fixed-width values and
   labels. Its original 8.33% Bootstrap cells are narrower than those values
   at 16px text, so reserve enough width and let later fields wrap. */
body.emro-app-shell .emro-full-workbench .emro-form-section .emro-po-header-identity-row > .emro-form-field > div[id^="dw_po_order_header_eu_"]:is([id$="_order_type"], [id$="_order_number"], [id$="_requester_location"], [id$="_currency"], [id$="_order_category"]) {
    min-width: min(100%, 8.25rem);
}

/* Requisition protected-query forms retain their native DataWindow controls.
   Their old one-column widths truncate 16px values and let adjacent labels
   collide. Reserve space for the measured fields and allow Bootstrap rows to
   wrap; the unmarked forms and multiline editors keep their original sizes. */
body.emro-app-shell .emro-full-workbench .emro-requisition-header-form div[id^="dw_requisition_header_eu_"]:is([id$="_requistion_type"], [id$="_status"]) {
    min-width: min(100%, 7rem) !important;
}

body.emro-app-shell .emro-full-workbench .emro-requisition-header-form div[id^="dw_requisition_header_eu_"]:is([id$="_wo"], [id$="_task_card"]) {
    min-width: min(100%, 9rem) !important;
}

/* The Inventory Type value is longer than its native three-column menu.
   Keep the complete value and the dropdown trigger together when the form
   wraps at laptop widths. */
body.emro-app-shell .emro-full-workbench .emro-requisition-header-form div[id^="dw_requisition_header_eu_"][id$="_inventory_type"] {
    min-width: min(100%, 17rem) !important;
}

body.emro-app-shell .emro-full-workbench .emro-requisition-detail-form div[id^="dw_requisition_detail_eu_"]:is([id$="_status"], [id$="_gl_expenditure"]) {
    min-width: min(100%, 8.5rem) !important;
}

body.emro-app-shell .emro-full-workbench .emro-requisition-detail-form div[id^="dw_requisition_detail_eu_"][id$="_require_date"] {
    min-width: min(100%, 9.5rem) !important;
}

body.emro-app-shell .emro-full-workbench .emro-requisition-header-form div[id^="dw_requisition_header_eu_"]:is([id$="_requistion_type"], [id$="_status"]) input.ui-inputfield,
body.emro-app-shell .emro-full-workbench .emro-requisition-detail-form div[id^="dw_requisition_detail_eu_"]:is([id$="_status"], [id$="_gl_expenditure"]) input.ui-inputfield {
    min-width: min(100%, 6.75rem) !important;
}

body.emro-app-shell .emro-full-workbench .emro-requisition-detail-form div[id^="dw_requisition_detail_eu_"][id$="_require_date"] input.ui-inputfield {
    min-width: min(100%, 8rem) !important;
}

/* Audited Defect form rows need room for 16px values and complete date masks.
   Only explicitly sized single-line fields opt in; multiline editors and
   unmarked form/table geometry retain their original dimensions. */
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-row,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-ata-group,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action-group {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem 0.75rem;
    min-width: 0;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-row.row::before,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-row.row::after {
    display: none;
    content: none;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-ata-group,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action-group {
    float: none;
    width: auto !important;
    max-width: 100%;
    padding-inline: 0;
}

/* The original ATA and HR/MN containers must not become tall atomic flex
   items. Their existing fields participate in the surrounding native row,
   preserving DOM order, bindings and each field's visibility. */
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-ata-group,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-time-group {
    display: contents;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field {
    display: block;
    flex: 0 1 calc(var(--emro-defect-field-ch, 14ch) + 1rem);
    min-width: min(100%, calc(var(--emro-defect-field-ch, 14ch) + 1rem));
    max-width: 100%;
    font-size: 1rem;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field .ui-outputlabel {
    display: inline-block;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field > div,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field > div > div,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action > div,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action > div > div {
    float: none;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    padding: 0;
    margin-inline: 0;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field input.ui-inputfield,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field .ui-selectonemenu,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field .ui-inputnumber,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field .ui-calendar {
    width: 100% !important;
}

/* These native actions have empty captions and BMP icons. A 32px parent
   leaves the 30px button clear of its original inline max-width:99% cap. */
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action {
    --emro-defect-action-size: max(1.875rem, var(--emro-control-height));
    display: block;
    flex: 0 0 calc(var(--emro-defect-action-size) + 2px);
    min-width: calc(var(--emro-defect-action-size) + 2px);
}

/* Keep the existing renderer's visibility when its wrapper becomes a box. */
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field:not(:has(> div)),
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field:has(> div > div[style*="display: none"]),
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-field:has(> div > div[style*="display:none"]),
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action:not(:has(> div)),
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action:has(> div > div[style*="display: none"]),
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action:has(> div > div[style*="display:none"]) {
    display: none;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action .ui-spacer,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action br,
body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action .ui-button-text {
    display: none !important;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action .ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--emro-defect-action-size) !important;
    min-width: var(--emro-defect-action-size);
    min-height: var(--emro-defect-action-size);
    height: auto !important;
    padding: 0 !important;
    box-sizing: border-box;
}

body.emro-app-shell .emro-full-workbench .emro-defect-form .emro-defect-action .ui-button-icon-left {
    position: static;
    margin: 0 !important;
    transform: none;
    font-size: 1rem;
}

/* The live Defect detail can render its legacy DataWindow inside the standard
   tab scope. Its TAT, Ground Time and two checkboxes share a col-md-8 wrapper;
   the three editors are only 8-17% of that wrapper at desktop widths. */
body.emro-app-shell .emro-detail-field-scope .row > div:has(> div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_hrs"]) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
    min-width: min(100%, 40rem);
    max-width: 100%;
}

body.emro-app-shell .emro-detail-field-scope .row > div:has(> div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_hrs"])
    > div[id^="dw_defect_records_eu_"]:is([id$="_est_turn_around_ground_hrs"], [id$="_est_turn_around_ground_mns"], [id$="_ground_time_require"]) {
    float: none;
    flex: 0 0 var(--emro-defect-legacy-time-width, 8rem);
    width: var(--emro-defect-legacy-time-width, 8rem) !important;
    min-width: min(100%, var(--emro-defect-legacy-time-width, 8rem));
    max-width: 100%;
    padding-inline: 0;
}

body.emro-app-shell .emro-detail-field-scope .row > div:has(> div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_hrs"])
    > div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_mns"] {
    --emro-defect-legacy-time-width: 5rem;
}

body.emro-app-shell .emro-detail-field-scope .row > div:has(> div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_hrs"])
    > div[id^="dw_defect_records_eu_"][id$="_ground_time_require"] {
    --emro-defect-legacy-time-width: 7.5rem;
}

body.emro-app-shell .emro-detail-field-scope .row > div:has(> div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_hrs"])
    > div[id^="dw_defect_records_eu_"]:is([id$="_est_turn_around_ground_hrs"], [id$="_est_turn_around_ground_mns"], [id$="_ground_time_require"]) :is(.ui-inputnumber, input.ui-inputfield) {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
}

body.emro-app-shell .emro-detail-field-scope .row > div:has(> div[id^="dw_defect_records_eu_"][id$="_est_turn_around_ground_hrs"])
    > div[id^="dw_defect_records_eu_"]:is([id$="_est_turn_around_ground_hrs"], [id$="_ground_time_require"]) .ui-outputlabel {
    display: inline-block;
    max-width: 100%;
    white-space: normal !important;
    line-height: 1.25;
}

/* Exact sole-result adapters keep the native tab container and its client IDs. */
body.emro-app-shell .emro-full-workbench .emro-full-single-result-view {
    padding: 0;
    border: 0;
    background: transparent;
}

body.emro-app-shell .emro-full-workbench .emro-full-single-result-view > .ui-tabs-nav {
    display: none;
}

body.emro-app-shell .emro-full-workbench .emro-full-single-result-view > .ui-tabs-panels,
body.emro-app-shell .emro-full-workbench .emro-full-single-result-view > .ui-tabs-panels > .ui-tabs-panel {
    padding: 0;
    border: 0;
}

/* Retained native tools keep their own grants/listeners and gain named icons
   in both query and form layouts. Their old disabled-policy classes stay intact. */
body.emro-app-shell .emro-full-workbench .emro-native-icon-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--emro-control-height);
    height: var(--emro-control-height);
    min-width: var(--emro-control-height);
    min-height: var(--emro-control-height);
    padding: 0 !important;
    box-sizing: border-box;
}

body.emro-app-shell .emro-full-workbench .emro-native-icon-tool .ui-button-text {
    display: none !important;
}

body.emro-app-shell .emro-full-workbench .emro-native-icon-tool .ui-button-icon-left {
    position: static;
    margin: 0 !important;
    transform: none;
    font-size: 1rem;
}

body.emro-app-shell .emro-full-workbench .emro-native-icon-tool img {
    width: 1rem;
    height: 1rem;
}

/* Result actions share the 30px control rhythm. FullResultTools renders its
   controls directly inside .emro-query-results-options; older toolbars use
   .emro-query-results-tools or .emro-dw-toolbar. Keep their native commands,
   grants, accessible names, colors and hover states intact. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) :is(.emro-query-results-options, .emro-query-results-tools, .emro-dw-toolbar) :is(.emro-query-icon-tool, .emro-native-icon-tool) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max(1.875rem, var(--emro-control-height)) !important;
    height: max(1.875rem, var(--emro-control-height)) !important;
    min-width: max(1.875rem, var(--emro-control-height)) !important;
    min-height: max(1.875rem, var(--emro-control-height)) !important;
    padding: 0 !important;
    box-sizing: border-box;
    font-size: 1rem !important;
}

body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) :is(.emro-query-results-options, .emro-query-results-tools, .emro-dw-toolbar) :is(.emro-query-icon-tool, .emro-native-icon-tool) > :is(.ui-button-icon-left, .ui-button-icon-right) {
    position: static !important;
    margin: 0 !important;
    transform: none !important;
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    font-size: 1rem !important;
    line-height: 1;
}

body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) :is(.emro-query-results-options, .emro-query-results-tools, .emro-dw-toolbar) :is(.emro-query-icon-tool, .emro-native-icon-tool) > img {
    width: 1rem !important;
    height: 1rem !important;
    flex-shrink: 0;
}

/* Marked native icon actions also appear in result cells and selection overlays,
   outside the shared toolbar. Give those real-icon buttons the same square size
   when an inherited narrow cell sets the local control height to 26px. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) button.ui-button.ui-button-icon-only:is(.emro-query-icon-tool, .emro-native-icon-tool):has(> :is(.ui-button-icon-left, .ui-button-icon-right)) {
    width: max(1.875rem, var(--emro-control-height)) !important;
    min-width: max(1.875rem, var(--emro-control-height)) !important;
    min-height: max(1.875rem, var(--emro-control-height)) !important;
    box-sizing: border-box;
}

body.emro-app-shell .emro-form-workbench .emro-query-results-table {
    font-size: 0.875rem;
}

body.emro-app-shell .emro-form-workbench .emro-query-results-table thead th {
    font-size: 0.8125rem;
}

/* PrimeFaces' fixed table layout takes action width from the first row.
   Apply explicit widths only to columns containing one native button; mixed
   input/button cells and multi-button cells keep their source widths. */
body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table :is(thead th, tbody td).emro-query-action-column--single-button {
    width: 1.875rem !important;
    min-width: 1.875rem !important;
}

/* A generated visible-caption marker also reserves space before the first
   result arrives, so an empty table's action heading never wraps to 30px. */
body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table :is(thead th, tbody td).emro-query-action-column--single-button.emro-query-action-column--captioned {
    width: 7.5rem !important;
    min-width: 7.5rem !important;
}

/* Match the rendered caption to its own action column. Several tables
   have both an icon Select and a text Notes/Open action; a table-wide :has
   would widen both. PrimeFaces copies each generated slot to its TH and TD. */
body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table:has(tbody td.emro-query-action-slot-1 :is(.emro-query-row-action.ui-button, button.ui-button:not(.ui-button-icon-only))) :is(thead th, tbody td).emro-query-action-slot-1 {
    width: 7.5rem !important;
    min-width: 7.5rem !important;
}

body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table:has(tbody td.emro-query-action-slot-2 :is(.emro-query-row-action.ui-button, button.ui-button:not(.ui-button-icon-only))) :is(thead th, tbody td).emro-query-action-slot-2 {
    width: 7.5rem !important;
    min-width: 7.5rem !important;
}

body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table:has(tbody td.emro-query-action-slot-3 :is(.emro-query-row-action.ui-button, button.ui-button:not(.ui-button-icon-only))) :is(thead th, tbody td).emro-query-action-slot-3 {
    width: 7.5rem !important;
    min-width: 7.5rem !important;
}

body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table:has(tbody td.emro-query-action-slot-4 :is(.emro-query-row-action.ui-button, button.ui-button:not(.ui-button-icon-only))) :is(thead th, tbody td).emro-query-action-slot-4 {
    width: 7.5rem !important;
    min-width: 7.5rem !important;
}

/* Legacy cell actions keep their original widths, labels and business colors. */
body.emro-app-shell .emro-full-workbench .ui-button:not(.emro-query-find):not(.emro-query-row-action):not(.emro-query-icon-tool):not(.ui-datepicker-trigger) {
    min-height: var(--emro-control-height);
    height: auto !important;
    padding-block: 0 !important;
    box-sizing: border-box;
    font-size: 1rem !important;
    line-height: normal;
}

body.emro-app-shell .emro-full-workbench .ui-button:not(.emro-query-find):not(.emro-query-row-action):not(.emro-query-icon-tool):not(.ui-datepicker-trigger) .ui-button-text {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    font-size: inherit;
    line-height: normal;
}

/* Direct bitmap actions in a fixed PrimeFaces grid need content room plus
   the native cell padding. A 2rem content width renders as about 3.25rem
   including the two 10px sides; the button keeps its original 29px width. */
body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table :is(thead th, tbody td).emro-query-action-column--direct-button {
    width: 2rem !important;
    min-width: 2rem !important;
}

/* Some native Select/Open controls keep PrimeFaces' icon-only class even when
   they carry a label. Restore that label without changing the native button. */
body.emro-app-shell .emro-full-workbench .ui-datatable tbody td .emro-query-row-action.ui-button {
    width: auto !important;
    min-width: 5.75rem;
    min-height: var(--emro-control-height);
    height: auto !important;
    padding: 4px 0 !important;
    font-size: 1rem !important;
    line-height: normal;
    box-sizing: border-box;
}

body.emro-app-shell .emro-full-workbench .ui-datatable tbody td .emro-query-row-action.ui-button .ui-button-text {
    display: block;
    width: auto !important;
    padding: 0 0.75rem !important;
    text-indent: 0 !important;
    font-size: inherit !important;
    line-height: normal;
}

/* A few native row actions use data-derived captions instead of Select/Open.
   Keep those labels inside their reserved column even when they are longer
   than the standard button; ordinary short actions remain one 30px line. */
body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table tbody td.emro-query-action-column .emro-native-dw-cell-action > .emro-query-row-action.ui-button,
body.emro-app-shell .emro-full-workbench .ui-datatable.emro-query-results-table tbody td.emro-query-action-column .emro-native-dw-cell-action > .emro-query-row-action.ui-button .ui-button-text {
    max-width: 100% !important;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Cell-action variants and captioned field actions have the same inline
   max-width cap, but do not use the field button's spacer/br structure. Keep
   their native labels visible and let rows grow instead of squeezing letters
   into a thin vertical strip. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) .emro-native-dw-cell-action {
    display: inline-block;
    min-width: max(1.875rem, var(--emro-control-height));
    max-width: 100%;
}

body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) :is(.emro-native-dw-action > div, .emro-native-dw-cell-action) > button.ui-button {
    max-width: none !important;
}

body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) :is(.emro-native-dw-action > div, .emro-native-dw-cell-action) > button.ui-button:not(.ui-button-icon-only) {
    width: max-content !important;
    min-width: max-content !important;
    white-space: nowrap;
}

/* The native button renderer sometimes has no BMP icon class. Its marked
   action still needs a real hit target; named query controls retain their own
   sizing rules. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) :is(.emro-native-dw-action > div, .emro-native-dw-cell-action) > button.ui-button-icon-only:not(:is(.emro-query-find, .emro-query-row-action, .emro-query-icon-tool, .emro-native-icon-tool, .ui-datepicker-trigger)) {
    min-width: max(1.875rem, var(--emro-control-height)) !important;
    min-height: max(1.875rem, var(--emro-control-height)) !important;
    box-sizing: border-box;
}

/* Shared DataWindow field buttons can collapse inside narrow Bootstrap cells.
   PrimeFaces renders p:spacer as an SVG, so identify the renderer's explicit
   marker instead of its spacer markup. The wrapper grows with the action;
   existing hidden inner containers, grants and click listeners stay intact. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) .emro-native-dw-action:has(> div > button.ui-button) {
    width: max-content !important;
    min-width: calc(max(1.875rem, var(--emro-control-height)) + 2px) !important;
    max-width: 100% !important;
    padding-inline: 0;
}

/* The minimum wins over the renderer's inline 99% maximum width. A real icon is required;
   named row actions, shared tools and calendar triggers keep their own rules.
   Do not hide text or change colors, sprite offsets, or native visibility. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) button.ui-button.ui-button-icon-only:not(:is(.emro-query-find, .emro-query-row-action, .emro-query-icon-tool, .emro-native-icon-tool, .ui-datepicker-trigger)):has(> :is(.ui-button-icon-left, .ui-button-icon-right)) {
    position: relative;
    min-width: max(1.875rem, var(--emro-control-height)) !important;
    min-height: max(1.875rem, var(--emro-control-height)) !important;
    height: auto !important;
    box-sizing: border-box;
}

body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) button.ui-button.ui-button-icon-only:not(:is(.emro-query-find, .emro-query-row-action, .emro-query-icon-tool, .emro-native-icon-tool, .ui-datepicker-trigger)) > :is(.ui-button-icon-left, .ui-button-icon-right) {
    position: absolute;
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    margin: 0 !important;
    transform: translate(-50%, -50%);
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem;
    font-size: 1rem !important;
    line-height: 1;
}

/* Audited custom trees keep native node models, viewport sizes and colors. */
body.emro-app-shell .emro-full-workbench .emro-full-tree {
    font-size: 0.875rem;
    line-height: 1.4;
}

body.emro-app-shell .emro-full-workbench .emro-full-tree .ui-treetable-data td {
    padding: 4px 6px;
}

body.emro-app-shell .emro-full-workbench .emro-full-tree .ui-treenode-content {
    padding-block: 2px;
}

body.emro-app-shell .emro-full-workbench .emro-full-tree .ui-treetable-data tr:focus-visible,
body.emro-app-shell .emro-full-workbench .emro-full-tree .ui-treenode-label:focus-visible {
    outline: 2px solid var(--emro-color-action);
    outline-offset: -2px;
}

/* A native DataWindow action can have neither a caption nor an icon at
   runtime. PrimeFaces then omits ui-button-icon-only, so the ordinary
   max-content rule would make it a vertical line. The wrapper marker comes
   from the shared renderer and changes only this empty-caption case. */
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) .emro-native-dw-action.emro-native-empty-caption-action > div > button.ui-button,
body.emro-app-shell :is(.emro-full-workbench, .emro-query-workbench, .emro-form-workbench) .emro-native-dw-cell-action.emro-native-empty-caption-action > button.ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max(1.875rem, var(--emro-control-height)) !important;
    min-width: max(1.875rem, var(--emro-control-height)) !important;
    min-height: max(1.875rem, var(--emro-control-height)) !important;
    height: auto !important;
    padding: 0 !important;
    box-sizing: border-box;
}

/* Detail windows can use the shared DataWindow button renderer without a
   refreshed workbench wrapper. Its empty caption and the renderer's inline
   max-width:99% otherwise shrink the button to a narrow line. Match only the
   explicit empty-caption marker so ordinary legacy buttons keep their size. */
body.emro-app-shell .emro-native-dw-action.emro-native-empty-caption-action:has(> div:not([style*="display:none"]):not([style*="display: none"]) > button.ui-button) {
    min-width: calc(max(1.875rem, var(--emro-control-height)) + 2px) !important;
}

body.emro-app-shell .emro-native-dw-action.emro-native-empty-caption-action > div:not([style*="display:none"]):not([style*="display: none"]) > button.ui-button {
    width: max(1.875rem, var(--emro-control-height)) !important;
    min-width: max(1.875rem, var(--emro-control-height)) !important;
    max-width: none !important;
    min-height: max(1.875rem, var(--emro-control-height)) !important;
    box-sizing: border-box;
}

body.emro-app-shell .emro-form-workbench .ui-inputfield,
body.emro-app-shell .emro-form-workbench .ui-selectonemenu,
body.emro-app-shell .emro-form-workbench .ui-selectcheckboxmenu,
body.emro-app-shell .emro-form-workbench .ui-inputnumber,
body.emro-app-shell .emro-form-workbench .ui-calendar {
    font-size: 1rem !important;
    line-height: normal;
    box-sizing: border-box;
}

body.emro-app-shell .emro-form-workbench input.ui-inputfield {
    min-height: var(--emro-control-height);
    height: auto !important;
    padding-top: 4px;
    padding-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

body.emro-app-shell .emro-form-workbench .ui-outputlabel {
    font-size: 0.875rem !important;
}

body.emro-app-shell .emro-form-workbench .ui-selectonemenu,
body.emro-app-shell .emro-form-workbench .ui-selectcheckboxmenu {
    min-height: var(--emro-control-height);
    height: auto !important;
    padding: 0;
}

body.emro-app-shell .emro-form-workbench .ui-selectonemenu .ui-selectonemenu-label {
    min-height: 0;
    height: auto;
    padding: 4px 0.5rem;
    /* PrimeFaces positions its trigger over the label's right edge. */
    padding-right: 2.5rem;
    border: 0;
    line-height: normal;
}

/* Single-record legacy DataWindows share the same selectOneMenu renderer,
   even where the containing form has not received the workbench adapter. */
body.emro-app-shell .emro-detail-field-scope .ui-selectonemenu .ui-selectonemenu-label {
    padding-right: 2.5rem;
}

body.emro-app-shell .emro-form-workbench .ui-selectonemenu .ui-selectonemenu-trigger,
body.emro-app-shell .emro-form-workbench .ui-selectcheckboxmenu .ui-selectcheckboxmenu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

body.emro-app-shell .emro-form-workbench .ui-selectcheckboxmenu .ui-selectcheckboxmenu-label-container {
    padding: 4px 0.5rem;
    line-height: normal;
}

body.emro-app-shell .emro-form-workbench .ui-selectcheckboxmenu .ui-selectcheckboxmenu-label {
    margin: 0;
    padding: 0;
    font-size: inherit;
    line-height: normal;
}

body.emro-app-shell .emro-form-workbench .ui-inputnumber,
body.emro-app-shell .emro-form-workbench .ui-calendar {
    min-height: 0;
    height: auto !important;
    padding: 0;
    border-width: 0;
}

body.emro-app-shell .emro-form-workbench .ui-calendar .ui-datepicker-trigger {
    height: auto;
    min-height: var(--emro-control-height);
    padding: 0;
}

body.emro-app-shell .emro-form-workbench .ui-button {
    min-height: var(--emro-control-height);
    height: auto;
    box-sizing: border-box;
    font-size: 1rem !important;
    line-height: normal;
}

body.emro-app-shell .emro-form-workbench .ui-button .ui-button-text {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: inherit;
    line-height: normal;
}

body.emro-app-shell .emro-form-workbench .ui-calendar .ui-datepicker-trigger .ui-button-text {
    padding: 0;
}

body.emro-app-shell .emro-form-workbench .ui-state-focus {
    outline: 2px solid var(--emro-color-action);
    outline-offset: 1px;
}

@media (hover: none) and (pointer: coarse) {
    body.emro-app-shell .emro-form-workbench {
        --emro-control-height: var(--emro-control-height-coarse);
    }
}
