/* Organize Pages — Insert (compact add) + Done. View / sensitivity live on
   the detector banner. */

.organize-toolbar-meta { flex-wrap: wrap; }
.organize-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.organize-chrome { position: relative; display: inline-flex; }

.organize-chrome-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.organize-chrome-btn-ico,
.organize-chrome-caret {
  display: inline-flex;
}
.organize-chrome-caret { opacity: 0.8; }

.organize-chrome-menu {
  min-width: 248px;
  max-width: 320px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  transform-origin: top right;
  animation: menuIn 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.organize-chrome-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.organize-chrome-item:hover {
  background: var(--bg-soft);
}
.organize-chrome-item:active { transform: translateY(1px); }
.organize-chrome-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.organize-chrome-item.is-on { color: var(--text); }
.organize-chrome-item:disabled {
  opacity: 0.42;
  color: var(--text-mute);
  cursor: default;
  transform: none;
}

.organize-chrome-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: none;
  color: var(--text-soft);
}
.organize-chrome-item.is-on .organize-chrome-mark { color: var(--primary); }
.organize-chrome-gap { display: block; width: 14px; height: 14px; }

.organize-chrome-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.organize-chrome-copy strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.organize-chrome-copy em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.3;
}

.organize-chrome-count {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
  padding-top: 1px;
}

.organize-chrome-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 8px;
}

.organize-chrome-kicker {
  margin: 4px 10px 2px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* One shared card menu, portaled to body. position:fixed is load-bearing:
   placeMenu measures offsetWidth while the node is a body child, and a static
   panel would report the full body width and pin to the wrong corner. */
.organize-card-menu {
  position: fixed;
  min-width: 220px;
  max-width: 280px;
  z-index: 1200;
}
.organize-card-menu.closing {
  animation: kpFadeDown 0.15s ease-in forwards;
}
.organize-card-menu-pin {
  position: fixed;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.organize-card-menu .organize-chrome-item.is-danger {
  color: var(--danger);
}
.organize-card-menu .organize-chrome-item.is-danger:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.organize-card-menu .organize-chrome-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.organize-chrome-note {
  margin: 6px 10px 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-mute);
}

/* Selection cluster: rotate / move / delete in a pill floating bottom-center
   over the grid when pages are picked, out of the toolbar so appearing never
   changes the header. Centered with auto margins, not a transform - kpRise
   animates transform and would fight it. Exits through is-leaving (see
   organize-editor.js), never a snap-hide. */
.organize-sel-cluster {
  position: fixed;
  bottom: 46px;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: fit-content;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  animation: kpRise 0.3s cubic-bezier(.2, .7, .3, 1) both;
}
.organize-sel-cluster.is-leaving {
  animation: kpFadeDown 0.18s ease-in both;
}
.organize-sel-cluster .organize-selcount {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  margin-right: 6px;
}
.organize-sel-act {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, color 0.15s;
}
.organize-sel-act:hover { transform: translateY(-2px); }
.organize-sel-act:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.organize-sel-act[data-act="del"] { color: var(--danger); }

/* "Review 3 pages with the same text" rides the selection cluster rather than a
   pill pinned to the top of the scroller: the offer belongs beside the cards it
   is about, in the strip the user is already looking at while pages are picked.
   [hidden] needs the explicit rule - .btn sets display, which outranks it. */
.organize-sel-review {
  height: 32px;
  padding: 0 12px;
  margin-right: 4px;
  border-radius: 999px;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  animation: kpRise 0.26s cubic-bezier(.2, .7, .3, 1) both;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, color 0.15s;
}
.organize-sel-review[hidden] { display: none; }
.organize-sel-review:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.organize-sel-review:active { transform: scale(0.97); }
.organize-sel-review:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* The count, on its own. The OCR chip follows it as a sibling of the banner so
   that showing the chip cannot squeeze the heading. */
.organize-split-head {
  display: flex;
  align-items: center;
  min-width: 0;
}
.organize-read-chip { flex: none; }

/* Save / remove sit flush-right, after the band's line; the pencil rides with
   the name itself. */
.organize-doc-band-acts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

@media (max-width: 720px) {
  .organize-chrome-btn-lbl { display: none; }
  .organize-chrome-btn { min-height: 44px; min-width: 44px; }
  .organize-chrome[data-chrome="done"] .organize-chrome-btn-lbl { display: inline; }
  .organize-chrome-menu { min-width: min(280px, 92vw); }
  .organize-sel-cluster { bottom: 16px; }
  .organize-sel-act { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }
  .organize-sel-review { height: 44px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .organize-chrome-menu { animation: none; }
  .organize-chrome-item:active { transform: none; }
  .organize-sel-cluster { animation: none; }
  .organize-sel-act:hover { transform: none; }
  .organize-sel-review { animation: none; }
  .organize-sel-review:hover { transform: none; }
}
