/* The cash register uses the height it needs, with scrolling inside each table. */
.content:has(> .cash-flow-panel) {
  min-width: 0;
}

.content:has(> .cash-flow-panel) > .page-head-cashFlow:not(:has(.note)) {
  display: none;
}

.cash-flow-panel + .panel > .panel-head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cash-flow-panel + .panel > .panel-head p {
  margin: 0;
}

.cash-flow-grid,
.content:has(> .page-head-cashFlow) .cash-flow-grid:has(tbody .empty) {
  height: auto;
  min-height: 0;
  max-height: min(48dvh, 560px);
}

.cash-flow-grid table {
  min-width: 730px;
}

.cash-flow-grid td:nth-child(2),
.cash-flow-grid td:nth-child(6),
.cash-flow-grid td:nth-child(7),
.cash-flow-grid td:nth-child(9),
.cash-summary td:not(:first-child) {
  white-space: nowrap;
}

.cash-flow-grid td:nth-child(3),
.cash-flow-grid td:nth-child(5),
.cash-flow-grid td:nth-child(8) {
  overflow-wrap: anywhere;
}

.cash-summary .table-scroll {
  max-height: clamp(105px, 24dvh, 235px);
}

.cash-summary table {
  min-width: 570px;
}

.cash-summary tfoot {
  position: sticky;
  bottom: 0;
  z-index: 1;
}

.cash-report-actions {
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 761px) and (max-height: 950px) {
  .desktop-page-shell > .main-area:has(.cash-flow-panel) {
    display: flex;
    flex-direction: column;
    height: 100dvh;
  }

  .demo-environment-banner + .desktop-page-shell > .main-area:has(.cash-flow-panel) {
    height: calc(100dvh - 44px);
    min-height: 0;
  }

  .desktop-page-shell .main-area:has(.cash-flow-panel) > .desktop-page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }

  .desktop-page-body > .content:has(> .cash-flow-panel) {
    display: flex;
    flex-direction: column;
    padding-inline: clamp(12px, 2vw, 30px);
  }

  .content:has(> .cash-flow-panel) > :not(.panel:has(.cash-flow-grid)) {
    flex: none;
  }

  .cash-flow-panel + .panel:has(.cash-flow-grid) {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 130px;
  }

  .cash-flow-panel + .panel > .panel-head {
    flex: none;
  }

  .cash-flow-grid {
    flex: 0 1 auto;
  }
}

@media (min-width: 761px) and (max-height: 800px) {
  .cash-flow-grid th,
  .cash-flow-grid td {
    padding-block: 6px;
  }

  .cash-summary .table-scroll {
    max-height: clamp(94px, 20dvh, 150px);
  }

  .cash-summary > .panel-head {
    padding-block: 8px;
  }

  .desktop-page-body:has(> .content > .cash-flow-panel) > .desktop-rail {
    align-self: start;
  }
}

@media (min-width: 1000px) and (max-height: 800px) {
  .cash-flow-filters {
    grid-template-columns: repeat(2, 116px) minmax(90px, .7fr) minmax(135px, 1.4fr)
      minmax(60px, .5fr) minmax(92px, 1fr) minmax(166px, auto);
  }

  .cash-flow-filters .cash-history,
  .cash-flow-filters .search-actions {
    grid-column: auto;
  }
}

@media (min-width: 761px) and (max-height: 740px) {
  .cash-flow-grid td,
  .cash-flow-grid th {
    padding-block: 4px;
  }

  .cash-flow-panel + .panel .grid-action-bar button {
    min-height: 31px;
    padding-block: 5px;
  }

  .cash-summary .table-scroll {
    max-height: 84px;
  }

  .cash-summary > .panel-head {
    padding-block: 5px;
  }

  .cash-summary > .panel-head p {
    display: none;
  }
}
