dialog.product-library {
  box-sizing: border-box;
  inline-size: min(1060px, calc(100% - 32px));
  max-block-size: calc(100dvh - 32px);
  margin: auto;
  padding: 18px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  color: var(--bc-text, #e9e9e9);
  background: var(--bc-surface, #202020);
  border: 1px solid var(--bc-border, #484848);
  border-radius: 10px;
  box-shadow: 0 16px 44px #0004;
  font: inherit;
}
dialog.product-library::backdrop { background: #0008; overflow: hidden; overscroll-behavior: contain; }
.product-library [hidden] { display: none !important; }
.pl-header, .pl-search, .pl-pages, .pl-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pl-header { justify-content: space-between; }
.product-library h3, .product-library h4 { margin: 0; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.product-library h4 { margin-block: 10px; }
.pl-search { margin-block: 12px; }
.product-library input[type="search"], .product-library button:not(.pl-card) {
  color: inherit; background: transparent; border: 1px solid var(--bc-border, #595959);
  border-radius: 6px; padding: 6px 11px; font: inherit;
}
.product-library input[type="search"] { inline-size: min(100%, 270px); }
.product-library button { cursor: pointer; }
.product-library button:disabled { opacity: .45; cursor: default; }
.product-library button:not(.pl-card):hover:enabled { background: var(--bc-hover, #8882); }
.product-library button.pl-primary:enabled {
  background: var(--bc-text, #eee); color: var(--bc-surface, #202020);
}
.pl-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px;
}
.pl-card {
  min-inline-size: 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 6px; color: inherit; background: transparent; text-align: left; font: inherit;
  border: 1px solid var(--bc-border, #595959); border-radius: 7px; cursor: pointer;
}
.pl-card:hover, .pl-card:focus-visible, .pl-card:focus-within, .pl-card:has(:checked) {
  border-color: #6687b8; background: var(--bc-hover, #8882);
}
.pl-card:has(:checked) { background: var(--bc-selected, #6687b827); }
.pl-card:focus-visible, .pl-card:focus-within { outline: 2px solid #6687b8; outline-offset: 1px; }
.pl-card:has(input:disabled:not(:checked)) { opacity: .55; cursor: default; }
.pl-thumbnail {
  display: block; inline-size: 100%; aspect-ratio: 4 / 3;
  max-block-size: clamp(56px, 13dvh, 125px); background: var(--bc-hover, #8882); border-radius: 4px;
}
.pl-thumbnail img { display: block; inline-size: 100%; block-size: 100%; object-fit: contain; }
.pl-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.pl-caption { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.pl-caption input { margin: 0; accent-color: var(--bc-text, #eee); }
.pl-pages { margin-block-start: 12px; justify-content: center; font-size: 13px; }
.pl-footer { margin-block-start: 12px; }
.pl-footer [data-count] { margin-inline-start: auto; font-size: 12px; }
.product-library [data-status] { margin: 8px 0 0; font-size: 13px; }
.product-library [data-status]:empty { display: none; }
@media (max-width: 660px) { .pl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 380px) { .pl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
