/* =============================================================================
   OrganicSystem — Professional ERP Toolbar (GLOBAL HEIGHT STANDARD)
   Shared by every page. Layout + equal control height — order & functionality unchanged.

   Canonical height: --os-erp-toolbar-btn-height (36px desktop).
   Filters, action buttons, icon buttons, dropdowns, and toggles in toolbar hosts
   all resolve to this single token so the strip reads as one ERP control row.

   Desktop  (>=1200): one row; buttons shrink to fit; no horizontal scroll
   Tablet   (768–1199): wrap automatically
   Portrait / mobile: multiple rows; full visibility; equal height
   ============================================================================= */

:root {
  --os-erp-toolbar-btn-height: 36px;
  --os-erp-toolbar-gap: 0.35rem;
  --os-erp-toolbar-row-gap: 0.4rem;
  --os-erp-toolbar-btn-min-width: 0;
  --os-erp-toolbar-btn-pad-x: 0.55rem;
  --os-erp-toolbar-btn-font: 0.8125rem;
  --os-erp-toolbar-btn-radius: var(--os-btn-radius, 0.4rem);
  --os-erp-toolbar-icon-size: 1rem;
  /* Aliases — keep filter strip + legacy toolbar tokens in lockstep.
     Do not remap these aliases in touch/mobile sheets — change the canonical token instead. */
  --os-toolbar-control-height: var(--os-erp-toolbar-btn-height);
  --os-filter-control-height: var(--os-erp-toolbar-btn-height);
  --os-filter-actions-min-height: var(--os-erp-toolbar-btn-height);
}

/* ---------- Shared toolbar hosts ---------- */
.os-page-toolbar,
.os-page-toolbar.os-page-toolbar-layout,
.os-page-toolbar.os-app-merged-toolbar,
.os-app-page-toolbar-slot,
.os-app-page-toolbar-slot .os-page-toolbar,
.os-module-toolbar-inner,
.plan-toolbar,
.plan-toolbar-primary,
.plan-toolbar-secondary,
.plan-toolbar.os-desktop-page-header,
.rotation-toolbar,
.rotation-toolbar .os-page-toolbar,
.os-page-header-chrome-left,
.os-page-header-chrome-right,
.os-desktop-page-header:has(.os-page-toolbar),
main .d-flex:has(> .os-page-toolbar),
main .d-flex.justify-content-between.align-items-center:has(.os-page-toolbar),
main .d-flex.align-items-center:has(.os-page-toolbar),
.os-page-sticky-chrome:has(.os-page-toolbar),
.admin-page-actions.os-page-toolbar,
.btn-toolbar:has(.os-page-toolbar-btn) {
  display: flex !important;
  align-items: center !important;
  align-content: flex-start !important;
  gap: var(--os-erp-toolbar-gap) !important;
  row-gap: var(--os-erp-toolbar-row-gap) !important;
  column-gap: var(--os-erp-toolbar-gap) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  width: 100%;
  box-sizing: border-box !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: auto !important;
}

/* Never clip multi-row toolbars */
.os-page-header-chrome-host:has(.os-page-header-chrome),
.os-desktop-page-header.os-page-header-chrome-host,
.os-page-header-chrome,
#os-app-page-chrome-host,
.os-app-page-chrome-host {
  height: auto !important;
  min-height: var(--os-page-title-bar-height, 2.5rem) !important;
  max-height: none !important;
  overflow: visible !important;
}

.os-page-header-chrome {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto !important;
  align-items: start !important;
}

.os-page-header-chrome-left,
.os-page-header-chrome-right {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
}

/* When title + toolbar share chrome on wide screens, keep side-by-side */
@media (min-width: 1200px) {
  .os-page-header-chrome {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) !important;
    align-items: center !important;
  }

  .os-page-header-chrome-left {
    grid-column: 1 !important;
    width: auto;
  }

  .os-page-header-chrome-right {
    grid-column: 2 !important;
  }
}

