/* ============================================================================
 * Snaplot — Mailroom (lot-by-photo)
 * ----------------------------------------------------------------------------
 * Mounts on [snaplot_mailroom]. Two phases on one page:
 *   Phase A — drop unsorted photos (reuses bulk-upload's drop-zone language)
 *   Phase B — drag photos from "Unassigned pool" into lot buckets, then
 *             Auto-bundle / Finalize → commit
 *
 * Visual conventions (shared with bulk-upload.css + catalogue-view.css):
 *   - Navy primary  #0E2A47
 *   - Amber accent  #F59E0B
 *   - Cream cards   #FAF6EC
 *   - Slate text    #334155
 * ========================================================================= */

/* Mailroom design tokens.
 * Defined on BOTH `.snap-mr` (the page shell) AND `.snap-mr__modal-overlay`
 * + `.snap-mr__toast` because those get appended to document.body and
 * therefore live OUTSIDE the .snap-mr cascade. Without the second
 * declaration, `var(--mr-navy)` resolves to nothing inside the modal —
 * which made the primary button (white text on transparent + white border)
 * effectively invisible. */
.snap-mr,
.snap-mr__modal-overlay,
.snap-mr__toast {
    --mr-navy:    #0E2A47;
    --mr-amber:   #F59E0B;
    --mr-amber-2: #FBBF24;
    --mr-cream:   #FAF6EC;
    --mr-ivory:   #FFFFFF;
    --mr-line:    #E5E7EB;
    --mr-line-2:  #F1F5F9;
    --mr-slate:   #334155;
    --mr-slate-2: #64748B;
    --mr-radius:  14px;
    --mr-shadow:  0 1px 2px rgba(14, 42, 71, 0.04);
}

.snap-mr {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 120px;
    font-family: var(--snap-font, 'Inter', sans-serif);
    color: var(--mr-slate);
}

/* Header */
.snap-mr__header {
    margin: 0 0 14px;
    padding: 0 4px;
}
.snap-mr__title {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    color: var(--mr-navy);
}
.snap-mr__sub {
    margin: 0;
    color: var(--mr-slate-2);
    font-size: 14px;
}

/* Drop zone (Phase A) — visually matches bulk-upload's */
.snap-mr__dropzone {
    background: var(--mr-cream);
    border: 2px dashed #cbd5e1;
    border-radius: var(--mr-radius);
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 18px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.snap-mr__dropzone.is-dragover {
    border-color: var(--mr-amber);
    background: #FEF3C7;
}
.snap-mr__dropzone-icon { font-size: 36px; line-height: 1; margin-bottom: 10px; }
.snap-mr__dropzone-h    { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--mr-navy); }
.snap-mr__dropzone-p    { margin: 0 0 14px; font-size: 13px; color: var(--mr-slate-2); }
.snap-mr__dropzone-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.snap-mr__btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--mr-navy);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.snap-mr__btn:hover { background: var(--mr-cream); border-color: var(--mr-amber); }
.snap-mr__btn--primary {
    background: var(--mr-navy);
    color: #fff;
    border-color: var(--mr-navy);
}
.snap-mr__btn--primary:hover { background: #0a1f35; border-color: #0a1f35; }
.snap-mr__btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--mr-slate-2);
}
.snap-mr__btn--ghost:hover { background: var(--mr-line-2); color: var(--mr-navy); }
.snap-mr__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Aggregate progress (Phase A) */
.snap-mr__progress {
    background: #fff;
    border: 1px solid var(--mr-line);
    border-radius: var(--mr-radius);
    padding: 12px 16px;
    margin-bottom: 14px;
    box-shadow: var(--mr-shadow);
    display: none;
}
.snap-mr__progress.is-active { display: block; }
.snap-mr__progress-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.snap-mr__progress-track { height: 8px; background: var(--mr-line); border-radius: 999px; overflow: hidden; }
.snap-mr__progress-fill { height: 100%; background: linear-gradient(90deg, var(--mr-amber), var(--mr-amber-2)); border-radius: inherit; transition: width 0.25s ease-out; }

