/* ── imgready palette ─────────────────────────────────────────── */
:root {
  --bg:          #f5f0e8;
  --bg2:         #ede7d9;
  --surface:     #faf7f2;
  --surface2:    #ede7d9;
  --border:      #d6cebb;
  --accent:      #5a7a5a;
  --accent2:     #7a9e7a;
  --accent-light:#e8f0e8;
  --text:        #2e2a22;
  --text2:       #5a5448;
  --muted:       #8a8070;
  --muted-s:     #766a5a;
  --danger:      #b05a4a;
  --shadow:      rgba(90,80,60,.12);
  --r:           10px;
  --r-sm:        7px;
  --t:           150ms ease;
  --hdr:         54px;
  --opbar:       79px; /* cats 38px + tools 40px + 1px border */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'cv02','cv03','cv04','cv11'; /* Inter optical tweaks */
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ── Header ──────────────────────────────────────────────────── */
.hdr {
  position: sticky;
  top: 0;
  z-index: 300;
  height: var(--hdr);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.logo span { color: var(--accent); }

.hdr-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; display: none; }
.hdr-file { display: none; flex: 1; min-width: 0; }
body[data-state="loaded"] .hdr-file { display: flex; flex-direction: column; justify-content: center; }
body[data-state="loaded"] .hdr-sep  { display: block; }
.hdr-fname { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-fmeta { font-size: 11px; color: var(--muted-s); margin-top: 1px; }

.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hdr-trust {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.btn-ghost {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--t);
  display: none;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
body[data-state="loaded"] .btn-ghost { display: inline-flex; align-items: center; }

/* ── Progress ────────────────────────────────────────────────── */
#prog {
  position: fixed;
  top: var(--hdr);
  left: 0; right: 0;
  height: 3px;
  background: var(--border);
  z-index: 400;
  display: none;
}
#prog-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 150ms ease;
  border-radius: 0 2px 2px 0;
}

/* ── States ──────────────────────────────────────────────────── */
body[data-state="loaded"] .home  { display: none; }
body[data-state="empty"]  .workspace { display: none; }

/* ── Home / drop zone ────────────────────────────────────────── */
.home {
  overflow-y: auto;
}
.drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg);
  cursor: pointer;
  transition: background var(--t);
  padding: 40px;
}
.drop-zone:hover, .drop-zone.over { background: var(--accent-light); }
/* Subtle dashed border ring when dragging */
.drop-zone.over { outline: 3px dashed var(--accent); outline-offset: -12px; border-radius: 12px; }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-h { font-size: 21px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 6px; }
.dz-sub { color: var(--muted-s); font-size: 14px; }
.dz-sub b { color: var(--accent); font-weight: 700; }
.dz-trust {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.trust-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.ti { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted-s); }
.ti svg { color: var(--accent); }
.verify { margin-top: 10px; font-size: 11px; color: var(--muted); }
.verify code {
  font-family: monospace;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
}

