body { background: #f4f5f7; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.thumb-card { position: relative; background: #fff; border: 2px solid transparent; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow: hidden; cursor: pointer; user-select: none; }
.thumb-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.thumb-card.selected { border-color: var(--bs-primary); }
.thumb-card .ph { aspect-ratio: 3 / 4; background: #e9ecef center / contain no-repeat; }
.thumb-card .meta { padding: 6px 8px; font-size: .78rem; line-height: 1.25; }
.thumb-card .meta .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-card .check { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.9); border: 2px solid #adb5bd; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; }
.thumb-card.selected .check { background: var(--bs-primary); border-color: var(--bs-primary); }
.thumb-card .badge-used { position: absolute; top: 6px; right: 6px; }

.dropzone { border: 2px dashed #adb5bd; border-radius: 10px; padding: 22px; text-align: center; color: #6c757d; background: #fff; transition: .15s; }
.dropzone.over { border-color: var(--bs-primary); background: #eef4ff; color: var(--bs-primary); }

/* Book editor page strip */
.page-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.page-item { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); overflow: hidden; position: relative; }
.page-item .ph { aspect-ratio: 3 / 4; background: #e9ecef center / contain no-repeat; cursor: grab; }
.page-item .num { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: .75rem; border-radius: 10px; padding: 1px 8px; }
.page-item .flags { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; }
.page-item .flags span { background: rgba(255,255,255,.92); border-radius: 10px; font-size: .7rem; padding: 1px 6px; }
.page-item .tools { display: flex; justify-content: space-between; padding: 4px 6px; border-top: 1px solid #eee; }
.page-item.sortable-ghost { opacity: .35; }
.page-item.selected { outline: 3px solid var(--bs-primary); }
.spread-gap { grid-column: span 1; }

/* Link editor */
.link-stage { position: relative; display: inline-block; user-select: none; cursor: crosshair; max-width: 100%; }
.link-stage img { display: block; max-width: 100%; max-height: 72vh; }
.link-box { position: absolute; border: 2px solid #0d6efd; background: rgba(13,110,253,.18); cursor: move; }
.link-box.active { border-color: #fd7e14; background: rgba(253,126,20,.22); }
.link-box .n { position: absolute; top: -10px; left: -10px; background: #0d6efd; color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.link-box.active .n { background: #fd7e14; }
.link-box .rs { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid currentColor; cursor: nwse-resize; color: #0d6efd; }

.bg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.bg-swatch { position: relative; height: 62px; border: 2px solid #dee2e6; border-radius: 8px; background: #f1f3f5 center / cover; padding: 0; overflow: hidden; }
.bg-swatch span { position: absolute; left: 0; right: 0; bottom: 0; font-size: .7rem; background: rgba(0,0,0,.55); color: #fff; padding: 1px 4px; }
.bg-swatch span.none { position: static; background: none; color: #6c757d; display: flex; height: 100%; align-items: center; justify-content: center; line-height: 1.1; }
.bg-swatch.own span { background: rgba(13,110,253,.8); }
.bg-swatch:hover { border-color: #adb5bd; }
.bg-swatch.active { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--bs-primary); }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.book-card .cover { aspect-ratio: 4 / 3; background: #dee2e6 center / contain no-repeat; border-bottom: 1px solid #eee; }
.form-check-input { cursor: pointer; }
.sticky-actions { position: sticky; top: 0; z-index: 10; background: #f4f5f7; padding: 8px 0; }