/* Sort UI toolbar (Phase B) */
.snap-mr__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--mr-line);
    border-radius: var(--mr-radius);
    padding: 10px 14px;
    margin-bottom: 14px;
    box-shadow: var(--mr-shadow);
}
.snap-mr__toolbar-stats { font-size: 13px; color: var(--mr-slate-2); margin-right: auto; }
.snap-mr__toolbar-stats strong { color: var(--mr-navy); }

/* Sort layout — two-pane on desktop with draggable splitter; stacked on mobile.
 * Desktop: lot buckets fill the left (flexible) column, an 8 px draggable
 * splitter, then the unassigned pool pinned sticky on the right (fixed
 * 320 px default — the JS splitter mutates this inline at drag time).
 * DOM order is "pool, buckets, splitter" but we use CSS `order` to lay
 * them out as "buckets | splitter | pool" on desktop. On mobile the grid
 * collapses to one column and the splitter hides — pool stacks first
 * (gallery on top) so drag distance stays short for touch users. */
.snap-mr__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 980px) {
    .snap-mr__layout {
        grid-template-columns: 1fr 5px 320px;
        align-items: start;
        gap: 0 12px;
        grid-auto-flow: dense;
    }
    .snap-mr__buckets  { grid-column: 1; grid-row: 1; }
    /* `display: block !important` — without `!important` the base rule
     * `.snap-mr__splitter { display: none }` further down in the source
     * wins on specificity tie + later-source-order, leaving the splitter
     * 0 × 0 even on desktop (verified via getComputedStyle). */
    .snap-mr__splitter { grid-column: 2; grid-row: 1; display: block !important; }
    .snap-mr__pool     { grid-column: 3; grid-row: 1; position: sticky; top: 16px; }
}

/* Unassigned pool (sticky on desktop) */
.snap-mr__pool {
    background: #fff;
    border: 1px solid var(--mr-line);
    border-radius: var(--mr-radius);
    box-shadow: var(--mr-shadow);
    overflow: hidden;
}
.snap-mr__pool-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--mr-line);
    background: var(--mr-cream);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.snap-mr__pool-title { font-weight: 700; color: var(--mr-navy); font-size: 14px; }
.snap-mr__pool-count {
    background: var(--mr-amber);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
}
.snap-mr__pool-tiles {
    padding: 10px;
    max-height: 60vh;
    overflow-y: auto;
    display: grid;
    /* Photos sized +10% (70 → 77 px min) per request 2026-05-07 */
    grid-template-columns: repeat(auto-fill, minmax(77px, 1fr));
    gap: 6px;
    min-height: 80px;
}
.snap-mr__pool-tiles:empty::before {
    content: 'All sorted! 🎉';
    grid-column: 1 / -1;
    text-align: center;
    color: var(--mr-slate-2);
    font-size: 13px;
    padding: 24px 12px;
}

/* Bucket grid (left pane on desktop, stacked below pool on mobile).
 * Independently scrollable on desktop so the toolbar + action-bar stay
 * pinned and the user doesn't have to scroll the whole page to find a
 * bucket. */