/* ── Operation toolbar — category tabs + tool row ─────────────── */
.op-bar {
  position: sticky;
  top: var(--hdr);
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* Category tab bar */
.op-cats {
  display: flex;
  align-items: stretch;
  height: 38px;
  padding: 0 16px;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.op-cats::-webkit-scrollbar { display: none; }

/* Tool row — shows active category's tools */
.op-tools {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  gap: 4px;
  background: var(--bg2);
  overflow-x: auto;
  scrollbar-width: none;
}
.op-tools::-webkit-scrollbar { display: none; }

/* Category tab button */
.op-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.op-cat-btn:hover { color: var(--text2); background: var(--surface2); }
.op-cat-btn.on    { color: var(--accent); border-bottom-color: var(--accent); background: var(--accent-light); font-weight: 700; }
.op-cat-btn svg   { width: 11px; height: 11px; flex-shrink: 0; opacity: .7; }
.op-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 28px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--text2);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t), background var(--t);
  flex-shrink: 0;
}
.op-btn svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--muted); }
.op-btn:hover { color: var(--text); background: var(--surface2); }
.op-btn.on  {
  /* Filled chip — clean, no shadow, no line */
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}
.op-btn.on svg { color: #fff; opacity: 1; }
.op-btn.on:hover { background: var(--accent2); }
.op-sep { width: 1px; background: var(--border); margin: 6px 10px; flex-shrink: 0; }

/* ── Settings strip ──────────────────────────────────────────── */
/* Hidden by default */
.ss {
  display: none;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  min-height: 50px;
}
/* Shown when .active class added by JS */
.ss.active { display: flex; }

/* Controls inside strips */
.ss-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.ss-pill {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.ss-pill:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.ss-pill.on    { background: var(--accent); border-color: var(--accent); color: #fff; }

.ss-range {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color var(--t);
}
.ss-range:focus-within { border-color: var(--accent); }
.ss-rlbl {
  padding: 0 9px;
  background: var(--surface2);
  border-right: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.ss-range input {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 6px 9px;
  font: inherit;
  font-size: 13px;
  outline: none;
  width: 160px;
}
.ss-range input::placeholder { color: var(--muted); }

.ss-out {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.ss-out-btn {
  padding: 6px 13px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}
.ss-out-btn:last-child { border-right: none; }
.ss-out-btn:hover { background: var(--accent-light); color: var(--accent); }
.ss-out-btn.on    { background: var(--accent-light); color: var(--accent); font-weight: 700; }

.ss-sel-count { font-size: 13px; color: var(--muted-s); white-space: nowrap; }
.ss-sel-count em { color: var(--accent); font-style: normal; font-weight: 700; }
.ss-info   { font-size: 13px; color: var(--muted-s); white-space: nowrap; }
.ss-input  {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--t);
}
.ss-input:focus { border-color: var(--accent); }
.ss-select {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  padding: 6px 9px;
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.ss-slider-wrap { display: flex; align-items: center; gap: 6px; }
.ss-slider {
  -webkit-appearance: none;
  width: 90px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.ss-slider:hover { background: var(--accent2); }
.ss-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.ss-slider::-moz-range-thumb {
  width: 13px; height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
}
.ss-val { font-size: 12px; color: var(--muted-s); min-width: 30px; }
.ss-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }
.ss-push { margin-left: auto; }

/* Primary action button */
.btn-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), transform .12s, box-shadow .12s;
  flex-shrink: 0;
}
.btn-act:hover  { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(90,122,90,.28); }
.btn-act:active { transform: translateY(0); box-shadow: none; }
.btn-act:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-sec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t);
}
.btn-sec:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-sec:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fdf2f0; }

/* ── Main content area ───────────────────────────────────────── */
.main-area { padding: 24px 28px 60px; }

/* ── Page grid ───────────────────────────────────────────────── */
.pg-area.hidden { display: none; }
.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cmin, 220px), 1fr));
  gap: 16px;
}
.pcard {
  position: relative;
  container-type: inline-size;
  border: 2px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 4px var(--shadow);
  transition: border-color var(--t), box-shadow var(--t), transform .13s;
  user-select: none;
  -webkit-user-select: none;
}
.pcard:hover { border-color: var(--accent2); box-shadow: 0 6px 24px var(--shadow); transform: translateY(-3px); }
.pcard.sel   { border-color: var(--accent);  box-shadow: 0 0 0 2px var(--accent), 0 4px 18px rgba(90,122,90,.18); }
.pcard.sel:hover { transform: translateY(-3px); }
.pcard.reo-pick   { border-color: var(--accent); box-shadow: 0 0 0 2.5px var(--accent), 0 8px 24px rgba(90,122,90,.28); transform: scale(1.04); }
.pcard.reo-target { border-color: var(--accent2); background: var(--accent-light); }

.pthumb {
  aspect-ratio: .707;
  background: var(--bg2);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pthumb canvas { max-width: 100%; max-height: 100%; display: block; transition: transform .2s; }
.pthumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.44) 50%, transparent);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.pthumb.loaded::after { display: none; }
@keyframes shimmer { 0% { background-position: -200% 0 } 100% { background-position: 200% 0 } }

.pcheck {
  position: absolute;
  top: 7px; left: 7px;
  z-index: 10;
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1.5px solid rgba(255,255,255,.75);
  background: rgba(46,42,34,.28);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t), background var(--t), border-color var(--t);
}
.pcheck svg { width: 11px; height: 11px; display: none; }
.pcard:hover .pcheck { opacity: 1; }
.pcard.sel .pcheck   { opacity: 1; background: var(--accent); border-color: var(--accent); }
.pcard.sel .pcheck svg { display: block; }

