.pdf-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 1.25rem;
  align-items: start;
}

.pdf-panel { min-width: 0; }
.pdf-upload-block { padding: 1.15rem; }
.pdf-drop-zone { min-height: 230px; }
.pdf-status {
  min-height: 1.5rem;
  margin: .7rem 0 0;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}
.pdf-status[data-kind="error"] { color: #982e25; font-weight: 700; }
.pdf-status[data-kind="success"] { color: #28663c; font-weight: 700; }

.pdf-workspace[hidden], .pdf-progress[hidden] { display: none; }
.pdf-workspace { border-top: 1px solid var(--line); }
.pdf-options {
  display: flex;
  align-items: end;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: #fffaf1;
  border-bottom: 1px solid var(--line);
}
.pdf-options h3 { width: 100%; margin: 0; }
.pdf-options fieldset { display: flex; gap: .85rem; margin: 0; padding: 0; border: 0; }
.pdf-options legend, .pdf-select-label {
  display: block;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
}
.pdf-options fieldset label { color: var(--ink); font-size: .9rem; font-weight: 700; }
.pdf-options input { accent-color: var(--red); }
.pdf-select-label select {
  display: block;
  min-height: 40px;
  margin-top: .25rem;
  padding: .35rem 2rem .35rem .65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.pdf-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem .5rem;
}
.pdf-list-heading h3 { margin: 0; }
.pdf-list-heading p { margin: .1rem 0 0; color: var(--muted); font-size: .82rem; }
.pdf-list-actions { display: flex; gap: .45rem; }
.pdf-file-list {
  display: grid;
  gap: .65rem;
  margin: 0;
  padding: .5rem 1rem 1rem;
  list-style: none;
}
.pdf-file-card {
  display: grid;
  position: relative;
  grid-template-columns: 34px 92px minmax(0, 1fr) auto;
  gap: .8rem;
  align-items: center;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.pdf-file-card.is-dragging { opacity: .58; }
.pdf-file-card.drop-before::before,
.pdf-file-card.drop-after::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: .4rem;
  left: .4rem;
  height: 4px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 2px #fff;
}
.pdf-file-card.drop-before::before { top: -.48rem; }
.pdf-file-card.drop-after::after { bottom: -.48rem; }
.pdf-drag-handle {
  width: 34px;
  min-width: 34px;
  padding: 0;
  cursor: grab;
  touch-action: none;
  letter-spacing: -3px;
}
.pdf-drag-handle:active { cursor: grabbing; }
.pdf-thumb {
  display: grid;
  place-items: center;
  width: 92px;
  height: 72px;
  overflow: hidden;
  border-radius: 9px;
  background: #e5d8c4;
}
.pdf-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .15s; }
.pdf-thumb.rotation-90 img, .pdf-thumb.rotation-270 img { transform: rotate(var(--thumb-rotation)) scale(.76); }
.pdf-thumb.rotation-180 img { transform: rotate(180deg); }
.pdf-thumb.rotation-90 { --thumb-rotation: 90deg; }
.pdf-thumb.rotation-270 { --thumb-rotation: 270deg; }
.pdf-file-copy { min-width: 0; }
.pdf-file-name { overflow: hidden; margin: 0; font-size: .91rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.pdf-file-meta { margin: .15rem 0 0; color: var(--muted); font-size: .78rem; }
.pdf-file-controls { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: end; }
.pdf-icon-button {
  min-width: 36px;
  min-height: 36px;
  padding: .25rem .55rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 800;
}
.pdf-icon-button:hover:not(:disabled), .pdf-icon-button:focus-visible:not(:disabled) { border-color: var(--ink); background: var(--yellow); }
.pdf-icon-button.remove { color: #a92b23; }
.pdf-icon-button:disabled { opacity: .4; cursor: not-allowed; }

.pdf-progress {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  gap: .7rem;
  align-items: center;
  padding: .9rem 1rem;
  border-top: 1px solid var(--line);
  background: #fffaf1;
}
.pdf-progress label { font-size: .84rem; font-weight: 800; }
.pdf-progress progress { width: 100%; accent-color: var(--red); }
.pdf-actions { display: flex; justify-content: space-between; gap: .8rem; padding: 1rem; border-top: 1px solid var(--line); }
.pdf-order-help { margin: -.45rem 1rem .9rem; color: var(--muted); font-size: .78rem; }

@media (max-width: 900px) {
  .pdf-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .pdf-file-card { grid-template-columns: 34px 72px minmax(0, 1fr); }
  .pdf-thumb { width: 72px; height: 64px; }
  .pdf-file-controls { grid-column: 1 / -1; justify-content: stretch; }
  .pdf-file-controls button { flex: 1; }
  .pdf-progress { grid-template-columns: 1fr auto; }
  .pdf-progress progress { grid-column: 1 / -1; grid-row: 2; }
}