.snap-mr__buckets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-content: start;
}
@media (min-width: 640px) {
    .snap-mr__buckets { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (min-width: 980px) {
    .snap-mr__buckets {
        max-height: calc(100vh - 240px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 8px; /* room for the scrollbar */
        /* Fill grid cells RIGHT-to-LEFT so the newest (highest-numbered)
         * bucket — first in source order under sortDesc — lands at the
         * top-right corner, immediately adjacent to the unassigned pool
         * column. Without this the newest bucket sat at the FAR LEFT,
         * forcing the user's eye to jump back across the buckets pane
         * every time they wanted to drop into the freshly-created lot. */
        direction: rtl;
    }
    .snap-mr__bucket {
        /* Restore LTR for the card's internal content (lot number,
         * counts, action buttons, photo grid) — RTL only flips
         * placement at the grid level. */
        direction: ltr;
    }
}
.snap-mr__bucket {
    background: #fff;
    border: 1px solid var(--mr-line);
    border-radius: var(--mr-radius);
    box-shadow: var(--mr-shadow);
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.snap-mr__bucket.is-dropping { border-color: var(--mr-amber); }
.snap-mr__bucket-head {
    padding: 10px 12px;
    border-bottom: 1px solid var(--mr-line);
    background: #FEF3C7;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}
.snap-mr__bucket-num {
    font-weight: 800;
    color: var(--mr-navy);
    font-size: 16px;
    background: #fff;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid #FCD34D;
    min-width: 36px;
    text-align: center;
}
.snap-mr__bucket-count { font-size: 12px; color: var(--mr-slate-2); }
.snap-mr__bucket-actions { display: flex; gap: 6px; }
.snap-mr__bucket-action-btn {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--mr-slate-2);
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}
.snap-mr__bucket-action-btn:hover { background: rgba(255,255,255,0.7); color: var(--mr-navy); }
.snap-mr__bucket-action-btn--danger:hover { color: #dc2626; }
.snap-mr__bucket-tiles {
    padding: 10px;
    display: grid;
    /* Photos sized +10% (60 → 66 px min) per request 2026-05-07 */
    grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
    gap: 6px;
    min-height: 92px;
}
.snap-mr__bucket-tiles:empty::before {
    content: 'Drop photos here';
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    padding: 22px 12px;
    border: 2px dashed var(--mr-line);
    border-radius: 8px;
    line-height: 1.5;
}

/* Photo tiles (used in pool + buckets) */
.snap-mr__tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--mr-line-2);
    border-radius: 6px;
    overflow: hidden;
    cursor: grab;
    border: 2px solid transparent;
    transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.snap-mr__tile:hover {
    border-color: var(--mr-amber);
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(14, 42, 71, 0.2);
}
.snap-mr__tile.is-selected { border-color: var(--mr-navy); }
.snap-mr__tile img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none; /* don't fight Sortable's drag */
}
.snap-mr__tile-name {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
    color: #fff;
    font-size: 9px;
    line-height: 1.2;
    padding: 8px 4px 3px;
    text-align: center;
    font-family: monospace;
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sortable.js drag visuals */
.snap-mr__tile.sortable-ghost { opacity: 0.4; }
.snap-mr__tile.sortable-chosen { cursor: grabbing; }
.snap-mr__tile.sortable-drag {
    box-shadow: 0 8px 24px rgba(14, 42, 71, 0.35);
    transform: scale(1.1);
}

/* Sticky action bar at bottom of page */
.snap-mr__actionbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    border-top: 1px solid var(--mr-line);
    padding: 10px 16px;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(14, 42, 71, 0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}
.snap-mr__actionbar-stats {
    font-size: 13px;
    color: var(--mr-slate);
    flex: 1 1 auto;
    min-width: 0;
}
.snap-mr__actionbar-stats strong { color: var(--mr-navy); font-weight: 700; }
.snap-mr__actionbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Save status indicator */
.snap-mr__sync {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mr-slate-2);
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--mr-line-2);
}
.snap-mr__sync--saving { color: var(--mr-navy); }
.snap-mr__sync--saved  { color: #16a34a; background: #dcfce7; }
.snap-mr__sync--error  { color: #dc2626; background: #fee2e2; }
.snap-mr__sync-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}
.snap-mr__sync--saving .snap-mr__sync-dot { animation: snap-mr-pulse 1.2s ease-in-out infinite; }
@keyframes snap-mr-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.7); }
}