.pcfoot {
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}
.pcnum { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pcard.sel .pcnum { color: var(--accent); }
.rot-badge { font-size: 11px; font-weight: 700; color: var(--accent); }

/* ── Output areas ────────────────────────────────────────────── */
.out-area { display: none; }
.out-area.on { display: block; }
.out-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: 0 2px 12px var(--shadow); }
.out-panel-hdr { display: flex; align-items: center; justify-content: space-between; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.out-panel-lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.t-area {
  width: 100%;
  min-height: 380px;
  border: none;
  padding: 16px 20px;
  font: 13px/1.8 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: transparent;
  resize: vertical;
  outline: none;
}
.inspect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; padding: 14px; }
.ic { background: var(--bg2); border-radius: var(--r-sm); padding: 11px 13px; }
.ic-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.ic-val { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-all; }
.ic-val.dim { color: var(--muted-s); font-weight: 400; }

/* ── Merge list ──────────────────────────────────────────────── */
.mrg-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.mrg-item { display: flex; align-items: center; gap: 9px; padding: 8px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.mrg-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrg-sz   { font-size: 11px; color: var(--muted-s); }
.mrg-acts { display: flex; gap: 3px; }

/* ── Images → PDF list ───────────────────────────────────────── */
.i2p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-bottom: 14px; max-height: 340px; overflow-y: auto; }
.i2p-item { position: relative; border: 2px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.i2p-item img { width: 100%; aspect-ratio: .707; object-fit: cover; display: block; }
.i2p-num { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.45); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 3px; }
.i2p-rm  { position: absolute; top: 4px; right: 4px; width: 17px; height: 17px; background: rgba(176,90,74,.85); color: #fff; border: none; border-radius: 3px; cursor: pointer; font-size: 10px; display: flex; align-items: center; justify-content: center; }

/* ── Status bar ──────────────────────────────────────────────── */
.status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  height: 40px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  font-size: 12px;
  color: var(--muted);
}
body[data-state="loaded"] .status-bar { display: flex; }
.sb-count { white-space: nowrap; }
.sb-count em { color: var(--accent); font-style: normal; font-weight: 700; }
.sb-hint { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
kbd {
  display: inline-block;
  padding: 1px 5px 2px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface2);
  font: 11px 'Segoe UI', monospace;
  color: var(--text2);
}
.sb-size { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.sb-size-ico { color: var(--muted); display: flex; align-items: center; }
.sb-sl {
  -webkit-appearance: none;
  width: 80px; height: 3px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.sb-sl:hover { background: var(--accent2); }
.sb-sl::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); }
.sb-sl::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--accent); }

/* ── Rubber-band select box ──────────────────────────────────── */
#sel-box {
  position: fixed;
  border: 1px solid var(--accent);
  background: var(--accent-light);
  opacity: .55;
  pointer-events: none;
  z-index: 150;
  display: none;
  border-radius: 3px;
}

/* ── Toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  z-index: 500;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: var(--surface);
  padding: 9px 22px;
  border-radius: 28px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
  box-shadow: 0 4px 18px var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

body.dragging { user-select: none; -webkit-user-select: none; cursor: crosshair; }
body.dragging .pcard { cursor: crosshair; }

/* ── Hide non-PDF tools when PDF loaded ──────────────────────── */
body[data-filetype="pdf"] .op-btn[data-nonpdf],
body[data-filetype="pdf"] .op-sep[data-nonpdf] { display: none; }

/* ── Inspector panel ─────────────────────────────────────────── */
.inspector-panel {
  display: none;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  padding: 14px 24px;
}
.inspector-panel.on { display: block; }

