/* ===== editor.css — PDFiable Editor Full Styles ===== */
:root {
  --bg: #0d0d14;
  --surface: #12121c;
  --surface2: #1a1a28;
  --surface3: #22223a;
  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(108,99,255,0.35);
  --accent: #6C63FF;
  --accent-dim: rgba(108,99,255,0.18);
  --text: #f0f0f8;
  --text-muted: #888;
  --topbar-h: 56px;
  --hintbar-h: 34px;
  --statusbar-h: 28px;
  --sidebar-w: 76px;
  --thumb-w: 220px;
  --props-w: 360px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.editor-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
}

/* ===================== TOP BAR ===================== */
.editor-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 100;
}
.topbar-logo {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 1rem; color: var(--text);
  text-decoration: none; flex-shrink: 0;
}
.topbar-logo .logo-icon { font-size: 1.2rem; }
.gradient-text { background: linear-gradient(135deg,#6C63FF,#a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.topbar-filename {
  flex: 1; font-size: 0.82rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 8px;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tb-btn {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 0.78rem;
  cursor: pointer; font-family: inherit; transition: all 0.15s; white-space: nowrap;
}
.tb-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border-accent); }
.tb-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.tb-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.tb-btn.primary:hover { filter: brightness(1.1); }
.tb-btn.accent { border-color: var(--border-accent); color: #a78bfa; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ===================== HINT BAR ===================== */
.hint-bar {
  height: var(--hintbar-h);
  background: var(--accent-dim);
  border-bottom: 1px solid var(--border-accent);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; font-size: 0.78rem; color: #a78bfa;
  flex-shrink: 0;
}
.hint-bar #hint-icon { font-size: 1rem; }
.hint-bar strong { color: var(--text); }
.hint-bar em { color: #a78bfa; font-style: normal; }

/* ===================== EDITOR SHELL ===================== */
.editor-shell {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ===================== THUMB PANEL ===================== */
.thumb-panel {
  width: var(--thumb-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
}
.thumb-header {
  padding: 8px 12px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between;
}
.thumb-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.thumb-item {
  position: relative; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; transition: border-color 0.15s;
}
.thumb-item:hover { border-color: var(--accent); }
.thumb-item.active { border-color: var(--accent); }
.thumb-item canvas { width: 100%; display: block; }
.thumb-num {
  position: absolute; bottom: 4px; right: 6px; font-size: 0.65rem;
  background: rgba(0,0,0,0.6); color: #fff; padding: 1px 5px; border-radius: 4px;
}

/* ===================== EDITOR CENTER ===================== */
.editor-center { flex: 1; display: flex; overflow: hidden; }

/* ===================== TOOL SIDEBAR ===================== */
.tool-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; gap: 2px; overflow-y: auto; flex-shrink: 0;
}
.tool-label {
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em;
  color: #7878a0; padding: 8px 4px 2px; align-self: center;
}
.tool-group { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.tool-btn {
  width: 64px; height: 56px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  color: #c8c8dc; font-size: 1.5rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: all 0.12s; font-family: inherit;
}
.tool-btn span { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; color: #b0b0cc; }
.tool-btn:hover { background: var(--surface3); color: #fff; border-color: var(--border-accent); }
.tool-btn:hover span { color: #fff; }
.tool-btn.active {
  background: var(--accent-dim); color: var(--accent);
  border-color: var(--border-accent);
}
.color-swatches { display: flex; flex-direction: column; gap: 5px; align-items: center; padding: 4px 0; }
.cswatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15); transition: transform 0.12s;
}
.cswatch:hover { transform: scale(1.2); }
.cswatch.selected { border-color: #fff; transform: scale(1.15); }

/* ---- Props panel color rows ---- */
.prop-color-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 8px 0;
}
.prop-swatch {
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.12); transition: transform 0.12s, border-color 0.12s;
}
.prop-swatch:hover { transform: scale(1.18); border-color: rgba(255,255,255,0.4); }
.prop-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); transform: scale(1.1); }
.prop-color-custom {
  width: 32px; height: 32px; border-radius: 6px; border: 2px solid rgba(255,255,255,0.15);
  padding: 0; cursor: pointer; background: none; flex-shrink: 0;
  -webkit-appearance: none; overflow: hidden;
}
.prop-color-custom::-webkit-color-swatch-wrapper { padding: 0; }
.prop-color-custom::-webkit-color-swatch { border: none; border-radius: 3px; }

/* ===================== PDF VIEWPORT ===================== */
.pdf-viewport {
  flex: 1; overflow: auto; background: #222232;
  position: relative; cursor: grab;
}
.pdf-viewport.drag-over { background: rgba(108,99,255,0.08); }

/* Placeholder */
.viewport-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.vp-box {
  text-align: center; padding: 48px 40px;
  background: var(--surface); border: 2px dashed var(--border-accent);
  border-radius: 16px; max-width: 400px;
}
.vp-box h3 { font-size: 1.1rem; margin: 12px 0 8px; }
.vp-box p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px; border-radius: 8px; font-weight: 600; font-size: 0.85rem; cursor: pointer; border: none; font-family: inherit; transition: all 0.15s; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--surface3); color: var(--text); border: 1px solid var(--border); }