/* ---------- Equal-height toolbar buttons (authoritative) ---------- */
.os-page-toolbar > .btn,
.os-page-toolbar > a.btn,
.os-page-toolbar > button,
.os-page-toolbar > .btn-group,
.os-page-toolbar > .dropdown,
.os-page-toolbar .btn:not(.dropdown-item):not(.page-link):not(.nav-link),
.os-page-toolbar-btn,
a.os-page-toolbar-btn,
button.os-page-toolbar-btn,
.os-page-toolbar-icon-btn,
.os-page-toolbar-labeled-btn,
.os-page-toolbar-text-btn,
.os-app-page-toolbar-slot .btn:not(.dropdown-item),
.os-app-page-toolbar-slot .os-page-toolbar-btn,
.os-app-page-toolbar-slot .os-page-toolbar-icon-btn,
.os-app-page-toolbar-slot .os-page-toolbar-labeled-btn,
.os-app-page-toolbar-slot .os-app-header-icon-btn,
.os-app-page-toolbar-slot .os-app-header-search-toggle,
.os-module-toolbar .os-app-page-toolbar-slot .btn:not(.dropdown-item),
.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar > .btn:not(.dropdown-item),
.os-module-toolbar .os-app-page-toolbar-slot .os-app-merged-toolbar > .btn:not(.dropdown-item),
.os-module-toolbar .os-app-page-toolbar-slot .dropdown > .btn,
.os-module-toolbar .os-app-page-toolbar-slot .dropdown > .dropdown-toggle,
.os-module-toolbar .os-app-page-toolbar-slot .btn-group > .btn:not(.dropdown-item),
.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar-icon-btn,
.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar-labeled-btn,
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-icon-btn,
.os-module-toolbar .os-app-header-search-toggle,
.plan-toolbar .btn:not(.dropdown-item),
.plan-toolbar .os-page-toolbar-btn,
.rotation-toolbar .btn:not(.dropdown-item),
.rotation-toolbar .os-page-toolbar-btn,
.rotation-export-btn,
.admin-page-actions .btn:not(.dropdown-item),
.os-desktop-page-header .os-page-toolbar .btn:not(.dropdown-item),
.os-page-toolbar [data-os-toolbar]:not(.dropdown-item):is(button, a, .btn) {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: var(--os-erp-toolbar-btn-min-width) !important;
  max-width: 100% !important;
  height: var(--os-erp-toolbar-btn-height) !important;
  min-height: var(--os-erp-toolbar-btn-height) !important;
  max-height: var(--os-erp-toolbar-btn-height) !important;
  padding-block: 0 !important;
  padding-inline: var(--os-erp-toolbar-btn-pad-x) !important;
  font-size: var(--os-erp-toolbar-btn-font) !important;
  line-height: 1.2 !important;
  border-radius: var(--os-erp-toolbar-btn-radius) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.3rem !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  visibility: visible !important;
  vertical-align: middle !important;
}

/* Icons inside toolbar controls — one size, centered with text */
.os-page-toolbar .btn .bi,
.os-page-toolbar .btn i,
.os-page-toolbar-btn .bi,
.os-page-toolbar-btn i,
.os-page-toolbar-icon-btn .bi,
.os-page-toolbar-icon-btn i,
.os-app-page-toolbar-slot .btn .bi,
.os-app-page-toolbar-slot .btn i,
.os-module-toolbar .os-app-page-toolbar-slot .btn .bi,
.os-module-toolbar .os-app-page-toolbar-slot .btn i {
  font-size: var(--os-erp-toolbar-icon-size) !important;
  line-height: 1 !important;
  width: 1em !important;
  height: 1em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  vertical-align: middle !important;
}

/* Icon-only squares: same HEIGHT as labeled buttons; width matches height */
.os-page-toolbar-icon-btn:not(.os-page-toolbar-labeled-btn):not(.os-page-toolbar-text-btn),
.os-app-header-icon-btn:not(.os-page-toolbar-labeled-btn),
.os-app-header-search-toggle,
.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar-icon-btn:not(.os-page-toolbar-labeled-btn),
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-icon-btn:not(.os-page-toolbar-labeled-btn),
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-search-toggle {
  width: var(--os-erp-toolbar-btn-height) !important;
  min-width: var(--os-erp-toolbar-btn-height) !important;
  max-width: var(--os-erp-toolbar-btn-height) !important;
  padding-inline: 0 !important;
}