/* ── Other formats dropdown ──────────────────────────────────── */
.op-btn-other { color: var(--muted-s); font-style: normal; }
.other-panel {
  display: none;
  position: fixed;
  z-index: 500;
  top: calc(var(--hdr) + var(--opbar));
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 32px var(--shadow);
  padding: 8px;
  min-width: 240px;
}
.other-panel.on { display: block; }
.other-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
}
.other-item:hover { background: var(--accent-light); }
.other-item-icon {
  width: 28px; height: 28px;
  background: var(--accent-light);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.other-item-name { font-size: 13px; font-weight: 700; color: var(--text); }
.other-item-desc { font-size: 11px; color: var(--muted-s); margin-top: 1px; }

/* Inspector button in header */
.btn-inspect { gap: 5px; }
body[data-state="loaded"] .btn-inspect { display: inline-flex; }
body[data-state="empty"]  .btn-inspect { display: none !important; }

/* Hide selection hints in status bar for non-selection tools */
body[data-op="watermark"] .sb-hint,
body[data-op="grayscale"] .sb-hint,
body[data-op="pagenum"]   .sb-hint,
body[data-op="nup"]       .sb-hint,
body[data-op="booklet"]   .sb-hint,
body[data-op="version"]   .sb-hint,
body[data-op="sanitize"]  .sb-hint,
body[data-op="splitall"]  .sb-hint,
body[data-op="pdftext"]   .sb-hint,
body[data-op="pdfmd"]     .sb-hint,
body[data-op="merge"]     .sb-hint { display: none; }

/* Count is also irrelevant for these ops */
body[data-op="watermark"] .sb-count,
body[data-op="grayscale"] .sb-count,
body[data-op="pagenum"]   .sb-count,
body[data-op="nup"]       .sb-count,
body[data-op="booklet"]   .sb-count,
body[data-op="version"]   .sb-count,
body[data-op="sanitize"]  .sb-count,
body[data-op="splitall"]  .sb-count,
body[data-op="pdftext"]   .sb-count,
body[data-op="pdfmd"]     .sb-count,
body[data-op="merge"]     .sb-count { display: none; }



/* ── Home button in toolbar ──────────────────────────────────── */
.op-btn-home {
  color: var(--muted);
  width: 32px;
  padding: 0;
  justify-content: center;
  flex-shrink: 0;
}
.op-btn-home:hover { color: var(--accent); background: var(--accent-light); }

/* ── Confirmation dialog ─────────────────────────────────────── */
#confirm-overlay { display: none; }
#confirm-overlay.show { display: flex; }

/* ── Form card (Version / Sanitize / Split All) ──────────────── */
.form-card {
  max-width: 540px;
  margin: 60px auto;
  padding: 36px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--card-shadow);
  text-align: center;
}
.form-card-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  color: var(--accent);
  display: block;
}
.form-card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
  margin-bottom: 10px;
  color: var(--text);
}
.form-card-desc {
  font-size: 14px;
  color: var(--muted-s);
  line-height: 1.65;
  margin-bottom: 18px;
}
.form-card-note {
  font-size: 13px;
  color: var(--muted-s);
  padding: 10px 16px;
  background: var(--accent-light);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.form-card-note strong { color: var(--accent); }



/* ── Form tools: same flush-to-edge layout as preview tools ──── */


/* ── Grid visual effects (for Grayscale / Watermark / Page Numbers) ── */

/* Grayscale: one CSS line — no JS needed */
body[data-op="grayscale"] .pthumb { filter: grayscale(1); transition: filter .2s; }

/* Watermark overlay on each card */
.wm-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.wm-overlay span {
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: .05em;
  line-height: 1;
  user-select: none;
  /* Scale proportionally with card width — size slider changes card size, this keeps it proportional */
  font-size: clamp(8px, calc(var(--wm-scale, 7) * 1cqi), 120px);
}

/* Page number overlay badge on each card */
.pn-overlay {
  position: absolute;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
  background: rgba(255,255,255,.72);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  color: rgba(44,44,44,.85);
  line-height: 1.4;
  user-select: none;
}

/* ── Layout preview (N-up / Booklet) ──────────────────────────── */
.lp-header {
  font-size: 13px; font-weight: 700; color: var(--muted-s);
  padding: 14px 20px 8px; letter-spacing: .01em;
}
.lp-sheets {
  display: flex; flex-wrap: wrap; gap: 20px;
  padding: 8px 20px 28px;
}
.lp-sheet-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.lp-sheet-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.lp-sheet {
  background: #ffffff;
  border: 1px solid #d0c8bc;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
}
.lp-grid { display: grid; gap: 6px; }
.lp-grid-2 { grid-template-columns: 1fr 1fr; }
.lp-grid-4 { grid-template-columns: 1fr 1fr; }
.lp-cell { position: relative; }
.lp-cell-num {
  position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,.8);
  padding: 1px 4px; border-radius: 2px;
}
.lp-img {
  display: block; width: 130px; height: 184px;
  object-fit: contain; border-radius: 3px;
  border: 1px solid var(--border);
  background: white;
}
.lp-blank {
  width: 130px; height: 184px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); font-style: italic;
  background: var(--surface2); border: 1px dashed var(--border);
  border-radius: 3px;
}

/* ── Drop zone file type badges ──────────────────────────────── */
.dz-types {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.dz-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  letter-spacing: .02em;
}
.dz-type-sep {
  font-size: 11px;
  color: var(--border);
}


/* ══ HOME PICKER ══════════════════════════════════════════════════ */

/* Two sub-states inside .home */
.home-picker { display: none; flex-direction: column; }
.home-picker.on { display: flex; }
.home-drop { display: none; }
.home-drop.on {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--hdr));
  padding: 40px;
}