/* Modals (auto-bundle, finalize-orphans) */
.snap-mr__modal-overlay {
    position: fixed; inset: 0; z-index: 99998;
    background: rgba(14, 42, 71, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: snap-mr-fade-in 0.18s ease;
}
.snap-mr__modal {
    background: #fff;
    border-radius: var(--mr-radius);
    box-shadow: 0 20px 60px rgba(14, 42, 71, 0.35);
    max-width: 480px;
    width: 100%;
    padding: 26px 24px 22px;
    font-family: inherit;
}
.snap-mr__modal-h {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: var(--mr-navy);
}
.snap-mr__modal-sub {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--mr-slate-2);
    line-height: 1.5;
}
.snap-mr__modal-row {
    display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
    font-size: 13px; color: var(--mr-slate);
}
.snap-mr__modal-row label { display: flex; gap: 6px; align-items: center; flex: 1 1 0; min-width: 0; }
.snap-mr__modal-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
}
.snap-mr__modal-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 16px; flex-wrap: wrap;
}
@keyframes snap-mr-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Toolbar additions for AIV2 parity =================================
 * Selection chip + multi-select buttons + jump-to-lot input + danger button. */
.snap-mr__toolbar-selection {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.snap-mr__toolbar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.snap-mr__sel-count {
    background: var(--mr-navy, #0E2A47);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
}
.snap-mr__btn--danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.snap-mr__btn--danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
.snap-mr__toolbar-jump {
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--mr-line, #E5E7EB);
    background: var(--mr-line-2, #F1F5F9);
    color: var(--mr-navy, #0E2A47);
    font-family: inherit;
    font-size: 13px;
    width: 130px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.snap-mr__toolbar-jump:focus {
    outline: none;
    background: #fff;
    border-color: var(--mr-amber, #F59E0B);
}

/* ===== Tile selection + hover affordances ================================
 * Selected tiles get a navy outline + amber tint. Hover X appears top-right;
 * cascade nudge ◀ ▶ overlays the top edge when batch limit is set. */
.snap-mr__tile.is-selected {
    border-color: var(--mr-navy, #0E2A47);
    box-shadow: 0 0 0 2px rgba(14, 42, 71, 0.45), 0 4px 12px rgba(14, 42, 71, 0.18);
    transform: scale(1.04);
    z-index: 2;
}
.snap-mr__tile.is-selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(245, 158, 11, 0.18);
    border-radius: inherit;
    pointer-events: none;
}
.snap-mr__tile-x {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(220, 38, 38, 0.92);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
}
.snap-mr__tile-x:hover {
    transform: scale(1.1);
}
.snap-mr__tile-nudge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 2px;
    padding: 2px;
    z-index: 5;
}
.snap-mr__tile-nudge button {
    flex: 1 1 0;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    border: 0;
    border-radius: 3px;
    padding: 2px 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}
.snap-mr__tile-nudge button:hover {
    background: var(--mr-amber, #F59E0B);
}

/* ===== Empty buckets placeholder ========================================= */
.snap-mr__buckets-empty {
    text-align: center;
    padding: 32px 16px;
    color: #94a3b8;
    font-size: 14px;
    border: 2px dashed var(--mr-line, #E5E7EB);
    border-radius: var(--mr-radius, 14px);
    background: #fff;
}

/* ===== Bucket flash on jump-to ========================================== */
.snap-mr__bucket.is-flash {
    animation: snap-mr-flash 1.2s ease;
}
@keyframes snap-mr-flash {
    0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0), var(--mr-shadow); }
    25%  { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.4), var(--mr-shadow); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.0), var(--mr-shadow); }
}

/* ===== Splitter bar (desktop only) =======================================
 * Light-blue 5 px solid bar between buckets and pool — matches the AIV2
 * upstream's resting → accent transition (sky-300 → sky-600 → sky-800).
 * Hidden on mobile via the @media block. JS rewrites the layout's
 * grid-template-columns inline on drag so the splitter holds its width. */
.snap-mr__splitter {
    display: none;
    width: 5px !important;
    background: #7DD3FC !important;     /* sky-300 — soft light blue */
    cursor: col-resize;
    align-self: stretch;
    min-height: 200px;
    border-radius: 2px;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.snap-mr__splitter:hover  {
    background: #0284C7 !important;     /* sky-600 — brighter on hover */
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
}
.snap-mr__splitter:active {
    background: #0369A1 !important;     /* sky-700 — deeper while dragging */
}

/* ===== Catalogue-conflict awareness ======================================
 * Buckets whose number already exists in the live catalogue get a red
 * pill on the header + a tinted top border. The finalize modal shows a
 * dedicated conflict block with an Auto-renumber escape hatch. */
.snap-mr__bucket.is-conflict {
    border-color: #fca5a5;
    box-shadow: 0 0 0 1px #fecaca, var(--mr-shadow);
}
.snap-mr__bucket.is-conflict .snap-mr__bucket-head {
    background: #fee2e2;
    border-bottom-color: #fca5a5;
}
.snap-mr__bucket-conflict {
    font-size: 11px;
    font-weight: 700;
    color: #991b1b;
    background: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #fca5a5;
    cursor: help;
    white-space: nowrap;
}
.snap-mr__modal-error--warn {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    color: #92400e;
}
.snap-mr__conflict {
    margin: 12px 0 0;
    padding: 12px 14px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    border-radius: 10px;
}
.snap-mr__conflict-h {
    font-size: 13px;
    color: #991b1b;
    margin-bottom: 8px;
    line-height: 1.4;
}
.snap-mr__conflict-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}
.snap-mr__conflict-pill {
    background: #fff;
    border: 1px solid #fca5a5;
    color: #991b1b;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: monospace;
}
.snap-mr__conflict-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== "+ New lot" + Sequential toggle group ============================
 * Visually couples the +New lot button with its "Sequential" checkbox so
 * the toggle reads as a modifier attached to that button, not a free-
 * floating option in the toolbar. */
.snap-mr__newlot-group {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--mr-line, #E5E7EB);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.snap-mr__newlot-group > .snap-mr__btn {
    border: 0;
    border-radius: 0;
    border-right: 1px solid var(--mr-line, #E5E7EB);
}
.snap-mr__seq-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--mr-slate-2, #64748B);
    cursor: pointer;
    user-select: none;
    background: var(--mr-line-2, #F1F5F9);
    transition: background 0.15s ease, color 0.15s ease;
}
.snap-mr__seq-toggle:hover {
    background: var(--mr-cream, #FAF6EC);
    color: var(--mr-navy, #0E2A47);
}
.snap-mr__seq-toggle input[type="checkbox"] {
    accent-color: var(--mr-amber, #F59E0B);
    cursor: pointer;
}
.snap-mr__seq-toggle:has(input:checked) {
    background: #FEF3C7;
    color: var(--mr-navy, #0E2A47);
}

/* ===== Trash bin (toolbar drop target) ===================================
 * Sortable target. Drag any tile (or multiple selected tiles) onto it →
 * confirm modal → hard-delete from the server. */
.snap-mr__trash {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px dashed #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
    cursor: default;
    transition: border-color 0.15s ease, background 0.15s ease,
                transform 0.15s ease, box-shadow 0.15s ease;
}
.snap-mr__trash-icon  { font-size: 16px; line-height: 1; }
.snap-mr__trash-label { font-size: 12px; opacity: 0.85; }
@media (max-width: 760px) {
    .snap-mr__trash-label { display: none; }
}
.snap-mr__trash.is-armed {
    border-color: #dc2626;
    background: #fee2e2;
    color: #991b1b;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
    animation: snap-mr-trash-pulse 1.4s ease-in-out infinite;
}
@keyframes snap-mr-trash-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25); }
    50%      { box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);  }
}

/* Hide ANY tile that ends up inside the trash bin — the ghost preview
 * Sortable inserts during dragover, and the actual element on drop.
 * Without this, .snap-mr__tile { width: 100% } expanded to fill the
 * trash bin's flexible width and the dragged tile rendered as a giant
 * cropped image right next to the cursor. The pulse animation on
 * .is-armed gives the user the drop affordance, the confirm modal does
 * the rest — no need to actually paint the tile inside the bin. */
.snap-mr__trash {
    /* Lock outer size so a stray tile inside can't blow it up either */
    flex: 0 0 auto;
    max-width: 220px;
    overflow: hidden;
}
.snap-mr__trash > .snap-mr__tile,
.snap-mr__trash > .sortable-ghost,
.snap-mr__trash .snap-mr__tile {
    display: none !important;
}

/* ===== Wide modal (auto-bundle preview, help) ============================ */
.snap-mr__modal--wide {
    max-width: 560px;
}
.snap-mr__modal-error {
    margin-top: 10px;
    padding: 8px 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #b91c1c;
    font-size: 13px;
}

/* ===== Auto-bundle preview list ========================================= */
.snap-mr__autobundle-preview {
    margin-top: 10px;
    border: 1px solid var(--mr-line, #E5E7EB);
    border-radius: 8px;
    overflow: hidden;
    max-height: 280px;
    display: flex;
    flex-direction: column;
}
.snap-mr__autobundle-preview-head {
    padding: 8px 12px;
    border-bottom: 1px solid var(--mr-line, #E5E7EB);
    background: var(--mr-cream, #FAF6EC);
    font-size: 13px;
    color: var(--mr-slate, #334155);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.snap-mr__autobundle-warn {
    color: #d97706;
    font-weight: 700;
    font-size: 12px;
}
.snap-mr__autobundle-preview-list {
    overflow-y: auto;
    flex: 1 1 auto;
}
.snap-mr__autobundle-row {
    padding: 6px 12px;
    border-bottom: 1px solid var(--mr-line-2, #F1F5F9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--mr-slate, #334155);
}
.snap-mr__autobundle-row:last-child {
    border-bottom: 0;
}
.snap-mr__autobundle-row.is-conflict {
    background: #FEF3C7;
    color: #92400e;
}
.snap-mr__autobundle-row-count {
    font-size: 12px;
    color: var(--mr-slate-2, #64748B);
}

/* ===== Help modal step blocks =========================================== */
.snap-mr__help-step {
    padding: 10px 12px;
    border: 1px solid var(--mr-line, #E5E7EB);
    border-radius: 8px;
    background: var(--mr-cream, #FAF6EC);
    margin-bottom: 10px;
}
.snap-mr__help-step strong {
    display: block;
    color: var(--mr-navy, #0E2A47);
    font-size: 14px;
    margin-bottom: 4px;
}
.snap-mr__help-step p {
    margin: 0;
    color: var(--mr-slate, #334155);
    font-size: 13px;
    line-height: 1.55;
}

/* ===== Orphans block in finalize modal ================================== */
.snap-mr__orphans {
    margin: 12px 0 0;
    padding: 12px;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    border-radius: 8px;
}
.snap-mr__orphans-h {
    font-weight: 700;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 8px;
}
.snap-mr__orphans-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 4px;
    font-size: 13px;
    color: var(--mr-slate, #334155);
    cursor: pointer;
}
.snap-mr__orphans-row:hover {
    background: rgba(252, 211, 77, 0.18);
    border-radius: 4px;
}
.snap-mr__orphans-row input {
    margin-top: 3px;
}

/* Toast (reused look from bulk-upload) */
.snap-mr__toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--mr-navy);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 99999;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    max-width: 90vw;
    text-align: center;
}
.snap-mr__toast--warn  { background: #d97706; }
.snap-mr__toast--error { background: #dc2626; }
.snap-mr__toast--ok    { background: #16a34a; }