/* Labeled / text toolbar buttons keep auto width at the standard height */
.os-page-toolbar-labeled-btn,
.os-page-toolbar-text-btn,
.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar-labeled-btn,
.os-module-toolbar .os-app-page-toolbar-slot .dropdown > .btn.os-page-toolbar-labeled-btn,
.os-module-toolbar .os-app-page-toolbar-slot .os-toolbar-print-dropdown > .dropdown-toggle.os-page-toolbar-labeled-btn,
.os-page-toolbar [data-os-toolbar="positive-balance"],
.os-app-page-toolbar-slot [data-os-toolbar="positive-balance"],
.os-app-page-toolbar-slot [data-os-toolbar="export"],
.os-app-page-toolbar-slot [data-os-toolbar="export-excel"] {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  padding-inline: var(--os-erp-toolbar-btn-pad-x) !important;
  font-size: var(--os-erp-toolbar-btn-font) !important;
  overflow: visible !important;
}

.os-page-toolbar > .btn-group,
.os-page-toolbar > .dropdown,
.os-app-page-toolbar-slot > .btn-group,
.os-app-page-toolbar-slot > .dropdown,
.os-app-page-toolbar-slot .btn-group,
.os-app-page-toolbar-slot .dropdown {
  display: inline-flex !important;
  align-items: stretch !important;
  height: var(--os-erp-toolbar-btn-height) !important;
  min-height: var(--os-erp-toolbar-btn-height) !important;
  max-height: var(--os-erp-toolbar-btn-height) !important;
}

.os-page-toolbar > .btn-group > .btn,
.os-page-toolbar > .dropdown > .btn,
.os-page-toolbar > .dropdown > .dropdown-toggle,
.os-app-page-toolbar-slot .btn-group > .btn,
.os-app-page-toolbar-slot .dropdown > .btn,
.os-app-page-toolbar-slot .dropdown > .dropdown-toggle {
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
}

/* Promoted filter controls / TagBoxes / toggles in the action strip */
.os-app-page-toolbar-slot .os-app-header-filter-control,
.os-page-toolbar .os-app-header-filter-control,
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-filter-control,
.os-app-page-toolbar-slot .os-balance-include-toggle,
.os-page-toolbar .os-balance-include-toggle {
  display: inline-flex !important;
  align-items: center !important;
  height: var(--os-erp-toolbar-btn-height) !important;
  min-height: var(--os-erp-toolbar-btn-height) !important;
  max-height: var(--os-erp-toolbar-btn-height) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  isolation: isolate;
  position: relative;
}

.os-app-page-toolbar-slot .os-app-header-filter-control .dx-tagbox,
.os-app-page-toolbar-slot .os-app-header-filter-control .dx-texteditor,
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-filter-control .dx-tagbox,
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-filter-control .dx-texteditor,
.os-app-page-toolbar-slot .os-balance-tagbox-host,
.os-app-page-toolbar-slot [id$="Host"].os-tagbox-host {
  height: var(--os-erp-toolbar-btn-height) !important;
  min-height: var(--os-erp-toolbar-btn-height) !important;
  max-height: var(--os-erp-toolbar-btn-height) !important;
  box-sizing: border-box !important;
}