/* PDF Pages */
.pdf-pages-area {
  display: flex; flex-direction: column;
  align-items: center; gap: 24px; padding: 24px;
  min-height: 100%;
}
.page-container {
  position: relative; flex-shrink: 0;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5);
  transform-origin: top center;
}
.pdf-canvas { display: block; }
.annot-canvas {
  position: absolute; inset: 0;
  pointer-events: none; /* draw tool sets pointer-events via JS */
}
.page-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}
.page-overlay.active-tool { pointer-events: all; }
.page-label {
  position: absolute; bottom: -22px; left: 50%;
  transform: translateX(-50%); font-size: 0.7rem; color: #666;
  white-space: nowrap;
}

/* ===================== TEXT BOX ===================== */
.text-box {
  position: absolute; min-width: 80px; min-height: 32px;
  box-sizing: border-box; z-index: 20; pointer-events: all;
}
.text-box.idle {
  border: 2px dashed rgba(108,99,255,0.6);
  border-radius: 4px; cursor: move; background: transparent;
}
.text-box.idle:hover { border-color: rgba(108,99,255,1); }
.text-box.editing {
  border: 2px solid var(--accent);
  border-radius: 4px; background: transparent;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
.tb-content {
  display: block; width: 100%; min-height: 28px;
  padding: 5px 8px; outline: none; background: transparent;
  border: none; word-break: break-word; white-space: pre-wrap;
  pointer-events: none; cursor: move; line-height: 1.5;
}
.text-box.editing .tb-content { pointer-events: all; cursor: text; }
.tb-resize {
  position: absolute; bottom: -1px; right: -1px;
  width: 12px; height: 12px; cursor: nwse-resize;
  background: var(--accent); border-radius: 2px 0 3px 0;
  display: none;
}
.text-box.editing .tb-resize { display: block; }
.tb-delete {
  position: absolute; top: -10px; right: -10px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; color: #fff; border: none;
  font-size: 0.75rem; cursor: pointer; display: none;
  align-items: center; justify-content: center; line-height: 1;
  z-index: 30;
}
.text-box:hover .tb-delete, .text-box.editing .tb-delete { display: flex; }

/* ===================== ANNOTATIONS ===================== */
.annot-band {
  position: absolute; pointer-events: all; z-index: 15;
  border-radius: 2px; cursor: default;
}
.annot-highlight { height: 20px; }
.annot-underline, .annot-strikethrough { height: 2px; }
.annot-shape {
  position: absolute; border: 2px solid; z-index: 15;
  pointer-events: all; background: transparent; cursor: default;
  box-sizing: border-box;
}
.annot-shape.annot-circle { border-radius: 50%; }
.annot-shape.annot-arrow::after {
  content: ''; position: absolute; right: -6px; top: 50%;
  transform: translateY(-50%) rotate(0deg);
  border: 6px solid transparent;
}
.annot-del {
  position: absolute; top: -10px; right: -10px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; color: #fff; border: none;
  font-size: 0.75rem; cursor: pointer; display: none;
  align-items: center; justify-content: center;
  z-index: 30; line-height: 1;
}
.annot-band:hover .annot-del,
.annot-shape:hover .annot-del { display: flex; }

/* ===================== SIGNATURE ===================== */

/* Ghost cursor that follows mouse during placement mode */
#sig-ghost-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -90%);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
  animation: sigPulse 1.2s ease-in-out infinite;
}
.sig-ghost-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.sig-ghost-label {
  background: rgba(108,99,255,0.9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
@keyframes sigPulse {
  0%, 100% { transform: translate(-50%, -90%) scale(1); }
  50%       { transform: translate(-50%, -90%) scale(1.08); }
}

/* Placed signature wrapper */
.sig-wrap {
  position: absolute;
  cursor: move;
  z-index: 25;
  pointer-events: all;
}
.sig-wrap img {
  display: block;
  width: 100%;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}
.sig-resize-handle {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 3px 0 4px 0;
  cursor: nwse-resize;
  z-index: 26;
}
.sig-resize-handle:hover { background: #a78bfa; }
.sig-del-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 27;
}
.sig-wrap:hover .sig-del-btn { display: flex; }


/* ===================== PROPS PANEL ===================== */
.props-panel {
  width: var(--props-w); background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  overflow-y: auto; transition: width 0.2s;
}
.props-panel.collapsed { width: 32px; }
.props-panel.collapsed .props-section,
.props-panel.collapsed .props-header span { display: none; }
.props-header {
  padding: 16px 20px; font-size: 1.1rem; font-weight: 700;
  letter-spacing: 0.08em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.props-toggle {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.1rem; padding: 2px 4px;
}
.props-toggle:hover { color: var(--text); }
.props-section {
  padding: 20px; border-bottom: 1px solid var(--border);
}
.props-label {
  font-size: 1.05rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 14px;
}
.props-row {
  display: flex; align-items: center; gap: 12px;
}
.ps-btn {
  width: 44px; height: 44px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface3);
  color: var(--text); font-size: 1.5rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.ps-btn:hover { border-color: var(--border-accent); background: var(--accent-dim); }
.ps-val {
  font-size: 1.25rem; color: var(--text); min-width: 60px; text-align: center;
}
.ps-hint { font-size: 1rem; color: var(--text-muted); white-space: nowrap; }
.ps-slider {
  -webkit-appearance: none; height: 8px; border-radius: 4px;
  background: var(--surface3); outline: none; width: 100%;
}
.ps-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}
.ps-select {
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 1.15rem;
  padding: 8px 14px; width: 100%; font-family: inherit; outline: none;
}
.ps-select:focus { border-color: var(--border-accent); }
.fmt-btn {
  min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface3); color: var(--text-muted);
  font-size: 0.82rem; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
}
.fmt-btn:hover { border-color: var(--border-accent); color: var(--text); }
.fmt-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); }

