@media screen {
  #modal[open], #market-blocker[open], #max-preorder-alert[open] {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  dialog > .modal-head {
    flex: none;
    gap: 12px;
    padding: 14px 24px;
  }
  .modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
  .modal-head .icon-btn { flex: none; }
  dialog > .modal-body {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 0;
    scroll-padding-block: 12px 116px;
  }
  dialog > .modal-body::after {
    content: '';
    display: block;
    height: 20px;
  }
  .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: var(--paper);
    border-top: 1px solid var(--line);
    margin: 18px -24px -20px;
    padding: 10px 24px;
  }
  .modal-actions .actions {
    margin: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .modal-actions [data-error] { margin: 0 0 6px; }
  .modal-actions [data-error]:empty { display: none; }

  .page-head:has(> .actions) {
    position: sticky;
    top: 0;
    z-index: 8;
    background: var(--cream);
    padding-block: 12px;
  }
  .page-head > .actions { flex-wrap: wrap; }

  .table-wrap:has(tbody tr > td:last-child:not(:first-child) :is(button, a)) tr > :last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--paper);
    box-shadow: -1px 0 var(--line);
  }
  .table-wrap:has(tbody tr > td:last-child:not(:first-child) :is(button, a)) thead th:last-child {
    background: #fafbf7;
  }
  .table-wrap:has(tbody tr > td:last-child:not(:first-child) :is(button, a)) tbody tr:hover > :last-child {
    background: #fcfcf9;
  }
}

.recipe-picker-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(106px, auto);
  gap: 10px 16px;
  align-items: start;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}
.recipe-picker-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.recipe-picker-details .recipe-thumb { width: 68px; height: 68px; margin: 0; }
.recipe-picker-details .row-name { grid-column: 2; overflow-wrap: anywhere; }
.recipe-picker-details .row-name:first-child { grid-column: 1 / -1; }
.recipe-picker-details .composition-summary { max-width: none; }
.recipe-picker-actions { display: grid; gap: 6px; }
.recipe-picker-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.recipe-picker-actions .table-action { min-height: 32px; }
.recipe-picker-actions .btn { min-height: 34px; padding: 6px 12px; }

@media screen and (max-height: 470px) {
  .page-head:has(> .actions) { position: static; }
}
@media (max-width: 480px) {
  .recipe-picker-item { grid-template-columns: minmax(0, 1fr); }
  .recipe-picker-actions { display: flex; flex-wrap: wrap; justify-content: end; }
  .recipe-picker-details .recipe-thumb { width: 54px; height: 54px; }
}
@media print {
  .modal-actions { display: none; }
}
.product-card { display: flex; flex-direction: column; min-width: 0; }
.product-art { flex: none; width: 100%; overflow: hidden; }
.product-art > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.product-info { width: 100%; min-width: 0; }
.product-info h3 { white-space: normal; overflow-wrap: anywhere; }
.stocktake-totals { padding-inline: 16px; }
.table-filter-button {
  display: inline-grid; place-items: center; min-width: 23px; min-height: 22px;
  margin-inline-start: 5px; padding: 0 4px; border: 1px solid transparent;
  border-radius: 4px; background: transparent; color: inherit; cursor: pointer;
}
.table-filter-button:hover, .table-filter-button:focus-visible, .table-filter-button.active {
  border-color: var(--line); background: #eaf1e8; color: #204b38;
}
.table-filter-popup {
  position: fixed; margin: 0; inset: auto; width: min(238px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px); overflow: auto; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 8px 24px #16342625; color: #24372d;
  text-align: start; font-size: 13px; font-weight: normal; text-transform: none;
}
.table-filter-popup .btn { margin-top: 8px; }
tr.table-filtered-row { display: none !important; }