.os-app-page-toolbar-slot .os-app-header-filter-control .dx-tag-container,
.os-module-toolbar .os-app-page-toolbar-slot .os-app-header-filter-control .dx-tag-container {
  min-height: calc(var(--os-erp-toolbar-btn-height) - 2px) !important;
  height: 100% !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

/* Search hosts: fluid, not fixed rem width */
.os-page-toolbar .os-page-grid-search,
.plan-toolbar .os-page-grid-search,
.rotation-toolbar .os-page-grid-search,
.os-app-page-toolbar-slot .os-app-header-search,
.os-app-page-toolbar-slot #os-app-header-search,
main .d-flex > .os-page-grid-search {
  flex: 1 1 10rem !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: var(--os-erp-toolbar-btn-height) !important;
  margin-left: auto !important;
}

.os-page-toolbar .os-page-grid-search .dx-texteditor,
.os-page-toolbar .os-page-grid-search .dx-texteditor.dx-editor-outlined,
.os-app-page-toolbar-slot .os-app-header-search-input {
  width: 100% !important;
  height: var(--os-erp-toolbar-btn-height) !important;
  min-height: var(--os-erp-toolbar-btn-height) !important;
  max-height: var(--os-erp-toolbar-btn-height) !important;
}

/* Module filter layout owned by os-filter-bar.css (grid row + actions row). */
.os-module-toolbar .module-main-filter-form,
.os-module-toolbar .prs-station-form,
.os-module-toolbar-inner {
  overflow-x: visible !important;
  overflow-y: visible !important;
  max-width: 100% !important;
}

.os-module-toolbar-inner {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
}

.os-module-toolbar-filter-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: flex-end !important;
  width: 100% !important;
  min-width: 0 !important;
}

.os-module-toolbar .os-app-page-toolbar-slot,
.os-module-toolbar .os-app-page-toolbar-slot.os-filter-actions {
  flex: 0 0 auto !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  margin-left: 0 !important;
  width: 100% !important;
  order: unset !important;
  min-height: 0;
}

.os-module-toolbar .os-app-page-toolbar-slot.os-filter-actions--has-page-actions {
  min-height: var(--os-erp-toolbar-btn-height);
}

.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar,
.os-module-toolbar .os-app-page-toolbar-slot .os-page-toolbar.os-app-merged-toolbar {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
}

/* =============================================================================
   DESKTOP (>=1200): one row — buttons shrink; never scroll horizontally
   ============================================================================= */
