/* Approved compact payment preview, shared by ERP pages with a company context. */
body { --company-header-action: clamp(40px, calc(44 * var(--u)), 44px); }
html body #content :is(.erp-title-create, .erp-create-menu > summary),
html body.erp-compact #content :is(.erp-title-create, .erp-create-menu > summary) {
  height: var(--company-header-action);
  min-height: var(--company-header-action);
  max-height: var(--company-header-action);
}
body.company-header-context #top > #searchform[hidden] { display: none !important; }
body.company-header-context #top > #country {
  position: static; transform: none; margin: 0 auto 0 0;
  width: clamp(140px, 18vw, 220px); max-width: 30%; flex: 0 1 220px;
}
body.company-header-context #top > .header-organization {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px;
  flex: 0 1 auto; width: clamp(160px, 18vw, 260px); max-width: 40%; min-width: 0;
  height: var(--header-action); min-height: var(--header-action); max-height: var(--header-action);
  margin: 0 0 0 auto; padding: 8px 12px; border: 1px solid #cfe1f7; border-radius: 8px;
  background: #edf5ff; color: #1677d7; box-shadow: none; text-align: left;
}
body.company-header-context #top > .header-organization:hover,
body.company-header-context #top > .header-organization[aria-expanded="true"] {
  background: #e3efff; border-color: #92bcea;
}
body.company-header-context #top > .header-organization:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
body.company-header-context #top > .header-organization small { display: none; }
body.company-header-context #top > .header-organization > [data-company-home] {
  display: flex; flex: 0 0 20px; width: 20px; height: 20px; margin: 0;
}
body.company-header-context #top > .header-organization > [data-company-home] > .icon { width: 20px; height: 20px; }
body.company-header-context #top > .header-organization > span:not([data-company-home]):not(.caret) {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; width: auto;
}
body.company-header-context #top > .header-organization :is(.filter-value,.context-value),
body.company-header-context #top > .header-organization > strong {
  display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 14px; font-weight: 400; line-height: 20px;
}
body.company-header-context #top > .header-organization .caret { flex: none; }
body.company-header-context #top > #notifications { margin-left: 0 !important; }
/* Keep the actual search form and its listeners; the heading owns the first row.
   Hidden installed searches remain hidden and consume no extra row. */
html body.erp-compact #top { flex-wrap: wrap; height: auto; min-height: 44px; }
body.erp-compact #top > #searchform:not([hidden]) {
  order: 1; flex: 1 0 100%; width: 100%; max-width: 100%; min-width: 0; margin: 0;
}
body.erp-compact #top > #searchform[hidden] { display: none !important; }
body.company-header-context #content .alp-top-heading :is(button,a,[role=button]) { translate: none; }
/* A secondary action must not squeeze the title between two fixed buttons.
   Keep the real nodes in their module scope and let the content reserve space. */
@media (max-width: 1600px) {
  body.erp-compact #content .alp-top-heading:has(.acc-heading-actions > :not(.erp-title-create):not(.erp-create-menu)) {
    position: static !important; width: 100% !important; max-width: 100% !important;
    height: auto !important; flex-wrap: wrap !important;
  }
  body.erp-compact #content .alp-top-heading:has(.acc-heading-actions > :not(.erp-title-create):not(.erp-create-menu)) .page-heading {
    flex: 1 0 100%; max-width: 100%; flex-wrap: wrap;
  }
  body.erp-compact #content .alp-top-heading:has(.acc-heading-actions > :not(.erp-title-create):not(.erp-create-menu)) h1 {
    white-space: normal; overflow: visible; overflow-wrap: anywhere;
  }
  body.erp-compact #content .alp-top-heading .acc-heading-actions {
    flex: 0 1 100%; max-width: 100%; min-width: 0; margin-left: 0;
    flex-wrap: wrap; justify-content: flex-start;
  }
  body.erp-compact #content .alp-top-heading .acc-heading-actions > :is(button,a,[role=button]) {
    max-width: 100%; min-width: 0; white-space: normal; height: auto; overflow-wrap: anywhere;
  }
}
@media (max-width: 700px) {
  body.erp-compact #content .alp-top-heading { position: static !important; width: 100% !important; max-width: 100% !important; }
  body.company-header-context #content .alp-top-heading :is(button,a,[role=button]) { translate: none; }
  body.company-header-context #top { grid-template-columns: minmax(0,1fr) repeat(3,40px); }
  body.company-header-context #top > #country {
    grid-row: 1; grid-column: 1/-1; justify-self: center;
    width: min(240px,100%); max-width: 100%; margin: 0;
  }
  body.company-header-context #top > .header-organization {
    grid-row: 2; grid-column: 1; width: 100%; max-width: 100%; min-width: 0;
    padding: 8px; gap: 6px;
  }
  body.company-header-context #top > .header-organization :is(.filter-value,.context-value),
  body.company-header-context #top > .header-organization > strong { font-size: 13px; }
}
@media print { #top > .header-organization { display: none !important; } }

/* Share the mobile row with the fixed notification actions before flex wrapping. */
@media (max-width: 700px) {
  body.company-header-context #top > .header-organization { flex: 1 1 0; width: 0; max-width: none; }
}
