/* Button-only adaptation of AgriGlobalSaaS ui-unify.css / accent-palette.css.
   Keep theme tokens local to buttons; page surfaces and controls are untouched. */
:root {
  --os-ui-corner-radius: .65rem;
  --os-ag-button-primary: #123d32;
  --os-ag-button-hover: #195444;
  --os-ag-button-ink: #123d32;
  --os-ag-button-bg: #fff;
  --os-ag-button-border: #dfe7e2;
  --os-ag-button-soft: #e7f3ec;
  --os-ag-button-danger: #b42318;
  --os-ag-button-danger-bg: #fef3f2;
}
:is(html[data-theme="dark"], html[data-bs-theme="dark"], html.os-theme-dark, body[data-theme="dark"], body[data-bs-theme="dark"], body.os-theme-dark) {
  --os-ag-button-primary: #2f7a5c;
  --os-ag-button-hover: color-mix(in srgb, #2f7a5c 78%, #fff);
  --os-ag-button-ink: #8ed0b2;
  --os-ag-button-bg: #17261f;
  --os-ag-button-border: #6d9080;
  --os-ag-button-soft: #274437;
  --os-ag-button-danger: #f97066;
  --os-ag-button-danger-bg: #450a0a;
}
/* The ID arm supplies specificity over legacy per-page important declarations.
   Only marked buttons match; no ancestor layout or visibility is overridden. */
:is(#os-ag-button-scope, body) [data-os-text-button] {
  box-sizing: border-box !important;
  border: 1px solid var(--os-ag-button-border) !important;
  border-radius: var(--os-ui-corner-radius) !important;
  background: var(--os-ag-button-bg) !important;
  color: var(--os-ag-button-ink) !important;
  box-shadow: none !important;
  filter: none !important;
  font-family: inherit !important;
  font-size: .875rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  text-indent: 0 !important;
  gap: .4rem !important;
  min-width: min-content !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 40px !important;
  max-height: none !important;
  padding: .45rem .9rem !important;
  white-space: nowrap !important;
  vertical-align: middle;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s ease !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.os-page-toolbar-icon-btn, .os-app-header-icon-btn, .os-inline-action-icon-btn, .os-row-action, .os-module-toolbar-refresh, .os-window-nav-strip__button, .os-public-window-navigation__button, .btn-close, .dx-closebutton, .app-icon-btn, .app-sidebar__collapse, .os-language-toggle, [data-os-theme-toggle]) {
  width: auto !important;
  max-width: 100% !important;
  flex-basis: auto !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.btn-sm, .os-row-action, .os-inline-action-icon-btn, .page-link) {
  height: auto !important;
  min-height: 32px !important;
  padding-inline: .7rem !important;
  font-size: .8rem !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.btn-lg, .mk-btn-lg) {
  height: auto !important;
  min-height: 44px !important;
  padding-inline: 1.1rem !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:hover:not(:disabled):not(.disabled):not([aria-disabled="true"]) {
  background: var(--os-ag-button-soft) !important;
  border-color: var(--os-ag-button-ink) !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.btn-primary, .btn-success, .os-btn-primary, .login-btn-primary, .mk-btn-primary, .mk-btn-accent, .dx-button-default, .dx-button-success, .swal2-confirm),
:is(#os-ag-button-scope, body) .page-item.active [data-os-text-button] {
  background: var(--os-ag-button-primary) !important;
  border-color: var(--os-ag-button-primary) !important;
  color: #fff !important;
  box-shadow: 0 .6rem 1.4rem rgba(18,61,50,.18) !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.btn-primary, .btn-success, .os-btn-primary, .login-btn-primary, .mk-btn-primary, .mk-btn-accent, .dx-button-default, .dx-button-success, .swal2-confirm):hover:not(:disabled):not(.disabled):not([aria-disabled="true"]) {
  background: var(--os-ag-button-hover) !important;
  border-color: var(--os-ag-button-hover) !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.btn-danger, .btn-outline-danger, .dx-button-danger, [data-os-toolbar="delete"], [data-os-toolbar="reject"], .os-row-action--delete) {
  color: var(--os-ag-button-danger) !important;
  border-color: var(--os-ag-button-danger) !important;
  box-shadow: none !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(.btn-danger, .btn-outline-danger, .dx-button-danger, [data-os-toolbar="delete"], [data-os-toolbar="reject"], .os-row-action--delete):hover:not(:disabled):not(.disabled) {
  background: var(--os-ag-button-danger-bg) !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:focus-visible {
  outline: 2px solid var(--os-ag-button-ink) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--os-ag-button-primary) 28%, transparent) !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is([aria-pressed="true"], [aria-expanded="true"], .os-btn-selected):not(.btn-primary):not(.btn-success) {
  background: var(--os-ag-button-soft) !important;
  border-color: var(--os-ag-button-ink) !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button]:is(:disabled, .disabled, [aria-disabled="true"]) {
  opacity: .55 !important;
  box-shadow: none !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button][hidden] {
  display: none !important;
}
/* Hide decorative icons only. Loading indicators still provide feedback. */
:is(#os-ag-button-scope, body) [data-os-text-button] :is(i, .bi, svg, img, .dx-icon, .os-erp-action-icon, .os-icon-qcap, .os-language-caret, [data-os-button-icon]) {
  display: none !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button].dropdown-toggle::after,
:is(#os-ag-button-scope, body) [data-os-text-button]::before {
  content: none !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button] .os-button-text-label,
:is(#os-ag-button-scope, body) [data-os-text-button] :is(.os-toolbar-caption, .os-toolbar-label),
:is(#os-ag-button-scope, body) [data-os-text-button].os-row-action > span:not(.visually-hidden):not(.sr-only):not(.bi):not(.os-erp-action-icon) {
  display: inline !important;
  position: static !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  white-space: nowrap !important;
  font: inherit !important;
  color: inherit !important;
  opacity: 1 !important;
}
:is(#os-ag-button-scope, body) [data-os-short-caption] {
  font-size: 0 !important;
}
:is(#os-ag-button-scope, body) [data-os-short-caption] > :not(.os-button-text-label):not(.spinner-border):not(.spinner-grow) {
  display: none !important;
}
:is(#os-ag-button-scope, body) [data-os-short-caption] > .os-button-text-label {
  font-size: .875rem !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}
:is(#os-ag-button-scope, body) [data-os-short-caption]:is(.btn-sm, .os-row-action, .page-link) > .os-button-text-label {
  font-size: .8rem !important;
}
@media (pointer: coarse) {
  :is(#os-ag-button-scope, body) [data-os-text-button] {
    height: auto !important;
    min-height: 44px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(#os-ag-button-scope, body) [data-os-text-button] { transition: none !important; }
}

/* =============================================================================
   AgriGlobalSaaS field system
   This is intentionally loaded with the global button design asset so every
   shell (Farm, Facility, Settings and administration) receives the same field
   language without changing a page's markup or binding behaviour.
   ============================================================================= */
:root {
  --os-ag-field-height: 2.5rem;
  --os-ag-field-radius: var(--os-ui-corner-radius);
  --os-ag-field-pad-x: .8rem;
  --os-ag-field-border: var(--os-input-border, var(--os-color-form-border, #b8c9c0));
  --os-ag-field-bg: var(--os-input-bg, var(--os-color-form-control-bg, #fff));
  --os-ag-field-text: var(--os-input-text, var(--os-color-input-text, #1a2e24));
  --os-ag-field-placeholder: var(--os-input-placeholder, var(--os-color-placeholder, #718076));
  --os-ag-field-focus: var(--os-input-focus-border, var(--os-color-focus-border, #146c43));
  --os-ag-field-focus-ring: var(--os-input-focus-ring, var(--os-color-focus-ring, rgba(20, 108, 67, .28)));
  --os-ag-field-hover: color-mix(in srgb, var(--os-ag-field-border) 62%, var(--os-ag-field-focus));
  --os-ag-field-label: var(--os-color-form-label-text, var(--os-text, var(--os-color-text, #1a2e24)));
}

body {
  --os-ag-field-border: var(--os-input-border, var(--os-color-form-border, #b8c9c0));
  --os-ag-field-bg: var(--os-input-bg, var(--os-color-form-control-bg, #fff));
  --os-ag-field-text: var(--os-input-text, var(--os-color-input-text, #1a2e24));
  --os-ag-field-placeholder: var(--os-input-placeholder, var(--os-color-placeholder, #718076));
  --os-ag-field-focus: var(--os-input-focus-border, var(--os-color-focus-border, #146c43));
  --os-ag-field-focus-ring: var(--os-input-focus-ring, var(--os-color-focus-ring, rgba(20, 108, 67, .28)));
  --os-ag-field-hover: color-mix(in srgb, var(--os-ag-field-border) 62%, var(--os-ag-field-focus));
  --os-ag-field-label: var(--os-color-form-label-text, var(--os-text, var(--os-color-text, #1a2e24)));
}

/* Native fields and the DevExtreme editor wrapper use the same compact,
   rounded surface.  Excluding button-style inputs protects page actions. */
:is(#os-ag-button-scope, body) :is(
  .form-control,
  .form-select,
  input[type="text"], input[type="number"], input[type="email"],
  input[type="password"], input[type="search"], input[type="tel"],
  input[type="url"], input[type="date"], input[type="time"],
  input[type="datetime-local"], input[type="month"], input[type="week"],
  textarea,
  select,
  .login-input,
  .module-main-filter-select,
  .prs-station-select,
  .rotation-toolbar-select,
  .dx-texteditor
) {
  border: 1px solid var(--os-ag-field-border) !important;
  border-radius: var(--os-ag-field-radius) !important;
  background-color: var(--os-ag-field-bg) !important;
  color: var(--os-ag-field-text) !important;
  box-shadow: none !important;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease !important;
}

:is(#os-ag-button-scope, body) :is(
  .form-control,
  .form-select,
  input[type="text"], input[type="number"], input[type="email"],
  input[type="password"], input[type="search"], input[type="tel"],
  input[type="url"], input[type="date"], input[type="time"],
  input[type="datetime-local"], input[type="month"], input[type="week"],
  select,
  .login-input,
  .module-main-filter-select,
  .prs-station-select,
  .rotation-toolbar-select
):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) {
  min-height: var(--os-ag-field-height) !important;
  padding-inline: var(--os-ag-field-pad-x) !important;
}

/* Keep the selected value out of the caret's background area in both directions. */
:is(#os-ag-button-scope, body.os-app-shell) select.form-select:not([multiple]):not([size]:not([size="1"])):not(#ags-export-invoice-year) {
  padding-inline-end: max(var(--os-ag-field-pad-x), 2.3rem) !important;
  background-position: right 0.65rem center !important;
}

:is(#os-ag-button-scope, body.os-app-shell) select.form-select:not([multiple]):not([size]:not([size="1"])):not(#ags-export-invoice-year):dir(rtl) {
  background-position: left 0.65rem center !important;
}

:is(#os-ag-button-scope, body) textarea {
  min-height: calc(var(--os-ag-field-height) * 1.65) !important;
  padding: .6rem var(--os-ag-field-pad-x) !important;
  line-height: 1.42 !important;
  resize: vertical;
}

/* DevExtreme keeps its own input and button nodes; style them as one field. */
:is(#os-ag-button-scope, body) .dx-texteditor {
  min-height: var(--os-ag-field-height) !important;
  overflow: hidden;
}
:is(#os-ag-button-scope, body) .dx-texteditor-input {
  min-height: calc(var(--os-ag-field-height) - 2px) !important;
  padding-inline: var(--os-ag-field-pad-x) !important;
  color: var(--os-ag-field-text) !important;
  background: transparent !important;
}
:is(#os-ag-button-scope, body) .dx-texteditor-buttons-container,
:is(#os-ag-button-scope, body) .dx-dropdowneditor-button,
:is(#os-ag-button-scope, body) .dx-texteditor-container {
  min-height: calc(var(--os-ag-field-height) - 2px) !important;
}
:is(#os-ag-button-scope, body) .dx-dropdowneditor-button {
  width: 2.45rem !important;
  border-inline-start: 1px solid color-mix(in srgb, var(--os-ag-field-border) 72%, transparent) !important;
}

/* Input groups read as one component even when an icon, unit, or field action
   shares the row with the editor. */
:is(#os-ag-button-scope, body) .input-group > :is(.input-group-text, .form-control, .form-select, .btn) {
  min-height: var(--os-ag-field-height) !important;
}
:is(#os-ag-button-scope, body) .input-group-text {
  color: var(--os-ag-field-placeholder) !important;
  background: color-mix(in srgb, var(--os-ag-field-bg) 88%, var(--os-ag-field-focus)) !important;
  border-color: var(--os-ag-field-border) !important;
}
:is(#os-ag-button-scope, body) .input-group > .input-group-text:first-child {
  border-radius: var(--os-ag-field-radius) 0 0 var(--os-ag-field-radius) !important;
}
:is(#os-ag-button-scope, body) .input-group > .input-group-text:last-child {
  border-radius: 0 var(--os-ag-field-radius) var(--os-ag-field-radius) 0 !important;
}

/* Hover and focus are visible, but do not move nearby fields. */
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .login-input, .module-main-filter-select, .prs-station-select, .rotation-toolbar-select, .dx-texteditor):hover:not(:disabled):not([readonly]):not(.dx-state-disabled):not(.dx-state-readonly) {
  border-color: var(--os-ag-field-hover) !important;
}
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .login-input, .module-main-filter-select, .prs-station-select, .rotation-toolbar-select):focus,
:is(#os-ag-button-scope, body) .dx-texteditor.dx-state-focused {
  border-color: var(--os-ag-field-focus) !important;
  box-shadow: 0 0 0 .2rem var(--os-ag-field-focus-ring) !important;
  outline: 0 !important;
}
:is(#os-ag-button-scope, body) .input-group:focus-within > :is(.input-group-text, .form-control, .form-select) {
  border-color: var(--os-ag-field-focus) !important;
}

:is(#os-ag-button-scope, body) :is(input, textarea, select, .dx-texteditor-input)::placeholder,
:is(#os-ag-button-scope, body) .dx-placeholder,
:is(#os-ag-button-scope, body) .dx-placeholder::before {
  color: var(--os-ag-field-placeholder) !important;
  opacity: 1 !important;
}

/* A field's label is deliberately quieter than its value, matching the
   AgriGlobalSaaS hierarchy and remaining readable in either theme. */
:is(#os-ag-button-scope, body) :is(.form-label, .col-form-label, .os-form-field > label, .os-lookup-field > label, .os-upload > label) {
  color: var(--os-ag-field-label) !important;
  font-size: .8125rem !important;
  font-weight: 700 !important;
  letter-spacing: .01em;
  margin-bottom: .34rem !important;
}

/* File inputs, checks, radios and switches are all form elements too. */
:is(#os-ag-button-scope, body) input[type="file"] {
  min-height: var(--os-ag-field-height) !important;
  padding: .25rem !important;
  color: var(--os-ag-field-text) !important;
  background: var(--os-ag-field-bg) !important;
  border: 1px solid var(--os-ag-field-border) !important;
  border-radius: var(--os-ag-field-radius) !important;
}
:is(#os-ag-button-scope, body) input[type="file"]::file-selector-button {
  height: 1.9rem;
  margin-inline-end: .6rem;
  padding: 0 .7rem;
  color: var(--os-ag-field-text);
  background: color-mix(in srgb, var(--os-ag-field-bg) 84%, var(--os-ag-field-focus));
  border: 0;
  border-radius: calc(var(--os-ag-field-radius) - .14rem);
  font: inherit;
  font-weight: 700;
}
:is(#os-ag-button-scope, body) :is(.form-check-input, .dx-checkbox-icon, .dx-radiobutton-icon) {
  position: static !important;
  float: none !important;
  margin-inline: 0 !important;
  width: 1.15rem !important;
  height: 1.15rem !important;
  flex: 0 0 auto;
  background-color: var(--os-ag-field-bg, var(--os-color-surface, #fff)) !important;
  border-width: 1px !important;
  border-color: var(--os-ag-field-border, #8aa394) !important;
  border-radius: .3rem !important;
  box-shadow: none !important;
}
:is(#os-ag-button-scope, body) .form-check-input[type="radio"],
:is(#os-ag-button-scope, body) .dx-radiobutton-icon { border-radius: 50% !important; }
:is(#os-ag-button-scope, body) :is(.form-check-input, .dx-checkbox-icon, .dx-radiobutton-icon):checked,
:is(#os-ag-button-scope, body) .dx-checkbox-checked .dx-checkbox-icon {
  background-color: var(--os-ag-field-focus) !important;
  border-color: var(--os-ag-field-focus) !important;
}
:is(#os-ag-button-scope, body) .form-switch .form-check-input {
  width: 2.4rem !important;
  height: 1.3rem !important;
  border-radius: 999px !important;
}

/* Read-only and disabled values remain legible and clearly distinct. */
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]), textarea, select, .dx-texteditor).dx-state-readonly,
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]), textarea, select)[readonly] {
  background-color: var(--os-input-readonly-bg, color-mix(in srgb, var(--os-ag-field-bg) 90%, var(--os-ag-field-border))) !important;
  color: var(--os-ag-field-text) !important;
  opacity: 1 !important;
}
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]), textarea, select, .dx-texteditor).dx-state-disabled,
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]), textarea, select):disabled {
  background-color: var(--os-input-disabled-bg, var(--os-ag-field-bg)) !important;
  border-color: var(--os-ag-field-border) !important;
  color: var(--os-text-muted, var(--os-color-text-muted)) !important;
  opacity: .7 !important;
}

@media (prefers-reduced-motion: reduce) {
  :is(#os-ag-button-scope, body) :is(.form-control, .form-select, input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]), select, textarea, .dx-texteditor) { transition: none !important; }
}

/* Form fields use open spacing rather than spreadsheet-like cell frames.
   Data tables deliberately remain outside this scope. */
:is(#os-ag-button-scope, body) :is(.os-desktop-form-table, .aps-site-table),
:is(#os-ag-button-scope, body) :is(.os-desktop-form-table, .aps-site-table) :is(th, td),
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid),
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid) :is(.field, .field-row-triple, .field-row-split, .field-marks-split, label:first-child, .ags-export-invoice-inline-fields > .form-control, .aps-qcap-inspection-controls > .form-control, .aps-qcap-inspection-controls > .aps-qcap-inline-sub-label) {
  border-color: transparent !important;
}

:is(#os-ag-button-scope, body) :is(.os-desktop-form-table, .aps-site-table),
:is(#os-ag-button-scope, body) :is(.os-desktop-form-table, .aps-site-table) :is(th, td),
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid),
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid) :is(.field, .field-row-triple, .field-row-split, .field-marks-split, label:first-child, .ags-export-invoice-inline-fields > .form-control, .aps-qcap-inspection-controls > .form-control, .aps-qcap-inspection-controls > .aps-qcap-inline-sub-label) {
  border-style: none !important;
}

/* Keep stacked fields distinct after removing the old cell rules.  The gap is
   intentionally small so dense ERP forms remain compact without collisions. */
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .prs-export-order-header-grid) {
  row-gap: .4rem !important;
}
:is(#os-ag-button-scope, body) :is(.aps-qcap-protocol-form-grid, .os-form-field-grid) {
  row-gap: .4rem !important;
}
:is(#os-ag-button-scope, body) :is(.os-desktop-form-table, .aps-site-table) {
  border-collapse: separate !important;
  border-spacing: 0 .4rem !important;
}

/* Grid-form pages previously relied on cell dividers for the lower edge.
   Keep that edge on the actual editor now that the dividers are gone. */
:is(#os-ag-button-scope, body) :is(.os-desktop-form-table, .aps-site-table, .ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid) :is(.form-control, .form-select, .login-input, .module-main-filter-select, .prs-station-select, .rotation-toolbar-select, .dx-texteditor, .aps-native-tagbox) {
  border-bottom: 1px solid var(--os-ag-field-border) !important;
}

/* ERP form rows have a common minimum height, while their containers remain
   content-sized.  A fixed wrapper height clips compound editors (file rows,
   tag selectors, input groups) and lets the following row paint over them. */
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid) {
  --os-ffg-row-height: var(--os-ag-field-height) !important;
}
:is(#os-ag-button-scope, body) .ags-export-invoice-header-grid {
  --ags-export-invoice-row-height: var(--os-ag-field-height) !important;
}
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .prs-export-order-header-grid, .os-form-field-grid) :is(.field-row-triple, .field-row-split, .field-marks-split),
:is(#os-ag-button-scope, body) :is(.ags-export-invoice-header-grid, .ags-export-invoice-footer-fields, .prs-export-order-header-grid, .aps-qcap-protocol-form-grid, .os-form-field-grid) .field {
  min-height: var(--os-ag-field-height) !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  align-self: stretch !important;
}

/* Text buttons must participate in their hosts' layout instead of overflowing
   the old fixed icon boxes. These rules only adjust button groups and chrome. */
:is(#os-ag-button-scope, body) :is(.os-page-toolbar, .os-unified-page-action-bar, .os-global-page-navigation, .os-voice-cluster, .app-topbar__actions, .app-topbar__support-cluster, .app-topbar__user-cluster, .modal-footer, .os-confirm-dialog__actions) {
  flex-wrap: wrap !important;
  gap: .4rem !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
}
/* Table action columns stay one horizontal row on every page. */
:is(#os-ag-button-scope, body) :is(.os-row-actions, .os-row-actions__form) {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: var(--os-row-action-gap, 0.25rem) !important;
  width: max-content !important;
  min-width: max-content !important;
  max-width: none !important;
  height: auto !important;
  max-height: none !important;
}
:is(#os-ag-button-scope, body) .os-row-actions :is(.os-row-action, [data-os-text-button], .btn, a, button) {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
}
:is(#os-ag-button-scope, body) .app-topbar {
  flex-wrap: wrap !important;
  height: auto !important;
  max-height: none !important;
}
:is(#os-ag-button-scope, body) .app-topbar__actions > :is(.os-company-activity, .os-voice-cluster, .app-topbar__language, .app-dropdown) {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
:is(#os-ag-button-scope, body) .app-topbar__search {
  min-width: 0 !important;
  width: auto !important;
  flex: 1 1 14rem !important;
  max-width: 100% !important;
}
:is(#os-ag-button-scope, body) .app-topbar__search [data-os-text-button] {
  width: 100% !important;
}
:is(#os-ag-button-scope, body) .app-sidebar__window-navigation {
  height: auto !important;
  max-height: none !important;
}
:is(#os-ag-button-scope, body) .app-sidebar__window-navigation .os-window-nav-strip__controls {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem !important;
  width: 100% !important;
  min-width: 0 !important;
}
:is(#os-ag-button-scope, body) .app-sidebar__window-navigation :is([data-os-text-button], .os-window-nav-strip__refresh-host) {
  width: 100% !important;
  min-width: 0 !important;
}
:is(#os-ag-button-scope, body.is-sidebar-collapsed) .app-sidebar__window-navigation .os-window-nav-strip__controls {
  grid-template-columns: minmax(0, 1fr);
}
/* Sidebar chrome keeps compact icons and reserves space for search adornments. */
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__window-navigation .os-window-nav-strip__controls {
  grid-template-columns: repeat(4, 2.5rem) !important;
  justify-content: center !important;
}
:is(#os-ag-button-scope, body).os-module-shell.is-sidebar-collapsed .app-sidebar__window-navigation .os-window-nav-strip__controls {
  grid-template-columns: 2.5rem !important;
}
:is(#os-ag-button-scope, body).os-module-shell [data-os-text-button][data-os-icon-button="sidebar"]:not([data-os-icon-button="topbar"]):not([data-os-icon-button="topbar-profile"]) {
  flex: 0 0 2.5rem !important;
  width: 2.5rem !important;
  min-width: 2.5rem !important;
  max-width: 2.5rem !important;
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  max-height: 2.5rem !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__search {
  padding: 0 !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__search input#sidebar-search {
  padding-inline-start: 2.5rem !important;
  padding-inline-end: 3rem !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__search-icon {
  left: auto !important;
  right: auto !important;
  inset-inline-start: .8rem !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__search-clear {
  inset-inline-end: .2rem !important;
  border: 0 !important;
  background: transparent !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__search-clear[data-os-text-button][data-os-icon-button][hidden] {
  display: none !important;
}
/* A shared explicit reservation replaces the old 2.65rem icon offset. */
:is(#os-ag-button-scope, body.login-shell.login-shell-branded) > .login-theme-toggle {
  width: 2.65rem !important;
  max-width: 2.65rem !important;
  top: max(.75rem, env(safe-area-inset-top, 0px)) !important;
  inset-inline-end: max(.75rem, env(safe-area-inset-right, 0px)) !important;
}
:is(#os-ag-button-scope, body.login-shell.login-shell-branded) > .login-welcome-language-bar:not(.os-howitworks-topbar) {
  top: max(.75rem, env(safe-area-inset-top, 0px)) !important;
  inset-inline-end: calc(max(.75rem, env(safe-area-inset-right, 0px)) + 2.65rem + .6rem) !important;
}
:is(#os-ag-button-scope, body.login-shell.login-shell-branded) > .login-branded-layout {
  margin-top: max(4.5rem, calc(env(safe-area-inset-top, 0px) + 3.75rem)) !important;
  padding-top: .75rem !important;
}
:is(#os-ag-button-scope, body.login-shell.login-shell-branded) > :is(.os-whatsapp-hub, .os-support-whatsapp-fab) {
  top: max(.75rem, env(safe-area-inset-top, 0px)) !important;
  bottom: auto !important;
  inset-inline-start: auto !important;
  inset-inline-end: calc(max(.75rem, env(safe-area-inset-right, 0px)) + 2.65rem + 3.4rem + 1.2rem) !important;
  width: max-content !important;
}
:is(#os-ag-button-scope, body.login-shell.login-shell-branded) .os-whatsapp-hub__menu {
  position: fixed !important;
  top: calc(max(.75rem, env(safe-area-inset-top, 0px)) + 3rem + .4rem) !important;
  bottom: auto !important;
  inset-inline-end: max(.75rem, env(safe-area-inset-right, 0px)) !important;
  max-width: calc(100vw - 1.5rem);
}
/* Preserve the space occupied by login field adornments after the shared
   field theme sets its horizontal padding. Logical sides also support RTL. */
:is(#os-ag-button-scope, body.login-shell) :is(#login-company, #login-username, #login-password, #login-authorization, #login-module) {
  padding-inline-start: 2.4rem !important;
}
:is(#os-ag-button-scope, body.login-shell) select#login-module {
  padding-inline-end: 2rem !important;
}
:is(#os-ag-button-scope, body.login-shell) .login-password-wrap #login-password {
  padding-inline-end: 3rem !important;
}
:is(#os-ag-button-scope, body.login-shell) .login-password-toggle[data-os-icon-button] {
  width: 2.25rem !important;
  min-width: 2.25rem !important;
  max-width: 2.25rem !important;
  height: 2.25rem !important;
  min-height: 2.25rem !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
:is(#os-ag-button-scope, body.login-shell) :is(.login-theme-toggle, .os-whatsapp-hub__fab)[data-os-icon-button] {
  width: 2.65rem !important;
  min-width: 2.65rem !important;
  max-width: 2.65rem !important;
  height: 2.65rem !important;
  padding: 0 !important;
}
@media (max-width: 960px) {
  /* The map's former icon rails and floating inspector cannot share the same
     pixels with text controls. Stack their hosts below the map on phones. */
  :is(#os-ag-button-scope, body) .ags-land-measure-page {
    overflow-y: auto !important;
    touch-action: pan-y;
  }
  :is(#os-ag-button-scope, body) .ags-land-measure-layout {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
  }
  :is(#os-ag-button-scope, body) .ags-land-measure-map-panel {
    height: auto !important;
    overflow: visible !important;
    touch-action: pan-y;
  }
  :is(#os-ag-button-scope, body) .ags-land-measure-map-clip {
    position: relative !important;
    inset: auto !important;
    order: 0;
    height: 280px !important;
    min-height: 280px !important;
    flex: 0 0 280px !important;
  }
  :is(#os-ag-button-scope, body) :is(.ags-land-measure-map-actions, .ags-earth-mode-switcher, .ags-earth-field-dock, .ags-land-measure-hud) {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    display: flex !important;
    flex-flow: row wrap !important;
    gap: .4rem !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: .4rem !important;
    order: 1;
  }
  :is(#os-ag-button-scope, body) .ags-land-measure-side {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    order: 2;
  }
  :is(#os-ag-button-scope, body) .ags-land-measure-layout.is-panel-collapsed .ags-land-measure-side {
    display: none !important;
  }
}

/* Table action and header controls are compact icons; full names remain in
   title/aria-label. Original controls and their event handlers stay intact. */
:is(#os-ag-button-scope, body) [data-os-text-button][data-os-icon-button]:not([data-os-icon-button="topbar"]):not([data-os-icon-button="topbar-profile"]) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 28px !important;
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  border-radius: .4rem !important;
  font-size: 0 !important;
  line-height: 1 !important;
  overflow: hidden !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button][data-os-icon-button="header"] {
  flex-basis: 22px !important;
  width: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button][data-os-icon-button]:not([data-os-icon-button="topbar"]):not([data-os-icon-button="topbar-profile"]) > :not(.os-button-icon-label):not([data-os-native-button-icon]):not(.spinner-border):not(.spinner-grow) {
  display: none !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button][data-os-icon-button]:not([data-os-icon-button="topbar"]):not([data-os-icon-button="topbar-profile"]) > :is(.os-button-icon-label, [data-os-native-button-icon]) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: static !important;
  width: 1rem !important;
  height: 1rem !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  font-size: .85rem !important;
  line-height: 1 !important;
  color: inherit !important;
}
:is(#os-ag-button-scope, body) [data-os-text-button][data-os-icon-button]:not([data-os-icon-button="topbar"]):not([data-os-icon-button="topbar-profile"]) > .os-button-icon-label :is(i, .bi, svg, img, .dx-icon, .os-erp-action-icon, .os-icon-qcap, [data-os-button-icon]) {
  display: inline-block !important;
  font-size: .85rem !important;
  line-height: 1 !important;
  color: inherit !important;
}
:is(#os-ag-button-scope, body) [data-os-icon-button]:not([data-os-icon-button="topbar"]):not([data-os-icon-button="topbar-profile"]) > .os-button-icon-label :is(svg, img) {
  width: 1em !important;
  height: 1em !important;
}
:is(#os-ag-button-scope, body) .os-th-chrome {
  align-items: center !important;
  gap: .2rem !important;
}
:is(#os-ag-button-scope, body) .os-th-chrome > .os-th-chrome__title {
  display: block !important;
  font: inherit !important;
  color: inherit !important;
}
:is(#os-ag-button-scope, body) [data-os-icon-button="header"]:has(.os-th-chrome__arrow[data-dir="asc"]) .os-button-icon-label i::before {
  content: "\2191" !important;
}
:is(#os-ag-button-scope, body) [data-os-icon-button="header"]:has(.os-th-chrome__arrow[data-dir="desc"]) .os-button-icon-label i::before {
  content: "\2193" !important;
}

/* Sidebar chrome: retain one desktop menu control and keep the collapsed rail
   compact.  The same markup is used by every module page. */
body.os-module-shell.has-sidebar #sidebar-open {
  display: none !important;
}

@media (min-width: 992px) {
  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__collapse {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.55rem !important;
    min-width: 2.55rem !important;
    height: 2.55rem !important;
    min-height: 2.55rem !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 1 !important;
    overflow: hidden !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__collapse .os-button-text-label {
    display: none !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__collapse > i {
    display: inline-block !important;
    margin: 0 !important;
    font-size: 1rem !important;
    line-height: 1 !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__window-navigation {
    padding: .4rem !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__window-navigation .os-window-nav-strip__controls {
    display: grid !important;
    grid-template-columns: 2.5rem !important;
    justify-content: center !important;
    gap: .45rem !important;
    width: 100% !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__window-navigation :is(.os-window-nav-strip__button, .os-window-nav-strip__refresh-host, .os-window-nav-strip__refresh-host [data-os-toolbar="refresh"]) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.5rem !important;
    min-width: 2.5rem !important;
    max-width: 2.5rem !important;
    height: 2.5rem !important;
    min-height: 2.5rem !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0 !important;
    line-height: 1 !important;
    overflow: hidden !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__window-navigation [data-os-text-button] .os-button-text-label {
    display: none !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .app-sidebar__window-navigation :is(.os-window-nav-strip__button, .os-window-nav-strip__refresh-host [data-os-toolbar="refresh"]) > i {
    display: inline-block !important;
    margin: 0 !important;
    font-size: 1rem !important;
    line-height: 1 !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed :is(.app-sidebar__modules, .app-sidebar__scroll) {
    padding-inline: .4rem !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed .sb-list {
    gap: .45rem !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed :is(.sb-link, .sb-group__toggle) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.55rem !important;
    min-width: 2.55rem !important;
    max-width: 2.55rem !important;
    height: 2.55rem !important;
    min-height: 2.55rem !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-collapsed :is(.sb-link__text, .sb-group__name, .sb-group__chevron) {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  body.os-module-shell.has-sidebar #sidebar-open {
    display: inline-flex !important;
  }

  body.os-module-shell.has-sidebar #sidebar-collapse {
    display: none !important;
  }
}

/* The filter row is already server-rendered.  Keep it visible while the
   optional action collector settles, so opening a page never leaves an empty
   band that appears a moment later.  Dynamic actions retain their own gate. */
html.os-first-paint-settling body.os-module-shell .os-module-toolbar,
html.os-first-paint-revealing body.os-module-shell .os-module-toolbar,
html.os-chrome-settling:not(.os-first-paint-settling) body.os-module-shell .os-module-toolbar,
html.os-chrome-revealing:not(.os-first-paint-revealing) body.os-module-shell .os-module-toolbar {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

body.os-module-shell .os-module-toolbar-filter-row {
  min-height: 3.25rem;
  contain: layout;
}

/* Align the brand, context chips, command rail and filter row as one header. */
body.os-module-shell {
  --topbar-h: 4rem;
}
body.os-module-shell .app-topbar {
  gap: .6rem !important;
  padding: .65rem 1rem !important;
  min-height: 4rem !important;
  box-sizing: border-box;
}
body.os-module-shell .app-sidebar__brand {
  min-height: 4rem;
  box-sizing: border-box;
  padding: .65rem .85rem;
}
body.os-module-shell .app-sidebar__window-navigation {
  padding: .5rem .85rem !important;
}
body.os-module-shell .app-sidebar__search {
  margin: .3rem .85rem .85rem;
}
body.os-module-shell .app-topbar__actions {
  gap: .4rem !important;
  flex-shrink: 0;
}
body.os-module-shell .app-topbar__company,
body.os-module-shell .os-erp-topbar__facility {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  box-sizing: border-box;
  border-radius: var(--os-ui-corner-radius);
  padding: .4rem .65rem;
  min-width: 0;
}
body.os-module-shell .app-topbar__company > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
body.os-module-shell .os-erp-topbar__facility-label {
  flex: 0 0 auto;
}
body.os-module-shell .os-module-toolbar-inner {
  padding-block: .5rem !important;
}
body.os-module-shell .os-module-toolbar-filter-row {
  align-items: center;
  min-height: 2.5rem;
}
@media (max-width: 1199.98px) {
  body.os-module-shell .app-topbar {
    flex-wrap: wrap;
    height: auto !important;
    max-height: none !important;
  }
  body.os-module-shell .app-topbar__actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    max-width: 100%;
    row-gap: .4rem !important;
  }
}
@media (max-width: 767.98px) {
  body.os-module-shell .app-topbar {
    gap: .45rem !important;
    padding: .5rem .65rem !important;
  }
  body.os-module-shell .app-topbar__actions {
    flex-basis: 100%;
    justify-content: space-between;
  }
}

/* Compact module header controls: one predictable square per command keeps
   the header stable while its optional services are initializing. */
body.os-module-shell .app-topbar__search {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body.os-module-shell .app-topbar :is(.os-erp-nav-search__open, [data-os-icon-button="topbar"], .os-language-toggle, .app-profile__toggle) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 2.5rem !important;
  width: 2.5rem !important;
  min-width: 2.5rem !important;
  max-width: 2.5rem !important;
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  max-height: 2.5rem !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  border: 1px solid var(--os-app-control-border, var(--shell-line)) !important;
  border-radius: var(--os-ui-corner-radius) !important;
  background: var(--os-app-control-bg, var(--shell-surface)) !important;
  color: var(--os-app-control-color, var(--shell-ink)) !important;
  box-shadow: none !important;
}

body.os-module-shell .app-topbar :is(.os-erp-nav-search__open, [data-os-icon-button="topbar"], .os-language-toggle, .app-profile__toggle):hover,
body.os-module-shell .app-topbar :is(.os-language-selector--shell.is-open .os-language-toggle, .app-profile.is-open .app-profile__toggle) {
  border-color: var(--shell-accent, var(--os-color-primary)) !important;
  background: var(--os-app-control-hover-bg, var(--shell-accent-soft)) !important;
}

body.os-module-shell .app-topbar [data-os-icon-button="topbar"] > :is(.os-button-icon-label, [data-os-native-button-icon]),
body.os-module-shell .app-topbar .os-erp-nav-search__open > i {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.1rem !important;
  height: 1.1rem !important;
  margin: 0 !important;
  font-size: 1.1rem !important;
  line-height: 1 !important;
}

/* This overrides the normal text-button rule for the header's real icons. */
:is(#os-ag-button-scope, body).os-module-shell .app-topbar [data-os-text-button][data-os-icon-button="topbar"] :is(i, .bi, svg, img, .dx-icon, .os-erp-action-icon, .os-icon-qcap, [data-os-button-icon]) {
  display: inline-block !important;
  margin: 0 !important;
  font-size: 1.1rem !important;
  line-height: 1 !important;
}

body.os-module-shell .app-topbar .os-erp-nav-search__placeholder,
body.os-module-shell .app-topbar .os-erp-nav-search__kbd,
body.os-module-shell .app-topbar [data-os-icon-button="topbar"] .os-button-text-label,
body.os-module-shell .app-topbar .os-language-toggle :is(.os-language-code, .os-language-caret),
body.os-module-shell .app-topbar .app-profile__name {
  display: none !important;
}

body.os-module-shell .app-topbar .os-language-toggle .os-language-flag-img {
  display: block !important;
  width: 1.65rem !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: .12rem;
}

body.os-module-shell .app-topbar .app-profile__toggle {
  background: var(--shell-accent, var(--os-color-primary)) !important;
  border-color: var(--shell-accent, var(--os-color-primary)) !important;
}

body.os-module-shell .app-topbar .app-profile__avatar {
  display: grid !important;
  width: 1.9rem !important;
  height: 1.9rem !important;
  background: transparent !important;
  color: var(--os-btn-text-on-fill) !important;
  font-size: .9rem !important;
}

/* Same specificity as the common button baseline above, so the header never
   inherits the generic text-button dimensions after its icon pass. */
:is(#os-ag-button-scope, body).os-module-shell .app-topbar :is([data-os-text-button][data-os-icon-button="topbar"], [data-os-text-button][data-os-icon-button="topbar-profile"]) {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 2.5rem !important;
  width: 2.5rem !important;
  min-width: 2.5rem !important;
  max-width: 2.5rem !important;
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  max-height: 2.5rem !important;
  padding: 0 !important;
  gap: 0 !important;
  border: 1px solid var(--os-app-control-border, var(--shell-line)) !important;
  border-radius: var(--os-ui-corner-radius) !important;
  background: var(--os-app-control-bg, var(--shell-surface)) !important;
  color: var(--os-app-control-color, var(--shell-ink)) !important;
}

:is(#os-ag-button-scope, body).os-module-shell .app-topbar [data-os-text-button][data-os-icon-button="topbar-profile"] {
  background: var(--os-ag-button-primary) !important;
  border-color: var(--os-ag-button-primary) !important;
  color: #fff !important;
}

body.os-module-shell .app-topbar .os-support-whatsapp-link {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border: 1px solid var(--os-app-control-border, var(--shell-line)) !important;
  border-radius: var(--os-ui-corner-radius) !important;
  background: var(--os-app-control-bg, var(--shell-surface)) !important;
}

/* === Global input contrast, scroll clearance and invoice seam repair === */
/* Keep every editable surface legible in both themes. The explicit edge token
   prevents low-contrast page variables from making a field's bottom edge vanish. */
:root {
  --os-ag-field-edge: #718a7d;
}
:is(html[data-theme="dark"], html[data-bs-theme="dark"], html.os-theme-dark, body[data-theme="dark"], body[data-bs-theme="dark"], body.os-theme-dark) {
  --os-ag-field-edge: #91ad9f;
}
:is(#os-ag-button-scope, body) :is(
  .form-control, .form-select, .login-input, .module-main-filter-select,
  .prs-station-select, .rotation-toolbar-select, .dx-texteditor,
  .aps-native-tagbox, .ags-export-invoice-dx-select-host,
  input[type="text"], input[type="number"], input[type="email"],
  input[type="password"], input[type="search"], input[type="tel"],
  input[type="url"], input[type="date"], input[type="time"],
  input[type="datetime-local"], input[type="month"], input[type="week"],
  select, textarea
) {
  border-color: var(--os-ag-field-edge) !important;
  border-width: 1px !important;
  border-style: solid !important;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--os-ag-field-edge) 82%, transparent) !important;
}
:is(#os-ag-button-scope, body) :is(.form-control, .form-select, .dx-texteditor, .aps-native-tagbox, .ags-export-invoice-dx-select-host):focus-within,
:is(#os-ag-button-scope, body) :is(input, select, textarea):focus {
  border-color: var(--os-ag-field-focus) !important;
  box-shadow: 0 0 0 .2rem var(--os-ag-field-focus-ring), inset 0 -1px 0 var(--os-ag-field-focus) !important;
}

/* The scrolling main area owns the space above the persistent footer. */
body.os-module-shell:not(.os-table-fill-page) .app-main > main.os-app-main,
body.os-app-shell:not(.login-shell):not(.os-module-shell):not(.os-report-layout):not(.os-table-fill-page) > .container-fluid > .os-app-main,
body.os-report-layout:not(.os-table-fill-page) > .container-fluid > .os-app-main {
  padding-block-end: max(.85rem, env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-block-end: max(.85rem, env(safe-area-inset-bottom, 0px)) !important;
  box-sizing: border-box !important;
}

/* Flex pages frequently use an inner full-height panel.  Its final row must
   remain reachable above the footer instead of being clipped by that panel. */
body.os-module-shell:not(.os-table-fill-page) .app-main > main.os-app-main > :is(.os-erp-page, [data-os-erp-page="true"], .os-page-scroll),
body.os-app-shell:not(.login-shell):not(.os-module-shell):not(.os-report-layout):not(.os-table-fill-page) > .container-fluid > .os-app-main > :is(.os-erp-page, [data-os-erp-page="true"], .os-page-scroll),
body.os-report-layout:not(.os-table-fill-page) > .container-fluid > .os-app-main > :is(.os-erp-page, [data-os-erp-page="true"], .os-page-scroll) {
  min-height: min-content !important;
  padding-block-end: max(.85rem, env(safe-area-inset-bottom, 0px)) !important;
  scroll-margin-block-end: max(.85rem, env(safe-area-inset-bottom, 0px)) !important;
}

/* First paint uses the server-rendered filter/action strips.  They are already
   valid controls, so do not hide them while JavaScript makes its one in-place
   reconciliation pass. */
html.os-first-paint-settling body.os-app-shell:not(.login-shell) .os-module-toolbar,
html.os-first-paint-revealing body.os-app-shell:not(.login-shell) .os-module-toolbar,
html.os-chrome-settling body.os-app-shell:not(.login-shell) .os-module-toolbar,
html.os-chrome-revealing body.os-app-shell:not(.login-shell) .os-module-toolbar,
html.os-chrome-settling body.os-app-shell:not(.login-shell) main :is(.os-page-toolbar, .os-erp-toolbar, .os-page-header-chrome-right, .os-erp-page-header__actions, .os-title-actions-row__actions, .module-main-header-actions),
html.os-first-paint-settling body.os-app-shell:not(.login-shell) main :is(.os-page-toolbar, .os-erp-toolbar, .os-page-header-chrome-right, .os-erp-page-header__actions, .os-title-actions-row__actions, .module-main-header-actions) {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
html.os-chrome-settling body.os-module-shell .os-module-toolbar #os-app-page-toolbar-slot,
html.os-chrome-settling body.os-module-shell .os-module-toolbar #os-app-page-toolbar-slot > .os-unified-page-action-bar,
html.os-first-paint-settling body.os-module-shell .os-module-toolbar #os-app-page-toolbar-slot,
html.os-first-paint-settling body.os-module-shell .os-module-toolbar #os-app-page-toolbar-slot > .os-unified-page-action-bar {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Invoice Cert and JAS CB are one visual column; preserve the row separators
   in the neighbouring columns but remove the seam inside this control column. */
.ags-export-invoice-edit-page .ags-export-invoice-header-grid .field-row-triple:has(.ags-export-invoice-certificate-field) {
  border-bottom: 0 !important;
}
.ags-export-invoice-edit-page .ags-export-invoice-header-grid .field-row-triple:has(.ags-export-invoice-certificate-field) > .field:not(.ags-export-invoice-certificate-field) {
  border-bottom: 1px solid var(--ags-export-invoice-separator) !important;
}

/* Invoice Cert is a compound selector: its chip and chooser keep their own
   boundaries, but the TagBox wrapper must not draw a second square around them. */
.ags-export-invoice-edit-page .ags-export-invoice-header-grid .ags-export-invoice-certificate-host .aps-native-tagbox {
  border: 0 !important;
  border-bottom: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Remove the spreadsheet-cell frame around the certificate compound control.
   Its chip and select remain separately actionable and visibly bordered. */
.ags-export-invoice-edit-page .ags-export-invoice-header-grid .field-row-triple > .ags-export-invoice-certificate-field {
  border-inline-end: 0 !important;
  border-block-end: 0 !important;
}
.ags-export-invoice-edit-page .ags-export-invoice-header-grid .field-row-triple:has(#export-invoice-date) {
  border-bottom: 0 !important;
}
.ags-export-invoice-edit-page .ags-export-invoice-header-grid .field-row-triple:has(#export-invoice-date) > .field:not(:has(#export-invoice-date)) {
  border-bottom: 1px solid var(--ags-export-invoice-separator) !important;
}

/* The edit invoice page is content-sized.  The former desktop flex rule made
   both the form and its page overflow:hidden, so the final fields were painted
   beneath the black scroll boundary.  Main owns the scroll and the form keeps
   a real end clearance above the persistent footer. */
@media (min-width: 1100px) {
  body.os-app-body:has(.ags-export-invoice-edit-page) > .container-fluid > .os-app-main {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px)) !important;
  }
  body.os-app-shell:not(.login-shell) .os-app-main > :only-child.ags-export-invoice-edit-page,
  .ags-export-invoice-edit-page,
  .ags-export-invoice-edit-page .ags-export-invoice-form {
    flex: 1 0 auto !important;
    min-height: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
  .ags-export-invoice-edit-page .ags-export-invoice-form {
    background: var(--os-color-surface, var(--os-color-form-control-bg)) !important;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* QCAP's "In specific" control is a multi-value TagBox.  It cannot share the
   fixed one-line field height used by the rest of the protocol grid; doing so
   paints the following Lot row on top of its chips. */
.aps-qcap-protocol-edit-page .aps-qcap-protocol-form-grid .field.field-wide,
.aps-qcap-protocol-edit-page .aps-qcap-protocol-form-grid .field:has(.aps-qcap-in-specific-host) {
  height: auto !important;
  min-height: var(--os-ag-field-height) !important;
  max-height: none !important;
  overflow: visible !important;
}
.aps-qcap-protocol-edit-page .aps-qcap-in-specific-host,
.aps-qcap-protocol-edit-page .aps-qcap-in-specific-host .aps-native-tagbox,
.aps-qcap-protocol-edit-page .aps-qcap-in-specific-host .aps-native-tagbox-chips {
  height: auto !important;
  min-height: var(--os-ag-field-height) !important;
  max-height: none !important;
  overflow: visible !important;
}
.aps-qcap-protocol-edit-page .aps-qcap-protocol-detail-scroll {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)) !important;
}

@media (min-width: 992px) and (orientation: landscape) {
  /* QCAP has one deliberate vertical scroll owner: the protocol detail panel.
     The surrounding app frame remains viewport-sized, so the final fields stay
     reachable and no ancestor can clip or steal the scroll range. */
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) .app-main > main.os-app-main {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) .aps-qcap-protocol-edit-page {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) :is(.aps-qcap-content-panel, .aps-qcap-protocol-edit-layout, .aps-qcap-protocol-detail-column) {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) .aps-qcap-protocol-detail-scroll {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  
  }

/* On narrow or portrait displays the app frame is height-constrained. Keep the
   protocol page in normal document flow and let the shared main area scroll. */
@media (max-width: 991.98px), (orientation: portrait), (max-aspect-ratio: 1/1) {
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) .app-main > main.os-app-main {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) .aps-qcap-protocol-edit-page,
  body.os-module-shell:has(.aps-qcap-protocol-edit-page) :is(.aps-qcap-content-panel, .aps-qcap-protocol-edit-layout, .aps-qcap-protocol-detail-column, .aps-qcap-protocol-detail-scroll) {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }
}
/* Raw caption nodes are retained for translation and diagnostics, but the
   generated single-word label is the only visible caption. */
:is(#os-ag-button-scope, body) [data-os-short-caption] > .os-button-original-text {
  display: none !important;
}
@media (max-width: 1199.98px) {
  body.os-module-shell .app-topbar :is(.os-erp-nav-search__open, [data-os-icon-button="topbar"], .os-language-toggle, .app-profile__toggle) {
    flex-basis: 2.5rem !important;
    width: 2.5rem !important;
    min-width: 2.5rem !important;
    max-width: 2.5rem !important;
    height: 2.5rem !important;
    min-height: 2.5rem !important;
    max-height: 2.5rem !important;
    border-radius: .7rem !important;
  }

  body.os-module-shell .app-topbar .app-profile__avatar {
    width: 2rem !important;
    height: 2rem !important;
  }

  body.os-module-shell .app-topbar .os-support-whatsapp-link {
    width: 2.5rem !important;
    height: 2.5rem !important;
    border-radius: .7rem !important;
  }
}

/* QCAP Protocol uses the page body as its only vertical scroll owner.  Several
   nested flex containers previously competed for the same height; the final
   certificate row could therefore be painted below a clipped scroll region. */
body.os-app-body.os-module-shell.os-dedicated-export-page:has(.aps-qcap-protocol-edit-page .aps-qcap-protocol-detail-scroll) .app-main > main.os-app-main {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)) !important;
  scroll-padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)) !important;
}

body.os-app-body.os-module-shell.os-dedicated-export-page:has(.aps-qcap-protocol-edit-page .aps-qcap-protocol-detail-scroll) .aps-qcap-protocol-edit-page.aps-qcap-protocol-page,
body.os-app-body.os-module-shell.os-dedicated-export-page:has(.aps-qcap-protocol-edit-page .aps-qcap-protocol-detail-scroll) .aps-qcap-protocol-edit-page.aps-qcap-protocol-page :is(.aps-qcap-content-panel, .aps-qcap-protocol-edit-layout, .aps-qcap-protocol-detail-column, .aps-qcap-protocol-detail-scroll) {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: block !important;
}

body.os-app-body.os-module-shell.os-dedicated-export-page:has(.aps-qcap-protocol-edit-page .aps-qcap-protocol-detail-scroll) .aps-qcap-protocol-detail-scroll {
  padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px)) !important;
}

/* The certificate actions may wrap onto a second line.  Let their field and
   grid row grow with the content instead of clipping the second line. */
body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-certificate-grid,
body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-certificate-grid .field {
  min-height: max-content !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-certificate-grid {
  grid-template-rows: minmax(5rem, auto) !important;
  align-items: start !important;
}

/* The native multi-select contains its chips and selector on separate lines.
   Give that one grid row its natural height so it cannot be covered by Lot or
   the certificate heading. */
body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-protocol-form-grid:has(.aps-qcap-in-specific-host) {
  grid-auto-rows: minmax(var(--os-ag-field-height), max-content) !important;
}

body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .field:has(.aps-qcap-in-specific-host) {
  min-height: calc(var(--os-ag-field-height) + var(--os-ag-field-height) + var(--os-ag-field-height)) !important;
  height: auto !important;
  align-items: flex-start !important;
}

body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-in-specific-host,
body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-in-specific-host .aps-native-tagbox {
  min-height: calc(var(--os-ag-field-height) + var(--os-ag-field-height)) !important;
  height: auto !important;
}

/* Marked by the protocol script after the native TagBox is created.  It spans
   the compact grid rows it needs, so subsequent Lot and certificate controls
   always begin after the complete selector. */
body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-in-specific-field {
  grid-row: span 3 !important;
  min-height: 0 !important;
  height: auto !important;
}

body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-in-specific-field > .aps-qcap-in-specific-host {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: calc(var(--os-ag-field-height) + var(--os-ag-field-height)) !important;
}

/* Lot also has a label row and a values row.  Reserve both grid rows before
   the certificate section so its heading never overlays the Lot controls. */
body.os-app-body.os-module-shell.os-dedicated-export-page .aps-qcap-protocol-edit-page .aps-qcap-lot-field {
  grid-row: span 2 !important;
  min-height: 0 !important;
  height: auto !important;
}

/* Portrait protocol forms use a readable label/value sequence.  In the compact
   Lot row the desktop metrics previously consumed the available line before
   the Lot value received space; stack those metrics on narrow screens. */
@media (max-width: 991.98px), (orientation: portrait), (max-aspect-ratio: 1/1) {
  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page .aps-qcap-protocol-form-grid .field {
    grid-column: 1 / -1 !important;
    border-inline-end: 0 !important;
  }

  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page .aps-qcap-lot-field {
    grid-row: auto !important;
  }

  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page .aps-qcap-lot-controls {
    grid-template-columns: max-content minmax(0, 1fr) !important;
    grid-template-areas:
      "lot lot"
      "sample-label sample"
      "weight-label weight" !important;
    row-gap: .4rem !important;
  }

  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page .aps-qcap-lot-input { grid-area: lot !important; min-width: 0 !important; }
  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page .aps-qcap-lot-controls > label:nth-of-type(1) { grid-area: sample-label !important; }
  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page #qcap-lab-sample-size { grid-area: sample !important; min-width: 0 !important; }
  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page .aps-qcap-lot-controls > label:nth-of-type(2) { grid-area: weight-label !important; }
  body.os-app-body.os-module-shell .aps-qcap-protocol-edit-page #qcap-lot-weight { grid-area: weight !important; min-width: 0 !important; }
}

/* Keep column names and bare sort/filter icons together in reading order. */
:is(#os-ag-button-scope, body) table.os-erp-data-table th.os-th-has-chrome .os-th-chrome {
  display: inline !important;
  white-space: nowrap !important;
}
:is(#os-ag-button-scope, body) table.os-erp-data-table th.os-th-has-chrome {
  white-space: nowrap !important;
}
:is(#os-ag-button-scope, body) table.os-erp-data-table th.os-th-has-chrome .os-th-chrome__title {
  display: inline !important;
  min-width: 0;
  width: auto !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  line-height: 1.35 !important;
  text-align: start;
}
/* Override the shared button skin, including hover, without changing the
   native controls' keyboard access or their existing event handlers. */
:is(#os-ag-button-scope, body) :is(th, [role="columnheader"]) [data-os-text-button][data-os-icon-button="header"],
:is(#os-ag-button-scope, body) .os-th-chrome > :is(.os-th-chrome__sort, .os-th-chrome__funnel) {
  display: inline-flex !important;
  vertical-align: middle !important;
  width: max(24px, 1.5rem) !important;
  min-width: max(24px, 1.5rem) !important;
  max-width: max(24px, 1.5rem) !important;
  height: max(24px, 1.5rem) !important;
  min-height: max(24px, 1.5rem) !important;
  max-height: max(24px, 1.5rem) !important;
  padding: 0 !important;
  margin: 0 .1rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
  opacity: .7;
  cursor: pointer;
}
:is(#os-ag-button-scope, body) .os-th-chrome > :is(.os-th-chrome__sort, .os-th-chrome__funnel):is(:hover, :focus-visible, .is-active) {
  opacity: 1;
  color: var(--os-ag-button-ink) !important;
}
:is(#os-ag-button-scope, body) :is(th, [role="columnheader"]) [data-os-text-button][data-os-icon-button="header"]:is(:hover, :focus, :focus-visible, :active, [aria-expanded="true"], [aria-pressed="true"]):not(:disabled):not(.disabled):not([aria-disabled="true"]) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
:is(#os-ag-button-scope, body) .os-th-chrome > :is(.os-th-chrome__sort, .os-th-chrome__funnel):focus-visible {
  outline: 2px solid currentColor !important;
  outline-offset: 2px;
}
/* Columns grow with the inline header contents. The existing table scroll
   host contains the extra width on smaller screens, including invoices. */
:is(#os-ag-button-scope, body) main table.os-erp-data-table:has(th.os-th-has-chrome),
:is(#os-ag-button-scope, body) main .ags-export-invoice-edit-page table.ags-export-invoice-details-table.os-erp-data-table:has(th.os-th-has-chrome) {
  table-layout: auto !important;
  width: max-content !important;
  min-width: 100% !important;
  max-width: none !important;
}
:is(#os-ag-button-scope, body) .prs-export-order-edit-page #peo-details-table col.peo-col-sn,
:is(#os-ag-button-scope, body) .prs-export-order-edit-page #peo-details-table thead th:first-child {
  width: 3.5rem !important;
}

/* Lookup search is a real adjacent field, not an overlay on the select's
   text and native arrow. This applies to every shared lookup editor. */
:is(#os-ag-button-scope, body) .os-lookup-field:has(> .os-lookup-field__filter):has(> select) {
  display: grid !important;
  grid-template-columns: 2.5rem minmax(0, 1fr) !important;
  align-items: center;
  gap: .3rem;
  min-width: 0;
  width: 100%;
}
:is(#os-ag-button-scope, body) .os-lookup-field > .os-lookup-field__filter {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: var(--os-ag-field-height, 2.5rem) !important;
  min-height: 0 !important;
  padding-inline: .4rem !important;
  color: var(--os-ag-field-text, var(--os-color-text)) !important;
  background-color: var(--os-ag-field-bg, var(--os-color-surface)) !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='%232f6b45' stroke-width='1.8'/%3E%3Cpath d='m10 10 4 4' stroke='%232f6b45' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
:is(html[data-theme="dark"], html.os-theme-dark, body.os-theme-dark) :is(#os-ag-button-scope, body) .os-lookup-field > .os-lookup-field__filter {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='%23d7efe2' stroke-width='1.8'/%3E%3Cpath d='m10 10 4 4' stroke='%23d7efe2' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field.os-lookup-field--short:has(> .os-lookup-field__filter):has(> select) {
  grid-template-columns: minmax(0, 1fr) !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field.os-lookup-field--short > .os-lookup-field__filter {
  display: none !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field > select {
  min-width: 0 !important;
  padding-inline-end: 2rem !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field:has(> .os-lookup-field__filter:focus),
:is(#os-ag-button-scope, body) .os-lookup-field:has(> .os-lookup-field__filter:not(:placeholder-shown)) {
  grid-template-columns: minmax(5rem, .45fr) minmax(0, 1fr) !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field > .os-lookup-field__filter:focus,
:is(#os-ag-button-scope, body) .os-lookup-field > .os-lookup-field__filter:not(:placeholder-shown) {
  background-image: none !important;
}

/* Lookup selects no longer show a separate search field beside the combo. */
:is(#os-ag-button-scope, body) .os-lookup-field:has(> select) {
  grid-template-columns: minmax(0, 1fr) !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field > .os-lookup-field__filter {
  display: none !important;
}
:is(#os-ag-button-scope, body) .os-lookup-field > select {
  grid-column: 1 / -1 !important;
  width: 100% !important;
}

/* Mobile navigation is an off-canvas overlay.  Hiding the complete sidebar
   while closed prevents descendants restored by navigation state from ever
   painting over a form during a resize or initial page load. */
@media (orientation: portrait), (max-aspect-ratio: 1/1), (max-width: 767.98px) {
  body.os-module-shell.has-sidebar:not(.is-sidebar-open) > #app-sidebar {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.os-module-shell.has-sidebar.is-sidebar-open > #app-sidebar {
    visibility: visible !important;
    pointer-events: auto !important;
  }
}



/* One app identity in the green title bar and one sidebar toggle in topbar. */
:is(#os-ag-button-scope, body).os-module-shell.os-has-titlebar-brand {
  --os-brand-titlebar-height: max(32px, var(--os-wco-title-height, 32px));
  padding-top: var(--os-brand-titlebar-height) !important;
  box-sizing: border-box;
}
:is(#os-ag-button-scope, body).os-module-shell.os-has-titlebar-brand #app-sidebar {
  top: var(--os-brand-titlebar-height) !important;
  height: calc(100dvh - var(--os-brand-titlebar-height) - var(--os-app-footer-height, 1.5rem)) !important;
  max-height: calc(100dvh - var(--os-brand-titlebar-height) - var(--os-app-footer-height, 1.5rem)) !important;
  margin-block: 0 !important;
}
.os-shell-titlebar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--os-brand-titlebar-height, 32px);
  z-index: 40;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding-left: max(12px, var(--os-wco-safe-left, 0px));
  padding-right: max(12px, var(--os-wco-safe-right, 0px));
  background: #126b45;
  color: #fff;
  direction: ltr;
  -webkit-app-region: drag;
}
:is(#os-ag-button-scope, body) .os-shell-titlebar .app-sidebar__logo {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 8px;
  width: auto !important;
  min-width: 0;
  max-width: 100%;
  color: #fff !important;
  text-decoration: none;
  -webkit-app-region: no-drag;
}
:is(#os-ag-button-scope, body) .os-shell-titlebar .app-sidebar__mark {
  width: 24px !important;
  height: 24px !important;
  flex: 0 0 24px;
}
:is(#os-ag-button-scope, body) .os-shell-titlebar .app-sidebar__title {
  display: inline !important;
  color: #fff !important;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
:is(#os-ag-button-scope, body).os-module-shell .app-sidebar__brand,
:is(#os-ag-button-scope, body).os-module-shell #sidebar-collapse {
  display: none !important;
}
:is(#os-ag-button-scope, body).os-module-shell #sidebar-open {
  display: inline-flex !important;
}
:is(#os-ag-button-scope, body).os-module-shell.is-sidebar-collapsed :is(.sb-group__toggle, .sb-subgroup__toggle) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 2.5rem !important;
  width: 2.5rem !important;
  min-width: 2.5rem !important;
  max-width: 2.5rem !important;
  height: 2.5rem !important;
  min-height: 2.5rem !important;
  padding: 0 !important;
  overflow: hidden !important;
}
:is(#os-ag-button-scope, body).os-module-shell.is-sidebar-collapsed :is(.sb-group__toggle, .sb-subgroup__toggle) > :is(.os-button-text-label, .sb-group__name, .sb-subgroup__name, .sb-group__chevron, .sb-subgroup__chevron) {
  display: none !important;
}
:is(#os-ag-button-scope, body).os-module-shell.is-sidebar-collapsed :is(.sb-group__toggle, .sb-subgroup__toggle) > .sb-icon {
  display: inline-block !important;
  font-size: 1rem !important;
  margin: 0 !important;
  color: inherit !important;
}
:is(#os-ag-button-scope, body).os-module-shell.is-sidebar-collapsed :is(.sb-group__toggle, .sb-subgroup__toggle) > .os-nav-alert-dot {
  display: block !important;
}
@media (max-width: 767.98px), (orientation: portrait), (max-aspect-ratio: 1/1) {
  :is(#os-ag-button-scope, body).os-module-shell.os-has-titlebar-brand #app-sidebar,
  :is(#os-ag-button-scope, body).os-module-shell.os-has-titlebar-brand #sidebar-backdrop {
    top: calc(var(--os-brand-titlebar-height) + var(--os-brand-topbar-height, 4rem)) !important;
    height: calc(100dvh - var(--os-brand-titlebar-height) - var(--os-brand-topbar-height, 4rem) - var(--os-app-footer-height, 1.5rem)) !important;
    margin-block: 0 !important;
  }
}

/* The command rail owns its palette and geometry, including before the
   button enhancer runs. Keep these rules above the generic button priority. */
:is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions {
  --os-rail-bg: #ffffff;
  --os-rail-ink: #173d30;
  --os-rail-border: #768f82;
  --os-rail-hover: #e3efe8;
  --os-rail-size: 2.5rem;
  align-items: center !important;
  gap: .4rem !important;
}
:is(html[data-theme="dark"], html[data-bs-theme="dark"], html.os-theme-dark, body[data-theme="dark"], body[data-bs-theme="dark"], body.os-theme-dark)
  :is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions,
:is(#os-ag-button-scope, body).os-module-shell:is([data-theme="dark"], [data-bs-theme="dark"], .os-theme-dark) .app-topbar .app-topbar__actions {
  --os-rail-bg: #293b32;
  --os-rail-ink: #f1f8f4;
  --os-rail-border: #829d8e;
  --os-rail-hover: #365343;
}
:is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions
  :is(.app-icon-btn, .os-language-toggle, .app-profile__toggle, .os-support-whatsapp-link, .os-connectivity-status) {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 var(--os-rail-size) !important;
  width: var(--os-rail-size) !important;
  min-width: var(--os-rail-size) !important;
  max-width: var(--os-rail-size) !important;
  height: var(--os-rail-size) !important;
  min-height: var(--os-rail-size) !important;
  max-height: var(--os-rail-size) !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid var(--os-rail-border) !important;
  border-radius: var(--os-ui-corner-radius) !important;
  background: var(--os-rail-bg) !important;
  color: var(--os-rail-ink) !important;
  line-height: 1 !important;
  box-shadow: none !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions
  :is(.app-icon-btn, .os-language-toggle, .app-profile__toggle, .os-support-whatsapp-link, .os-connectivity-status):is(:hover, [aria-expanded="true"], [aria-pressed="true"]) {
  background: var(--os-rail-hover) !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions
  :is(.app-icon-btn, .os-language-toggle, .app-profile__toggle, .os-support-whatsapp-link, .os-connectivity-status):focus-visible {
  outline: 2px solid var(--os-rail-ink) !important;
  outline-offset: 3px !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions
  :is(.app-icon-btn, .os-support-whatsapp-link, .os-connectivity-status) :is(i, .bi, svg, .os-button-icon-label) {
  color: inherit !important;
  font-size: 1.15rem !important;
  line-height: 1 !important;
}
:is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions .app-profile__avatar {
  place-items: center !important;
  color: inherit !important;
  background: transparent !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
}
@media (pointer: coarse) {
  :is(#os-ag-button-scope, body).os-module-shell .app-topbar .app-topbar__actions {
    --os-rail-size: 2.75rem;
  }
}

/* Stable first-paint geometry for every module page. The shell promotes page
   actions into the shared toolbar after the server markup is painted; without
   a reserved layout box that promotion moves filters and the page surface for
   one or two frames (the visible navigation jump). */
body.os-module-shell .app-topbar,
body.os-module-shell .os-module-toolbar,
body.os-module-shell .os-module-toolbar-inner,
body.os-module-shell .os-module-toolbar-filter-row {
  overflow-anchor: none;
}

body.os-module-shell .app-topbar {
  contain: layout style;
  contain-intrinsic-size: auto 4.5rem;
}

body.os-module-shell .os-module-toolbar {
  contain: layout style;
  contain-intrinsic-size: auto 7rem;
}

body.os-module-shell .os-module-toolbar-filter-row {
  min-block-size: 2.5rem;
  contain: layout style;
  contain-intrinsic-size: auto 2.5rem;
}

body.os-module-shell .os-app-main {
  overflow-anchor: none;
}

@media (min-width: 1200px) {
  body.os-module-shell .app-topbar {
    min-block-size: 4.5rem;
  }

  body.os-module-shell .os-module-toolbar {
    min-block-size: 6.75rem;
  }
}

/* Shared action heights and vertical alignment across the page shells. */
:root {
  --os-ag-action-height: 2.5rem;
  --os-ag-grid-action-height: 1.75rem;
  --os-erp-toolbar-btn-height: var(--os-ag-action-height);
}

@media (pointer: coarse) {
  :root {
    --os-ag-action-height: 2.75rem;
  }
}

:is(#os-ag-button-scope, body) :is(
  .btn, .mk-btn, .swal2-styled, .login-btn, .login-side-btn, .module-main-btn,
  .os-page-toolbar-btn, .os-page-toolbar-icon-btn, .os-page-toolbar-labeled-btn,
  .os-inline-action-icon-btn, .os-record-navigation-button,
  [data-os-text-button], [data-os-toolbar]
):not(.btn-link):not(.btn-close):not(.dropdown-item):not([role="tab"]):not(:where(
  [data-os-icon-button="header"], [data-os-icon-button="action"], .os-row-action,
  th *, [role="columnheader"] *, .os-row-actions *, .dx-texteditor *,
  .dropdown-menu *, .app-sidebar__search *, .aps-native-tagbox *,
  .login-password-wrap *, .os-brand-titlebar *, .os-whatsapp-hub__fab,
  .os-support-whatsapp-fab, .ags-product-balance-cell-field, .aei-product-pick
)) {
  box-sizing: border-box !important;
  height: var(--os-ag-action-height) !important;
  min-height: var(--os-ag-action-height) !important;
  max-height: var(--os-ag-action-height) !important;
  padding-block: 0 !important;
  align-content: center !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
}

:is(#os-ag-button-scope, body) :is(
  .os-page-toolbar, .os-unified-page-action-bar, .os-global-page-navigation,
  .os-filter-actions, .modal-footer, .os-confirm-dialog__actions, .btn-group
) {
  align-items: center !important;
}

:is(#os-ag-button-scope, body) .os-row-actions :is(.os-row-action, [data-os-icon-button="action"]) {
  box-sizing: border-box !important;
  height: var(--os-ag-grid-action-height) !important;
  min-height: var(--os-ag-grid-action-height) !important;
  max-height: var(--os-ag-grid-action-height) !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
}

/* Match visible component frames even in older page-specific form layouts. */
@layer os-record-form-layout {
  :is(#os-ag-button-scope, body) :is(
    button, input:is([type="button"], [type="submit"], [type="reset"]),
    .btn, .dx-button, .os-row-action, [role="button"], [data-os-text-button],
    .form-control, .form-select, .login-input, .module-main-filter-select,
    .prs-station-select, .rotation-toolbar-select, .dx-texteditor,
    .aps-native-tagbox, .aps-native-tagbox-chip, [role="combobox"],
    .card, .os-section, .os-section-title, .os-erp-card, .os-erp-panel,
    .modal-content, .dropdown-menu, .dx-overlay-content, [role="listbox"],
    .os-ms-combo-menu, .os-auth-role-picker-panel, .li-balance-dropdown,
    .app-dropdown__panel, .os-language-menu, .mk-nav-dropdown,
    .os-erp-data-table-host, .ags-export-invoice-details-panel,
    .ags-export-invoice-products-header
  ):not(:where(
    .rounded-pill, .rounded-circle, .form-check-input, .btn-link, .dx-button-mode-text,
    .input-group > *, .btn-group > *, .btn-group-vertical > *,
    .os-th-chrome *, .dx-texteditor-input, .btn-close, .accordion-button,
    :is(.nav-tabs, .nav-underline) .nav-link, .os-support-whatsapp-fab, .ags-land-measure-compass
  )) {
    border-radius: var(--os-ui-corner-radius) !important;
  }

  :is(#os-ag-button-scope, body) :is(
    input:not([type]), input:is(
      [type="text"], [type="number"], [type="email"], [type="password"], [type="search"],
      [type="tel"], [type="url"], [type="date"], [type="time"], [type="datetime-local"],
      [type="month"], [type="week"], [type="file"], [type="color"]
    ), select, textarea
  ):not(:where(.input-group > *, .dx-texteditor-input)) {
    border-radius: var(--os-ui-corner-radius) !important;
  }

  /* Keep adjoining edges flush. Logical corners follow the input group's direction. */
  :is(#os-ag-button-scope, body) .input-group > :is(.input-group-text, .form-control, .form-select, .btn) {
    border-start-start-radius: 0 !important;
    border-end-start-radius: 0 !important;
    border-start-end-radius: 0 !important;
    border-end-end-radius: 0 !important;
  }

  :is(#os-ag-button-scope, body) .input-group > :is(.input-group-text, .form-control, .form-select, .btn):first-child {
    border-start-start-radius: var(--os-ui-corner-radius) !important;
    border-end-start-radius: var(--os-ui-corner-radius) !important;
  }

  :is(#os-ag-button-scope, body) .input-group > :is(.input-group-text, .form-control, .form-select, .btn):not(:has(~ :is(.input-group-text, .form-control, .form-select, .btn, .form-floating))) {
    border-start-end-radius: var(--os-ui-corner-radius) !important;
    border-end-end-radius: var(--os-ui-corner-radius) !important;
  }

  :is(#os-ag-button-scope, body) .accordion:not(.accordion-flush) {
    --bs-accordion-border-radius: var(--os-ui-corner-radius);
    --bs-accordion-inner-border-radius: calc(var(--os-ui-corner-radius) - var(--bs-accordion-border-width));
  }

  /* Grouped actions have the shared radius on the exposed corners. */
  :is(#os-ag-button-scope, body) .btn-group > .btn,
  :is(#os-ag-button-scope, body) .btn-group-vertical > .btn {
    border-radius: 0 !important;
  }

  :is(#os-ag-button-scope, body) .btn-group > .btn:first-child,
  :is(#os-ag-button-scope, body) .btn-group-vertical > .btn:first-child {
    border-start-start-radius: var(--os-ui-corner-radius) !important;
  }

  :is(#os-ag-button-scope, body) .btn-group > .btn:first-child,
  :is(#os-ag-button-scope, body) .btn-group-vertical > .btn:last-child {
    border-end-start-radius: var(--os-ui-corner-radius) !important;
  }

  :is(#os-ag-button-scope, body) .btn-group > .btn:last-child,
  :is(#os-ag-button-scope, body) .btn-group-vertical > .btn:first-child {
    border-start-end-radius: var(--os-ui-corner-radius) !important;
  }

  :is(#os-ag-button-scope, body) .btn-group > .btn:last-child,
  :is(#os-ag-button-scope, body) .btn-group-vertical > .btn:last-child {
    border-end-end-radius: var(--os-ui-corner-radius) !important;
  }

  /* Size the editable product columns from their headers and current values. */
  #export-invoice-details-panel .ags-export-invoice-details-native {
    min-inline-size: 0;
    max-inline-size: 100%;
    overflow-x: auto !important;
  }

  #export-invoice-details-panel table.ags-export-invoice-details-table {
    table-layout: auto !important;
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
  }

  #export-invoice-details-panel .ags-export-invoice-details-table :is(col, th, td) {
    width: auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
  }

  #export-invoice-details-panel .ags-export-invoice-details-table :is(th, td).aei-select-cell {
    width: 2.75rem !important;
  }

  #export-invoice-details-panel .ags-export-invoice-details-table :is(.form-control, .form-select) {
    field-sizing: content;
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
  }

  #export-invoice-details-panel .ags-export-invoice-details-table input.form-control {
    padding-inline: .65rem !important;
  }

  #export-invoice-details-panel .ags-export-invoice-details-table .ags-product-balance-cell-field {
    min-inline-size: max-content !important;
  }

  #export-invoice-details-panel .ags-export-invoice-details-table .ags-product-balance-cell-value {
    overflow: visible !important;
    text-overflow: clip !important;
  }

  .ags-export-invoice-edit-page :is(
    #export-invoice-balance-eu-btn, #export-invoice-balance-nop-btn, #export-invoice-balance-jas-btn
  ) {
    display: none !important;
  }

  :is(#os-ag-button-scope, body) .ags-export-invoice-edit-page .ags-export-invoice-totals-fields {
    gap: .4rem !important;
  }

  :is(#os-ag-button-scope, body) .ags-export-invoice-edit-page .ags-export-invoice-products-header {
    align-items: center !important;
    column-gap: .75rem !important;
    row-gap: .5rem !important;
  }

  :is(#os-ag-button-scope, body) .ags-export-invoice-edit-page .ags-export-invoice-products-header > .os-section-title__actions {
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: .4rem !important;
  }
}
