/* Keep the complete document workspace in normal flow. Some accounting entry
   wrappers have an automatic height; zero-basis nested flex can collapse them. */
.retail-page:not([hidden]):has(.retail-accounting) { overflow-y: auto; }
/* InvoiceAccountingHost adds an auto-height div around the page. A percentage
   height on the page cannot bound its scrollport through that wrapper. Scroll
   the shell's definite-height content area instead. */
.retail-shell-content:has(.retail-accounting):not(:has(.retail-page[hidden] .retail-accounting)) {
  overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable;
}
.retail-shell-content .retail-accounting {
  height: auto; min-height: 0; overflow: visible;
}
.retail-accounting > .retail-accounting-header { flex: none; }
.retail-accounting > div:has(> .finance-workspace):not([hidden]) {
  display: block; flex: none; min-height: auto; min-width: 0; overflow: visible;
}
.retail-accounting > div > .finance-workspace {
  display: grid; flex: none; min-height: auto; min-width: 0;
}
.retail-accounting .finance-workspace > :not(.finance-layout) { flex: none; }
.retail-accounting .finance-layout {
  flex: none; min-height: auto; grid-template-rows: auto; overflow: visible;
}
.retail-accounting .finance-layout > .finance-list {
  height: auto; min-height: 160px; max-height: 58dvh; overflow: auto;
}
.retail-accounting .finance-layout > .finance-detail {
  height: auto; min-height: 0; max-height: none; overflow: visible;
  padding-bottom: var(--space-4);
}
.retail-accounting .finance-detail > * { flex-shrink: 0; }
@media (min-width: 901px) {
  .retail-accounting .finance-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .retail-accounting .finance-layout > .finance-list { max-height: 35dvh; }
}