/* In drop-focused state the zone is a centered card, not full-bleed */
.home-drop .drop-zone {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: 520px;
  border: 2px dashed var(--border);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 4px 28px var(--shadow);
}
.home-drop .drop-zone:hover,
.home-drop .drop-zone.over {
  background: var(--accent-light);
  border-color: var(--accent);
  outline: none;
}

/* ── Picker hero ─────────────────────────────────────────── */
.picker-hero {
  padding: 40px 48px 24px;
  text-align: center;
}
.picker-hero-h {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
  margin-bottom: 8px;
}
.picker-hero-s {
  font-size: 14px;
  color: var(--muted-s);
  margin-bottom: 18px;
}
.picker-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

/* ── Category filter ─────────────────────────────────────── */
.picker-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 20px 48px 16px;
  flex-wrap: wrap;
}
.pcl-cat-btn {
  padding: 5px 15px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.pcl-cat-btn:hover { border-color: var(--text2); color: var(--text2); background: var(--surface2); }
.pcl-cat-btn.on    { background: var(--text); border-color: var(--text); color: var(--surface); }

/* ── Tool card grid ──────────────────────────────────────── */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding: 0 48px 16px;
}

/* ── Tool card ───────────────────────────────────────────── */
.pcl-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cat-c, var(--accent));
  border-radius: var(--r);
  padding: 15px 16px 12px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), box-shadow var(--t), transform .13s;
  user-select: none;
}
.pcl-card:hover {
  border-color: var(--cat-c, var(--accent));
  border-left-color: var(--cat-c, var(--accent));
  background: var(--cat-l, var(--accent-light));
  box-shadow: 0 4px 18px rgba(0,0,0,.09);
  transform: translateY(-2px);
}
.pcl-card.over {
  border-color: var(--cat-c, var(--accent));
  background: var(--cat-l, var(--accent-light));
  box-shadow: 0 0 0 2px var(--cat-c, var(--accent));
}
.pcl-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  letter-spacing: -.1px;
}
.pcl-desc {
  font-size: 11.5px;
  color: var(--muted-s);
  line-height: 1.5;
  margin-bottom: 10px;
}
.pcl-cat {
  font-size: 10px;
  font-weight: 700;
  color: var(--cat-c, var(--accent));
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ── Back button & tool badge ────────────────────────────── */
.back-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-s);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 20px;
  transition: color var(--t);
  align-self: flex-start;
}
.back-btn:hover { color: var(--accent); }
.dz-tool-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 14px;
}

/* Picker drag-over state */
.home-picker.over { background: var(--accent-light); }

/* .verify at bottom of picker */
.home-picker .verify { text-align: center; padding: 8px 0 32px; }


/* ── Home: dz-section + tool info cards ─────────────────────────── */

/* dz-section fills the first viewport; .drop-zone fills it absolutely */
.dz-section {
  min-height: calc(100vh - var(--hdr));
  position: relative;
}

/* Scroll hint at bottom of drop zone */
.dz-scroll-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
  animation: bounce-hint 2.4s ease-in-out infinite;
}
@keyframes bounce-hint {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(4px); }
}

/* ── Tool info section ───────────────────────────────────────────── */
/* ── Tool info cards (home scroll section) ────────────────────────── */
.home-tools {
  padding: 52px 44px 84px;
  background: var(--surface);
  border-top: 2px solid var(--border);
}
.home-tools-hdr {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 38px;
  text-align: center;
}
.tools-cat-section {
  margin-bottom: 34px;
}
.tools-cat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--cat-c, var(--muted));
  margin-bottom: 12px;
}
.tclbl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-c, var(--muted));
  flex-shrink: 0;
  opacity: .9;
}
.tools-cat-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.tools-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
/* Tool info card — icon + text, light hover */
.tic {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
  cursor: default;
  transition: box-shadow .18s, transform .15s;
}
.tic:hover {
  box-shadow: 0 6px 22px rgba(0,0,0,.09);
  transform: translateY(-2px);
}
.tic-ico {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 9px;
  background: var(--cat-l, #eef3ee);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cat-c, var(--accent));
  flex-shrink: 0;
}
.tic-body {
  flex: 1;
  min-width: 0;
}
.tic-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.1px;
  margin-bottom: 3px;
  line-height: 1.3;
}
.tic-desc {
  font-size: 11.5px;
  color: var(--muted-s);
  line-height: 1.42;
}