/* ===================== STATUS BAR ===================== */
.status-bar {
  height: var(--statusbar-h); background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px;
  gap: 6px; font-size: 0.72rem; color: var(--text-muted);
  flex-shrink: 0; z-index: 50;
}
.status-sep { color: var(--border); }

/* ===================== FREE BANNER ===================== */
.free-banner {
  position: fixed; bottom: var(--statusbar-h); left: 50%;
  transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border-accent);
  border-radius: 12px; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 0.82rem; white-space: nowrap;
}
.free-banner strong { color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; border-radius: 6px; }
.banner-x { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; }

/* ===================== SEARCH OVERLAY ===================== */
.search-overlay {
  position: fixed; top: calc(var(--topbar-h) + var(--hintbar-h) + 8px); right: 16px;
  z-index: 300;
}
.search-box {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border-accent);
  border-radius: 10px; padding: 8px 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.search-input {
  background: transparent; border: none; color: var(--text);
  font-size: 0.85rem; outline: none; font-family: inherit; width: 200px;
}
.search-count { font-size: 0.72rem; color: var(--text-muted); min-width: 60px; text-align: center; }
.search-nav, .search-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.8rem; padding: 2px 6px; border-radius: 4px;
}
.search-nav:hover, .search-close:hover { background: var(--surface3); color: var(--text); }

