/* Merge tool: page thumbnail grid with drag reordering. */

#workspace { flex: 1; display: flex; overflow: hidden; min-height: 0; }

#sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
}
.sb-section { margin-bottom: 18px; }
.sb-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 7px; font-weight: 600;
}
.sb-note { font-size: 12px; color: var(--muted); }
.sb-row { display: flex; gap: 7px; margin-bottom: 8px; }

.doc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 6px; background: var(--bg);
  border: 1px solid var(--border); margin-bottom: 5px; font-size: 12.5px;
}
.doc-item .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.doc-item .meta { min-width: 0; flex: 1; }
.doc-item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item .sub { color: var(--muted); font-size: 11px; }
.doc-item .drop-all {
  color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 3px; line-height: 1;
}
.doc-item .drop-all:hover { color: var(--danger); }

/* ---------- grid ---------- */
#stage {
  flex: 1; overflow: auto; padding: 20px; background: #16161f; min-width: 0;
}
#dropzone {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--muted); text-align: center;
}
#dropzone .inner {
  border: 2px dashed var(--border); border-radius: 14px; padding: 52px 44px; max-width: 540px;
}
#dropzone h2 { color: var(--text); margin: 0 0 8px; font-size: 19px; }
#dropzone p { margin: 0 0 6px; font-size: 14px; }
#stage.dragover { background: #1b1b2a; }
#stage.dragover #dropzone .inner { border-color: var(--accent); }

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
  align-content: start;
}

.pcard {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px;
  cursor: grab;
  user-select: none;
  transition: border-color .12s, opacity .12s;
}
.pcard:hover { border-color: var(--accent); }
.pcard.dragging { opacity: .35; cursor: grabbing; }
.pcard.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* insertion marker while dragging */
.pcard.drop-before::before,
.pcard.drop-after::after {
  content: ""; position: absolute; top: 4px; bottom: 4px; width: 3px;
  background: var(--accent); border-radius: 2px;
}
.pcard.drop-before::before { left: -9px; }
.pcard.drop-after::after { right: -9px; }

.pcard .thumb {
  position: relative;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 60px;
}
.pcard .thumb canvas { display: block; width: 100%; height: auto; }
.pcard .thumb .pending { color: #8a8aa0; font-size: 11px; padding: 26px 0; }

.pcard .cap {
  display: flex; align-items: center; gap: 5px;
  margin-top: 6px; font-size: 11px; color: var(--muted);
}
.pcard .cap .swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.pcard .cap .src { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .cap .pos { color: var(--text); font-weight: 600; }

.pcard .kill {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(30,30,46,.86); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; cursor: pointer; opacity: 0;
  transition: opacity .12s;
}
.pcard:hover .kill { opacity: 1; }
.pcard .kill:hover { background: var(--danger); color: #fff; }
