.bulk-page { background:#f3edfc; }
.bulk {
  --bulk-panel:#fff; --bulk-ink:#1a1730; --bulk-muted:#5e5874; --bulk-line:#e3d8f5;
  --bulk-soft:#f7f2ff; --bulk-purple:#642ce8; --bulk-focus:#7238ed;
  --bulk-field:#fff; --bulk-disabled:#e6e1f1; --bulk-disabled-text:#706980;
  color:var(--bulk-ink); width:min(100% - 2rem,1480px); max-width:1480px; margin-inline:auto; padding-inline:0; padding-block:1.4rem 3rem;
}
[data-theme="dark"] .bulk-page, .bulk-page[data-theme="dark"] { background:#1a1429; }
[data-theme="dark"] .bulk {
  --bulk-panel:#261e36; --bulk-ink:#f3eeff; --bulk-muted:#d3c7e8; --bulk-line:#51436a;
  --bulk-soft:#322547; --bulk-purple:#743cf0; --bulk-focus:#be9eff;
  --bulk-field:#292038; --bulk-disabled:#3c334b; --bulk-disabled-text:#c2b4d3;
}
.bulk [hidden] { display:none !important; }
.bulk-heading { display:flex; align-items:end; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.bulk h1 { margin:0 0 .3rem; font-size:clamp(1.65rem,3vw,2.55rem); }
.bulk-heading p { margin:0; color:var(--bulk-muted); max-width:70ch; }
.bulk-heading a { flex:none; color:inherit; text-decoration:underline; text-underline-offset:3px; }
.bulk h2 { margin:0 0 .65rem; font-size:1.15rem; }
.bulk-layout { display:grid; grid-template-columns:minmax(0,2.55fr) minmax(235px,1fr); gap:.9rem; align-items:start; }
.bulk-side { display:grid; gap:.9rem; min-width:0; }
.bulk-panel,.bulk dialog {
  color:var(--bulk-ink); background:var(--bulk-panel); border:1px solid var(--bulk-line);
  border-radius:16px; box-shadow:0 2px 8px #30145b09; padding:1rem; min-width:0;
}
.bulk button,.bulk input[type="search"],.bulk select {
  appearance:none; font:inherit; color:inherit; background:var(--bulk-field);
  border:1px solid var(--bulk-line); border-radius:9px; box-sizing:border-box;
}
.bulk button { padding:.5rem .75rem; font-weight:600; line-height:1.3; cursor:pointer; }
.bulk button:not(:disabled):hover { background:var(--bulk-soft); border-color:var(--bulk-focus); }
.bulk button.primary {
  color:#fff; background:linear-gradient(160deg,#783df1,var(--bulk-purple) 72%,#5822c2);
  border-color:transparent; box-shadow:0 2px 5px #5023ac25;
}
.bulk button.primary:not(:disabled):hover { color:#fff; background:#5621c9; border-color:transparent; }
.bulk button:disabled { color:var(--bulk-disabled-text); background:var(--bulk-disabled); box-shadow:none; cursor:default; opacity:1; }
.bulk :is(button,input,select,a,summary,[tabindex]):focus-visible { outline:2px solid var(--bulk-focus); outline-offset:2px; }
.bulk-actions,.bulk-progress > div { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; }
.bulk-progress { padding:.8rem .95rem; border:1px solid var(--bulk-line); background:var(--bulk-soft); border-radius:12px; margin:.85rem 0; }
.bulk-progress > div { justify-content:space-between; }
.bulk-progress progress { display:block; width:100%; height:.62rem; margin:.55rem 0; border:none; border-radius:20px; background:#ddd0f7; overflow:hidden; accent-color:var(--bulk-purple); }
.bulk-progress progress::-webkit-progress-bar { background:#ddd0f7; }
.bulk-progress progress::-webkit-progress-value { background:linear-gradient(90deg,#7834ef,#642ce8); border-radius:20px; }
.bulk-progress progress::-moz-progress-bar { background:#642ce8; border-radius:20px; }
.bulk-progress p { color:var(--bulk-muted); margin:.3rem 0; }
.bulk-scroll { max-height:min(66vh,620px); overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; scrollbar-color:#a992cc transparent; padding:2px 6px 5px 2px; }
.bulk-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:start; gap:.65rem; }
.bulk-photo { border:1px solid var(--bulk-line); background:var(--bulk-panel); border-radius:12px; min-width:0; }
.bulk-photo[data-state="working"] { outline:2px solid var(--bulk-focus); outline-offset:-1px; }
.bulk-preview { position:relative; overflow:hidden; border-radius:11px 11px 0 0; aspect-ratio:4/3; isolation:isolate; }
.bulk-preview img { display:block; width:100%; height:100%; object-fit:contain; background:#eeeaf4; }
.bulk-photo[data-state="done"] img { background:repeating-conic-gradient(#fff 0 25%,#ebe8f1 0 50%) 0/16px 16px; }
.bulk-status {
  position:absolute; z-index:2; inset:.45rem auto auto .45rem; margin:0; padding:.23rem .48rem;
  color:#2e2840; background:#f1eef7; border-radius:99px; font-size:.76rem; font-weight:700;
}
.bulk-photo[data-state="done"] .bulk-status { color:#165b2a; background:#d7f8df; }
.bulk-photo[data-state="failed"] .bulk-status { color:#8c2130; background:#ffe4e7; }
.bulk-photo[data-state="working"] .bulk-status { inset:50% auto auto 50%; transform:translate(-50%,-50%); background:#241b3aeb; color:white; text-align:center; min-width:max-content; }
.bulk-preview .magic { position:absolute; inset:0; z-index:1; background-color:#21183155; pointer-events:none; }
.bulk-card-footer { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,max-content); align-items:start; gap:.35rem; padding:.42rem .48rem; }
.bulk-filename { margin:.35rem 0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; min-width:0; font-size:.86rem; }
.bulk-card-footer .bulk-actions { justify-content:flex-end; max-width:100%; gap:.25rem; }
.bulk-card-footer button { font-size:.76rem; padding:.34rem .45rem; }
.bulk-split { display:inline-flex; min-width:0; border-radius:8px; overflow:hidden; }
.bulk-split button.primary { border-radius:0; box-shadow:none; flex:none; }
.bulk-split button.bulk-split-options { border-inline-start:1px solid #ffffff65; min-width:1.65rem; font-size:1rem; line-height:1; }
.bulk-photo-details { width:100%; color:var(--bulk-muted); font-size:.75rem; text-align:end; }
.bulk-photo-details p { margin:.3rem 0; overflow-wrap:anywhere; }
.bulk-photo-details summary { cursor:pointer; }
.bulk-photo-details[open] { text-align:start; }
.bulk-side section:first-child .bulk-actions { align-items:stretch; }
#bulk-zip { flex:1; }
#bulk-count { font-weight:700; margin:.4rem 0 .7rem; }
.bulk-history-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.35rem; margin-bottom:.48rem; }
.bulk-history-item button { text-align:start; overflow-wrap:anywhere; font-size:.83rem; }
.bulk-history-item button:first-child { background:var(--bulk-soft); }
.bulk-storage-panel p { margin:0 0 .65rem; font-weight:600; overflow-wrap:anywhere; }
.bulk-storage-panel #bulk-delete-all { display:block; margin-inline-start:auto; }
#bulk-storage[data-level="warn"] { color:#9c4300; background:#fff1df; border-radius:8px; padding:.55rem; }
#bulk-storage[data-level="critical"] { color:#a01822; background:#ffe4e7; border-radius:8px; padding:.55rem; }
.bulk dialog { width:min(620px,calc(100vw - 2rem)); max-height:calc(100dvh - 2rem); padding:1.2rem; }
.bulk dialog::backdrop { background:#241a3d76; }
.bulk-dialog-heading { display:flex; justify-content:space-between; gap:.7rem; align-items:center; margin-bottom:.7rem; }
.bulk-dialog-heading h2 { margin:0; }
.bulk button.bulk-dialog-close { padding:.25rem .55rem; font-size:1.25rem; }
.bulk input[type="search"] { padding:.55rem .65rem; width:100%; margin-bottom:.65rem; }
.bulk select { appearance:auto; padding:.45rem .6rem; min-width:6rem; }
.bulk-review-results { max-height:42vh; overflow:auto; margin-block:.75rem; }
.bulk-review-results label { display:grid; grid-template-columns:auto 42px minmax(0,1fr); align-items:center; gap:.5rem; padding:.4rem; border-bottom:1px solid var(--bulk-line); }
.bulk-review-results label:hover { background:var(--bulk-soft); }
.bulk-review-results label span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bulk-review-results input[type="checkbox"],.bulk input[type="range"] { accent-color:var(--bulk-purple); }
.bulk-review-results img { width:42px; height:32px; object-fit:cover; border-radius:5px; }
.bulk-export-fields { display:grid; gap:.65rem; }
.bulk-export-fields label,.bulk-quality-control { display:flex; align-items:center; gap:.55rem; flex-wrap:wrap; }
#bulk-export-jpg-note,#bulk-export-size { color:var(--bulk-muted); }
@media (max-width:1080px) { .bulk-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:760px) {
  .bulk { width:min(100% - 1rem,1480px); }
  .bulk-heading { align-items:start; flex-direction:column; gap:.5rem; }
  .bulk-layout,.bulk-grid { grid-template-columns:minmax(0,1fr); }
  .bulk-preview { max-height:235px; }
  .bulk-scroll { max-height:58dvh; }
}
.bulk button .ui-icon { vertical-align:-.18em; width:1em; height:1em; margin-inline-end:.3em; }
.bulk button.bulk-split-options .ui-icon { margin:0; }
.bulk-card-footer .bulk-actions { max-width:min(11rem,42vw); min-width:0; }
.bulk-card-footer { display:flex; flex-direction:column; align-items:stretch; }
.bulk-card-footer .bulk-actions { justify-content:space-between; max-width:none; }
.bulk-card-meta { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,auto); gap:.4rem; align-items:start; }
.bulk .bulk-filename { box-sizing:border-box; margin:0; width:100%; padding:.3rem .35rem; font:inherit; font-size:.84rem; min-width:0; border:1px solid transparent; border-radius:6px; color:inherit; background:transparent; cursor:text; text-overflow:ellipsis; }
.bulk .bulk-filename:is(:hover,:focus) { border-color:var(--bulk-line); background:var(--bulk-field); text-overflow:clip; }
.bulk-photo-details summary { padding-block:.35rem; }
.bulk-photo-details { max-width:9.5rem; overflow-wrap:anywhere; }
.bulk-history-item { grid-template-columns:minmax(0,1fr) auto; align-items:center; }
.bulk button.bulk-history-open { display:grid; grid-template-columns:2.75rem minmax(0,1fr); align-items:center; gap:.65rem; min-width:0; padding:.55rem; }
.bulk-history-cover { display:grid; place-items:center; width:2.75rem; height:2.75rem; border-radius:8px; overflow:hidden; color:var(--bulk-focus); background:var(--bulk-panel); }
.bulk-history-cover img { width:100%; height:100%; object-fit:contain; }
.bulk-history-open strong,.bulk-history-open small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bulk-history-open small { margin-top:.25rem; color:var(--bulk-muted); }
.bulk button.bulk-history-delete { padding:.5rem; color:var(--bulk-muted); }
.bulk button.bulk-history-delete .ui-icon { margin:0; width:1.05em; height:1.05em; }
.bulk button.bulk-history-delete:hover { color:var(--bulk-focus); }
.bulk-card-meta { grid-template-columns:auto minmax(0,1fr) auto; }
.bulk-number { align-self:start; white-space:nowrap; border-radius:7px; padding:.22rem .38rem; background:var(--bulk-soft); color:var(--bulk-focus); font-size:.78rem; font-weight:650; }
.bulk-history-open strong,.bulk-storage-panel p { font-family:inherit; font-size:1rem; font-weight:600; }
.bulk-history-panel summary { display:flex; align-items:center; justify-content:space-between; font-size:1.15rem; font-weight:700; cursor:pointer; list-style:none; }
.bulk-history-panel summary::-webkit-details-marker { display:none; }
.bulk-history-panel[open] summary { margin-bottom:.65rem; }
.bulk-history-panel summary .ui-icon { width:1rem; height:1rem; }
.bulk-history-panel[open] summary .ui-icon { transform:rotate(180deg); }
.bulk-photo[data-state="skipped"] .bulk-status { color:#6b4c16; background:#fff0d2; }
@media (max-width:760px) {
  .bulk-page { --bulk-dock-height:calc(65px + env(safe-area-inset-bottom)); }
  .bulk { padding-bottom:calc(var(--bulk-dock-height) + var(--pwa-install-height,0px) + 1.5rem); }
  .bulk-layout { gap:.65rem; }
  .bulk-panel { padding:.7rem; }
  .bulk-progress { margin:.65rem 0; }
  .bulk-scroll { max-height:52dvh; }
  .bulk-photo[data-state="working"] .bulk-card-footer button { width:100%; min-height:38px; }
  .bulk-photo:not([data-state="working"]) { display:grid; grid-template-columns:minmax(96px,38%) minmax(0,1fr); }
  .bulk-photo:not([data-state="working"]) .bulk-preview { border-radius:11px 0 0 11px; min-height:96px; height:100%; }
  .bulk-photo:not([data-state="working"]) .bulk-card-meta { grid-template-columns:auto minmax(0,1fr); }
  .bulk-photo:not([data-state="working"]) .bulk-photo-details { grid-column:1/-1; }
  #bulk-mobile-dock { display:flex; position:fixed; z-index:23; inset:auto 0 0; min-height:var(--bulk-dock-height); box-sizing:border-box; padding:.5rem .75rem calc(.5rem + env(safe-area-inset-bottom)); border-top:1px solid var(--bulk-line); background:var(--bulk-panel); }
  #bulk-mobile-dock > button { flex:1; min-height:43px; }
  .bulk-page #pwa-install-bar[data-above-output] { bottom:calc(var(--pwa-output-height,0px) + 6px); }
}

@media (max-width:760px) {
  .bulk-photo:not([data-state="working"]) .bulk-preview {
    aspect-ratio:auto;
    height:auto;
    min-width:0;
    max-height:none;
    min-height:96px;
    overflow:hidden;
  }
  .bulk-photo:not([data-state="working"]) .bulk-preview img {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:contain;
  }
  .bulk-photo .bulk-card-footer { min-width:0; }
  .bulk-photo .bulk-card-footer .bulk-actions { flex-wrap:wrap; }
}

.bulk #bulk-select-filtered:not(:disabled) {
  color:var(--bulk-ink); background:color-mix(in srgb,var(--bulk-purple) 12%,var(--bulk-field));
  border-color:color-mix(in srgb,var(--bulk-purple) 24%,var(--bulk-line));
}
.bulk #bulk-select-filtered:not(:disabled):hover {
  background:color-mix(in srgb,var(--bulk-purple) 20%,var(--bulk-field));
}
.bulk #bulk-editor { width:min(390px,calc(100vw - 2rem)); }
#bulk-editor-choices { display:grid; gap:.55rem; }
#bulk-editor-choices button { text-align:start; }
.bulk #bulk-editor.bulk-editor-workspace[open] {
  box-sizing:border-box; display:grid; grid-template-rows:auto minmax(0,1fr) auto;
  width:min(1240px,calc(100vw - 2rem)); height:calc(100dvh - 2rem);
  overflow:hidden; padding:.75rem;
}
#bulk-editor-frame { display:block; width:100%; height:100%; min-height:0; border:0; }
.bulk-editor-footer { display:flex; justify-content:flex-end; align-items:center; flex-wrap:wrap; gap:.55rem; }
.bulk-editor-footer:has(:not([hidden])) { padding-top:.55rem; }
#bulk-editor-status { margin:0; color:var(--bulk-muted); overflow-wrap:anywhere; }
@media (max-width:760px) {
  .bulk #bulk-editor.bulk-editor-workspace[open] {
    width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; border-radius:0;
    padding:max(.5rem,env(safe-area-inset-top)) .5rem max(.5rem,env(safe-area-inset-bottom));
  }
  #bulk-editor-apply { flex:1 1 100%; }
}

.bulk-history-scroll {
  max-height:min(420px,55vh);
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  scrollbar-color:#a992cc transparent;
  padding:3px;
}
#bulk-history-totals, #bulk-count { color:var(--bulk-muted); margin:.5rem 0; }
.bulk button#bulk-history-more { display:block; margin:.55rem auto 0; color:var(--bulk-focus); }
.bulk-history-item:last-child { margin-bottom:0; }

.bulk-empty-batch .bulk-picker {
  display:grid;
  place-items:center;
  align-content:center;
  gap:1rem;
  min-height:clamp(285px,46vh,405px);
  padding:clamp(.75rem,3vw,2rem);
  border:2px dashed var(--bulk-line);
  border-radius:16px;
  text-align:center;
  background:var(--bulk-soft);
}
.bulk-empty-batch .bulk-picker h2 { margin:.75rem 0 0; font-size:clamp(1.12rem,2.3vw,1.45rem); }
.bulk .bulk-picker-icon { width:2.6rem; height:2.6rem; color:var(--bulk-focus); }
.bulk-empty-batch .bulk-picker .bulk-actions { justify-content:center; }
.bulk-empty-batch .bulk-picker button { min-height:48px; padding:.65rem 1rem; }
#bulk-picker-help { color:var(--bulk-muted); }
#bulk-picker-help p { margin:0 0 .55rem; }
#bulk-picker-help p:last-child { margin:0; font-size:.9rem; }
#bulk-picker-help .ui-icon { width:1em; height:1em; }
.bulk-empty-batch .bulk-dragging .bulk-picker { border-color:var(--bulk-focus); }
.bulk-page:not(.bulk-empty-batch) .bulk-dragging { outline:2px dashed var(--bulk-focus); outline-offset:-4px; }
@media (max-width:760px) {
  .bulk-empty-batch .bulk { padding-bottom:calc(var(--pwa-install-height,0px) + 1.5rem); }
  .bulk-picker > .bulk-actions > button { flex:1 1 40%; min-height:43px; }
  .bulk-picker > .bulk-actions > #bulk-start { flex-basis:100%; }
}