/* ===================== MODALS ===================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.6); display: flex;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--surface2); border: 1px solid var(--border-accent);
  border-radius: 16px; padding: 24px; max-width: 520px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-sm { max-width: 360px; }
.modal-hdr {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-hdr h3 { font-size: 1rem; }
.modal-x { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; }
.modal-ftr { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Signature modal */
.sig-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.sig-tab {
  padding: 6px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 0.82rem; transition: all 0.12s;
}
.sig-tab.active { background: var(--accent-dim); border-color: var(--border-accent); color: var(--accent); }

/* OCR */
.ocr-prog { height: 4px; background: var(--surface3); border-radius: 2px; margin-bottom: 12px; overflow: hidden; }
.ocr-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; width: 0; }
.ocr-area {
  width: 100%; height: 200px; background: var(--surface3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.82rem; padding: 10px;
  font-family: monospace; resize: vertical; outline: none;
}

/* ===================== SYMBOL GRID ===================== */
.symbol-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
  padding: 6px;
  background: var(--surface3);
  border-radius: 8px;
  border: 1px solid var(--border);
  min-height: 36px;
}
.sym-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  border: 1px solid transparent;
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  position: relative;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif;
}
.sym-btn:hover {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  transform: scale(1.15);
  z-index: 5;
}
.sym-btn:active { transform: scale(0.95); }
.sym-btn-flash {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

/* ===================== EYEDROPPER BUTTON ===================== */
.eyedrop-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--surface3);
  color: #a0a0c0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s;
}
.eyedrop-btn:hover {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: #fff;
  transform: scale(1.12);
}
.eyedrop-btn.eyedrop-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(0.95);
}

/* ===================== SCREENSHOT TOOL ===================== */
#ss-overlay {
  position: fixed; inset: 0; z-index: 99998; cursor: crosshair;
}
#ss-dim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.08);
}
#ss-sel {
  position: absolute; display: none;
  border: 2px solid #6C63FF;
  background: rgba(108,99,255,0.12);
  box-shadow: 0 0 0 1px rgba(108,99,255,0.6), inset 0 0 0 1px rgba(255,255,255,0.05);
}
#ss-hint {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(20,16,40,0.95);
  color: #d0cff8; font-size: 0.82rem; font-weight: 600;
  padding: 8px 22px; border-radius: 20px; pointer-events: none;
  white-space: nowrap; border: 1px solid rgba(108,99,255,0.5);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
/* Placed screenshot image wrapper */
.ss-wrap {
  position: absolute;
  z-index: 30;
  overflow: visible;
  cursor: move;
  pointer-events: all;
  /* NO border or border-radius — they shift the box model and bleed into PDF export */
}
.ss-wrap:hover {
  /* outline doesn't affect box model so export coords stay accurate */
  outline: 1.5px solid rgba(108,99,255,0.55);
  outline-offset: 1px;
}
.ss-wrap img {
  display: block;
  width: 100%;
  border-radius: 0;
  pointer-events: none;
  user-select: none;
}
.ss-wrap:hover .sig-del-btn { display: flex; }
/* ===================== PAGES TOOLS (MERGE + SPLIT) ===================== */
/* Drop zone */
.pg-drop-zone {
  border: 2px dashed var(--border-accent); border-radius: 10px;
  padding: 18px 14px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-muted); transition: all 0.15s; margin-bottom: 10px;
}
.pg-drop-zone:hover, .pg-drop-zone.dz-over {
  background: var(--accent-dim); border-color: var(--accent); color: var(--text);
}
/* Merge file list */
.merge-list {
  list-style: none; display: flex; flex-direction: column; gap: 5px;
  max-height: 190px; overflow-y: auto; margin-bottom: 6px;
}
.merge-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface3); border-radius: 7px; padding: 7px 10px;
  font-size: 0.82rem;
}
.merge-row-icon { flex-shrink: 0; }
.merge-row-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
}
.merge-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
/* Icon button (↑ ↓ ×) */
.pg-icon-btn {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted);
  font-size: 0.78rem; cursor: pointer; display: flex; align-items: center;
  justify-content: center; padding: 0; transition: all 0.12s;
}
.pg-icon-btn:hover { background: var(--accent-dim); border-color: var(--border-accent); color: var(--text); }

