.ptray { position: relative; min-width: 0; }
.ptray__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 2px 0 8px; }
.ptray__count { font-weight: 700; font-size: var(--font-size-sm, 14px); color: var(--color-text); }
.ptray__hint { font-size: 12px; color: var(--color-text-muted, var(--color-text-secondary)); }
.ptray--empty .ptray__hint, .ptray--empty .ptray__grid { display: none; }
.ptray__grid {
  list-style: none; margin: 0 0 10px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; align-items: start;
}
.ptray__tile {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--color-surface); border: 1.5px solid var(--color-border); border-radius: 10px; overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.ptray__tile--ok { border-color: color-mix(in srgb, var(--cp-lime, #8bc34a) 55%, var(--color-border)); }
.ptray__tile--bad { border-color: var(--gold, #e0a800); }
.ptray__img { position: relative; aspect-ratio: 3 / 4; background: #111; overflow: hidden; }
.ptray__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ptray__tile--busy .ptray__img img { opacity: .5; }
.ptray__num {
  position: absolute; top: 5px; left: 5px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cp-amber, var(--red)); color: #1a0e08; font-weight: 800; font-size: 14px;
}
.ptray__ok {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
  background: var(--cp-lime, #8bc34a); color: #10200a;
}
.ptray__grip {
  position: absolute; right: 4px; bottom: 4px; width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0;
  background: rgba(0,0,0,.55); color: #fff; border: 0; cursor: grab; touch-action: none;
}
.ptray__grip:active { cursor: grabbing; }
.ptray__spin {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: var(--cp-amber, var(--gold)); animation: spin .8s linear infinite;
}
.ptray__tile--adding { border-style: dashed; }
.ptray__flag {
  display: block; width: 100%; padding: 5px 6px; border: 0; border-top: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--gold, #e0a800) 18%, var(--color-surface)); color: var(--color-text);
  font-size: 12px; font-weight: 700; line-height: 1.2; text-align: left; cursor: pointer;
  white-space: normal; overflow-wrap: break-word; text-wrap: balance;   
}
.ptray__cap {
  width: 100%; min-width: 0; box-sizing: border-box; border: 0; border-top: 1px solid var(--color-border);
  padding: 6px; font-size: 13px; background: transparent; color: var(--color-text);
}
.ptray__ctl { display: flex; gap: 2px; padding: 3px; }
.ptray__b {
  flex: 1 1 0; min-width: 0; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: var(--color-surface-2, var(--color-bg)); color: var(--color-text);
  border: 1px solid var(--color-border); font-size: 13px; cursor: pointer;
}
.ptray__b:disabled { opacity: .3; cursor: default; }
.ptray__b:not(:disabled):hover { border-color: var(--cp-amber, var(--red)); }
.ptray__add { display: flex; gap: 8px; flex-wrap: wrap; }
.ptray__btn { flex: 1 1 200px; min-width: 0; }   
.ptray__tips { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; }
.ptray__tips:empty { display: none; }
.ptray__tip { font-size: var(--font-size-sm, 14px); padding: 8px 10px; border: 1px solid var(--gold, #e0a800); border-radius: 8px; }
.ptray__drop-hint { display: none; margin: 6px 0 0; font-size: 12px; color: var(--color-text-muted, var(--color-text-secondary)); text-align: center; }
@media (hover: hover) and (pointer: fine) { .ptray__drop-hint { display: block; } }
.ptray--drop { outline: 2px dashed var(--cp-amber, var(--gold)); outline-offset: 4px; border-radius: 8px; }
.ptray-dragging { z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.35); opacity: .92; pointer-events: none; }
.ptray-sorting .ptray__tile { transition: none; }
.ptray-drop-at { outline: 2px solid var(--cp-amber, var(--gold)); outline-offset: 2px; }

.ptray-sheet.modal-sheet { max-width: 560px; width: 100%; box-sizing: border-box; background-color: var(--cp-bg-2, var(--color-surface)) !important; }
.ptray-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ptray-sheet__head .modal-title { margin: 0; }
.ptray-sheet__x { flex: 0 0 auto; }
.ptray-sheet__hint { margin: 4px 0 10px; font-size: var(--font-size-sm, 14px); color: var(--color-text-secondary); }
.ptray-sheet__status { min-height: 1.2em; margin: 4px 0 0; font-size: var(--font-size-sm, 14px); color: var(--color-text-secondary); }
.ptray-sheet__acts { flex-wrap: wrap; }
.ptray-sheet__acts .btn--primary { flex: 1 1 180px; }
@media (max-width: 400px) {
  .ptray-ov.modal-overlay--centered { padding: 8px; }
  .ptray-sheet.modal-sheet { padding: 14px 12px 12px; }
  .ptray__grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
}

.ptray-crop.modal-sheet { max-width: 620px; width: 100%; box-sizing: border-box; background-color: var(--cp-bg-2, var(--color-surface)) !important; }
.ptray-crop-ov { z-index: 320; }
.ptray-crop__hint { margin: 0 0 8px; font-size: var(--font-size-sm, 14px); color: var(--color-text-secondary); }
.ptray-crop__wrap { display: flex; justify-content: center; }
.ptray-crop__cv { max-width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.ptray-crop__acts { flex-wrap: wrap; }

.wr-paper__page { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--color-border); }
.wr-paper__head--total { padding: 8px 10px; border-radius: 8px; background: var(--color-surface); border: 1px solid var(--color-border); }
.hwl-tray { margin: 8px 0; }
.hw-comp-tray { margin: 0 0 12px; }
.rd-pg__img .rd-pg__grip { right: 6px; bottom: 6px; }