@media (min-width: 1200px) {
  .os-page-toolbar,
  .os-page-toolbar.os-page-toolbar-layout,
  .os-page-toolbar.os-app-merged-toolbar,
  .os-app-page-toolbar-slot,
  .os-app-page-toolbar-slot .os-page-toolbar,
  .plan-toolbar,
  .plan-toolbar-primary,
  .plan-toolbar-secondary,
  .rotation-toolbar,
  .rotation-toolbar .os-page-toolbar,
  .os-page-header-chrome-left,
  .os-page-header-chrome-right,
  .os-desktop-page-header:has(.os-page-toolbar),
  main .d-flex:has(> .os-page-toolbar),
  main .d-flex.justify-content-between.align-items-center:has(.os-page-toolbar) {
    flex-wrap: nowrap !important;
    overflow-x: visible !important;
  }

  /* Filter shell stays column: Refresh+filters row, then optional actions row */
  .os-module-toolbar-inner {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-x: visible !important;
  }

  .os-page-toolbar > .btn,
  .os-page-toolbar > a.btn,
  .os-page-toolbar > button,
  .os-page-toolbar-btn,
  a.os-page-toolbar-btn,
  button.os-page-toolbar-btn,
  .os-page-toolbar-icon-btn,
  .os-page-toolbar-labeled-btn,
  .os-app-page-toolbar-slot .btn,
  .plan-toolbar .btn,
  .rotation-toolbar .btn {
    flex: 0 1 auto !important;
    min-width: 0 !important;
  }

  /* Allow label truncation rather than overflow when many actions */
  .os-page-toolbar-btn .os-toolbar-print-label,
  .os-page-toolbar-labeled-btn > span:not(.bi) {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* =============================================================================
   TABLET (768–1199): automatically wrap — same height token for filters + buttons
   ============================================================================= */
@media (min-width: 768px) and (max-width: 1199.98px) {
  :root {
    --os-erp-toolbar-btn-height: 36px;
    --os-erp-toolbar-btn-pad-x: 0.5rem;
    --os-toolbar-control-height: var(--os-erp-toolbar-btn-height);
    --os-filter-control-height: var(--os-erp-toolbar-btn-height);
    --os-filter-actions-min-height: var(--os-erp-toolbar-btn-height);
  }

  .os-page-toolbar,
  .os-page-toolbar.os-page-toolbar-layout,
  .os-page-toolbar.os-app-merged-toolbar,
  .os-app-page-toolbar-slot,
  .os-app-page-toolbar-slot .os-page-toolbar,
  .plan-toolbar,
  .plan-toolbar-primary,
  .plan-toolbar-secondary,
  .plan-toolbar.os-desktop-page-header,
  .rotation-toolbar,
  .rotation-toolbar .os-page-toolbar,
  .os-page-header-chrome-left,
  .os-page-header-chrome-right,
  .os-desktop-page-header:has(.os-page-toolbar),
  main .d-flex:has(> .os-page-toolbar),
  main .d-flex.justify-content-between.align-items-center:has(.os-page-toolbar),
  main .d-flex.align-items-center:has(.os-page-toolbar),
  .os-page-sticky-chrome:has(.os-page-toolbar),
  .os-module-toolbar .module-main-filter-form,
  .os-module-toolbar .prs-station-form {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  /* Module filter column: column + nowrap (Phase 8.6 C1 / UI-1.16). */
  .os-module-toolbar-inner {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  .os-page-toolbar > .btn,
  .os-page-toolbar-btn,
  .os-page-toolbar-icon-btn,
  .os-page-toolbar-labeled-btn,
  .os-app-page-toolbar-slot .btn,
  .plan-toolbar .btn,
  .rotation-toolbar .btn {
    flex: 0 1 auto !important;
  }
}

/* =============================================================================
   PORTRAIT + MOBILE: multiple rows; buttons stay visible & equal height
   ============================================================================= */
@media (orientation: portrait), (max-aspect-ratio: 1/1), (max-width: 767.98px) {
  :root {
    --os-erp-toolbar-btn-height: 40px;
    --os-erp-toolbar-gap: 0.4rem;
    --os-erp-toolbar-row-gap: 0.45rem;
    --os-erp-toolbar-btn-pad-x: 0.45rem;
    --os-toolbar-control-height: var(--os-erp-toolbar-btn-height);
    --os-filter-control-height: var(--os-erp-toolbar-btn-height);
    --os-filter-actions-min-height: var(--os-erp-toolbar-btn-height);
  }

  .os-page-toolbar,
  .os-page-toolbar.os-page-toolbar-layout,
  .os-page-toolbar.os-app-merged-toolbar,
  .os-app-page-toolbar-slot,
  .os-app-page-toolbar-slot .os-page-toolbar,
  .plan-toolbar,
  .plan-toolbar-primary,
  .plan-toolbar-secondary,
  .plan-toolbar.os-desktop-page-header,
  .rotation-toolbar,
  .rotation-toolbar .os-page-toolbar,
  .os-page-header-chrome,
  .os-page-header-chrome-left,
  .os-page-header-chrome-right,
  .os-desktop-page-header:has(.os-page-toolbar),
  main .d-flex:has(> .os-page-toolbar),
  main .d-flex.justify-content-between.align-items-center:has(.os-page-toolbar),
  main .d-flex.align-items-center:has(.os-page-toolbar),
  .os-page-sticky-chrome:has(.os-page-toolbar) {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  /* Keep filter header as column; let os-filter-bar.css own form grid wrapping */
  .os-module-toolbar-inner {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  .os-page-header-chrome {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: none !important;
  }

  .os-page-header-chrome-left,
  .os-page-header-chrome-center,
  .os-page-header-chrome-right {
    grid-column: 1 !important;
    grid-row: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
  }

  .os-page-toolbar > .btn,
  .os-page-toolbar-btn,
  a.os-page-toolbar-btn,
  button.os-page-toolbar-btn,
  .os-page-toolbar-icon-btn,
  .os-page-toolbar-labeled-btn,
  .os-app-page-toolbar-slot .btn,
  .plan-toolbar .btn,
  .rotation-toolbar .btn,
  .rotation-export-btn {
    flex: 1 1 auto !important;
    min-width: min(100%, 6.5rem) !important;
    max-width: 100% !important;
  }

  .os-page-toolbar .os-page-grid-search,
  .plan-toolbar .os-page-grid-search,
  .rotation-toolbar .os-page-grid-search,
  main .d-flex > .os-page-grid-search {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    order: 999;
  }
}

/* Mobile portrait: denser multi-row — height still from the shared token */
@media (max-width: 575.98px) {
  :root {
    --os-erp-toolbar-btn-height: 40px;
    --os-erp-toolbar-btn-font: 0.78rem;
    --os-toolbar-control-height: var(--os-erp-toolbar-btn-height);
    --os-filter-control-height: var(--os-erp-toolbar-btn-height);
    --os-filter-actions-min-height: var(--os-erp-toolbar-btn-height);
  }

  .os-page-toolbar > .btn,
  .os-page-toolbar-btn,
  .os-page-toolbar-icon-btn,
  .os-page-toolbar-labeled-btn,
  .os-app-page-toolbar-slot .btn,
  .plan-toolbar .btn,
  .rotation-toolbar .btn {
    flex: 1 1 calc(50% - var(--os-erp-toolbar-gap)) !important;
    min-width: calc(50% - var(--os-erp-toolbar-gap)) !important;
  }
}

/* Kill legacy “scrollable one-row toolbar” overrides from touch-responsive / site */
@media (max-width: 1199.98px) {
  .os-page-toolbar,
  .os-page-toolbar.os-page-toolbar-layout,
  .plan-toolbar-primary.os-page-toolbar,
  .plan-toolbar-secondary,
  .rotation-toolbar .os-page-toolbar,
  .os-page-header-chrome-left,
  .os-desktop-page-header,
  .os-page-sticky-chrome,
  main .d-flex.justify-content-between.align-items-center.mb-3:has(.os-page-toolbar),
  main .d-flex.justify-content-between.align-items-center.mb-4:has(.os-page-toolbar),
  .plan-toolbar.os-desktop-page-header,
  .rotation-toolbar,
  .os-module-toolbar .module-main-filter-form,
  .os-module-toolbar .prs-station-form {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    scrollbar-width: none !important;
  }
}

/* Disabled buttons stay visible (muted), never removed by layout */
.os-page-toolbar .btn:disabled,
.os-page-toolbar-btn:disabled,
.os-page-toolbar-icon-btn:disabled {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 0.55 !important;
}

/* Preserve DOM order — do not reorder action buttons */
.os-page-toolbar > *,
.os-app-page-toolbar-slot .os-page-toolbar > *:not(.os-page-grid-search):not(.os-app-header-search) {
  order: 0;
}

/* Dropdown menus must NOT inherit the toolbar control height */
.os-page-toolbar .dropdown-menu,
.os-app-page-toolbar-slot .dropdown-menu,
.os-toolbar-print-dropdown .dropdown-menu,
.os-plan-print-menu {
  height: auto !important;
  min-height: 0 !important;
  max-height: min(70vh, 24rem) !important;
  border-radius: var(--os-erp-toolbar-btn-radius, 0.4rem) !important;
  border: 1px solid var(--os-erp-chrome-border, var(--os-color-border)) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1) !important;
  padding: 0.35rem 0 !important;
  overflow-y: auto;
}

.os-page-toolbar .dropdown-menu .dropdown-item,
.os-app-page-toolbar-slot .dropdown-menu .dropdown-item,
.os-page-toolbar .dropdown-menu .btn,
.os-app-page-toolbar-slot .dropdown-menu .btn {
  height: auto !important;
  min-height: var(--os-list-item-min-height, 30px) !important;
  max-height: none !important;
  width: auto !important;
  white-space: nowrap !important;
  display: flex !important;
  align-items: center !important;
  padding: var(--os-list-item-padding-y, 0.2rem) 0.85rem !important;
  font-size: 0.8125rem !important;
  border-radius: 0 !important;
}

.os-page-toolbar .dropdown-menu .dropdown-item:hover,
.os-page-toolbar .dropdown-menu .dropdown-item:focus,
.os-app-page-toolbar-slot .dropdown-menu .dropdown-item:hover,
.os-app-page-toolbar-slot .dropdown-menu .dropdown-item:focus {
  background: var(--os-erp-nav-hover-bg, var(--os-color-hover)) !important;
}