/* ── Split grid ─────────────────────────────────── */
.split-bar {
  display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
}
.split-hint {
  margin-left: auto; font-size: 0.75rem; color: var(--text-muted);
}
.split-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 220px; overflow-y: auto;
  padding: 8px; background: var(--surface3);
  border-radius: 8px; border: 1px solid var(--border);
  margin-bottom: 12px;
}
.split-cell {
  width: 40px; height: 40px; border-radius: 7px;
  border: 2px solid var(--border);
  background: var(--surface2); color: var(--text);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all 0.12s; font-family: inherit;
}
.split-cell:hover { border-color: var(--accent); background: var(--accent-dim); }
.split-cell.sel {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
/* Mode row */
.split-mode-row {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px;
}
.split-radio {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  transition: all 0.12s;
}
.split-radio:hover { border-color: var(--border-accent); background: var(--accent-dim); }
.split-radio input { accent-color: var(--accent); flex-shrink: 0; }
.split-radio span { flex: 1; }

/* ===================== COMPRESS TOOL ===================== */
.compress-levels {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px;
}
.compress-level-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface3); cursor: pointer;
  transition: all 0.15s; width: 100%; text-align: left;
  font-family: inherit;
}
.compress-level-btn:hover {
  border-color: var(--border-accent); background: var(--accent-dim);
}
.compress-level-btn.active {
  border-color: var(--accent); background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent);
}
.cl-icon { font-size: 0.9rem; flex-shrink: 0; }
.cl-name { font-size: 0.82rem; font-weight: 600; color: var(--text); flex: 1; }
.cl-info { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }
.compress-desc {
  font-size: 0.73rem; color: var(--text-muted);
  background: var(--surface3); border-radius: 6px;
  padding: 6px 8px; margin-bottom: 6px; line-height: 1.4;
}

/* ===================== CLIPBOARD — COPY / PASTE ===================== */

/* Blue selection ring on the currently selected annotation */
.annot-selected {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(108,99,255,0.18) !important;
  z-index: 50 !important;
}

/* Ghost element that follows the cursor during paste mode */
#paste-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.55;
  border: 2px dashed var(--accent);
  border-radius: 4px;
  background: rgba(108,99,255,0.1);
  min-width: 40px;
  min-height: 16px;
  padding: 4px 8px;
  font-size: 0.85rem;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: none;
}

/* Toast notification for clipboard actions */
#clipboard-toast {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20, 16, 40, 0.96);
  color: #d0cff8;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 22px;
  border-radius: 20px;
  border: 1px solid rgba(108,99,255,0.5);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  pointer-events: none;
  white-space: nowrap;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#clipboard-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================== USER ACCOUNT MENU ===================== */

.user-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.user-avatar-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(108,99,255,0.5);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.user-avatar-ring.lg {
  width: 40px;
  height: 40px;
  font-size: 0.95rem;
}
.user-avatar-ring img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-avatar-btn:hover .user-avatar-ring {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.25);
}

/* Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: var(--surface2);
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  padding: 8px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.user-dropdown.open { display: flex; }

.user-dropdown-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
}
.user-dropdown-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.user-dropdown-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  margin-top: 2px;
}
.user-dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 2px 4px 6px;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary, #ccc);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.user-dropdown-item:hover {
  background: var(--surface3);
  color: var(--text);
}
.user-dropdown-item.danger {
  color: #fca5a5;
}
.user-dropdown-item.danger:hover {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}

