/* ==========================================================================
   REPTARPDF - ESTILOS OFICIALES HOMOLOGADOS (TEMA ROJO #E5252A OFICIAL PDF)
   Suite Reptar: 100% Homologado con ReptarOCR, ReptarConvert, ReptarDocs y reptarQR
   ========================================================================== */

/* 1. VARIABLES DE COLOR Y SOMBRAS LIMPIAS */
:root,
[data-theme="light"] {
  --primary: #e5252a !important;
  --primary-dark: #b71c1c !important;
  --primary-hover: #cc1e23 !important;
  --primary-gradient: linear-gradient(135deg, #e5252a 0%, #b71c1c 100%) !important;
  --primary-glow: rgba(229, 37, 42, 0.12) !important;
  --primary-light: rgba(229, 37, 42, 0.08) !important;
  --border-highlight: rgba(229, 37, 42, 0.35) !important;
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.08);
}

/* 2. LOGO Y NAVBAR */
.brand-logo {
  display: flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  font-weight: 800 !important;
  font-size: 1.35rem !important;
  color: var(--text) !important;
  text-decoration: none !important;
}

.brand-logo .logo-img {
  width: 38px !important;
  height: 38px !important;
  object-fit: contain !important;
  image-rendering: -webkit-optimize-contrast !important;
}

.brand-logo .logo-text {
  font-weight: 800 !important;
  letter-spacing: -0.5px !important;
  font-size: 1.35rem !important;
  color: var(--text) !important;
}

.brand-logo .logo-accent {
  color: var(--primary) !important;
}

/* 3. HERO SECTION */
.hero-main-logo {
  width: 320px !important;
  height: 320px !important;
  max-width: 90vw !important;
  object-fit: contain !important;
  image-rendering: -webkit-optimize-contrast !important;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.hero-main-logo:hover {
  transform: scale(1.04) !important;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-highlight);
  margin-top: 1.25rem;
}

/* 4. PESTAÑAS (TABS) SUPERIORES DE REPTARPDF */
.pdf-nav-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
  row-gap: 12px;
  column-gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2.2rem;
  background: var(--bg-card, #ffffff);
  padding: 14px 20px;
  border-radius: 16px;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
  max-width: 1260px;
  margin-left: auto;
  margin-right: auto;
}

.pdf-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text-muted, #475569);
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdf-tab-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  opacity: 0.85;
  flex-shrink: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.pdf-tab-btn:hover {
  color: var(--text, #0f172a);
  background: var(--bg-card, #ffffff);
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.pdf-tab-btn:hover svg {
  opacity: 1;
}

.pdf-tab-btn.active {
  background: linear-gradient(135deg, #e5252a 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border-color: rgba(185, 28, 28, 0.9) !important;
  box-shadow: 0 3px 10px rgba(229, 37, 42, 0.32), 0 1px 2px rgba(0, 0, 0, 0.08) !important;
  font-weight: 700 !important;
  transform: translateY(0) !important;
}

.pdf-tab-btn.active svg {
  opacity: 1 !important;
  stroke: #ffffff !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) !important;
}

/* 5. WORKSPACE CONTAINER */
.pdf-workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04);
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  box-sizing: border-box;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeInPane 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 6. DROPZONE ESTANDARIZADA */
.pdf-dropzone {
  border: 2px dashed var(--border);
  border-radius: 18px;
  padding: 3.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pdf-dropzone:hover,
.pdf-dropzone.drag-active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.dropzone-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

/* 7. CUADRÍCULA VISUAL CON PREVISUALIZACIÓN DE MINIATURAS (UNIR PDF) */
.merge-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 16px;
  margin-top: 1.5rem;
}

.merge-card {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.merge-card:hover {
  transform: translateY(-2px);
  border-color: rgba(229, 37, 42, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.merge-card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.merge-card-preview {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1.35;
  margin-bottom: 8px;
  position: relative;
}

.merge-card-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.merge-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.merge-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merge-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.merge-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  gap: 4px;
}

.merge-add-card {
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: rgba(229, 37, 42, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}

.merge-add-card:hover {
  border-color: var(--primary);
  background: rgba(229, 37, 42, 0.05);
  color: var(--primary);
  transform: translateY(-2px);
}

.file-queue-list {
  margin-top: 1.5rem;
}

.file-queue-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.file-badge-idx {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-queue-info {
  min-width: 0;
}

.file-queue-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-queue-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.file-queue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-sm:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-icon-sm.btn-danger:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* 8. GRID DE PÁGINAS (ORGANIZAR Y DIVIDIR) */
.pages-organizer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 1.5rem;
  max-height: 520px;
  overflow-y: auto;
  padding: 8px;
}

.page-thumb-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
  cursor: grab;
}

.page-thumb-card:active {
  cursor: grabbing;
}

.page-thumb-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.page-thumb-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  border: 2px dashed var(--primary);
  box-shadow: 0 10px 24px var(--primary-glow);
  z-index: 10;
}

.page-thumb-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 37, 42, 0.35);
  transform: translateY(-3px);
}

.page-thumb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding: 0 2px;
}

.page-thumb-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: all 0.15s ease;
}

.page-thumb-card:hover .page-thumb-handle {
  opacity: 1;
  color: var(--primary);
  background: var(--primary-light);
}

.page-thumb-card.selected-for-cut {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.page-thumb-canvas-wrap {
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1.35;
  cursor: pointer;
  position: relative;
}

.page-thumb-canvas-wrap::after {
  content: '🔍 Ampliar';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  border-radius: 6px;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

html[lang="en"] .page-thumb-canvas-wrap::after {
  content: '🔍 View Larger';
}

.page-thumb-card:hover .page-thumb-canvas-wrap::after {
  opacity: 1;
}

.page-thumb-card.dragging .page-thumb-canvas-wrap::after {
  opacity: 0 !important;
}

.page-thumb-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.page-thumb-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.page-thumb-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.page-thumb-actions .btn-icon-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 0.72rem;
  border-radius: 6px;
}

.page-num-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* 8.1 MODAL DE PREVISUALIZACIÓN EN GRANDE DE PÁGINAS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.org-preview-card {
  width: 96%;
  max-width: 820px;
  max-height: 92vh;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  position: relative;
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.org-preview-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-secondary);
}

.org-preview-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.org-preview-badge {
  background: rgba(229, 37, 42, 0.12);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.org-preview-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.org-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-pdf:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: #ef4444;
}

.org-preview-body {
  position: relative;
  flex: 1;
  min-height: 300px;
  max-height: calc(92vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .org-preview-body {
  background: rgba(0, 0, 0, 0.25);
}

.org-preview-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
}

.org-preview-nav-prev {
  left: 16px;
}

.org-preview-nav-next {
  right: 16px;
}

.org-preview-nav-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: translateY(-50%) scale(1.08);
}

.org-preview-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.org-preview-canvas-container {
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.org-preview-canvas-container canvas {
  max-width: 100%;
  max-height: calc(92vh - 160px);
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
  border-radius: 8px;
  background: #ffffff;
  transition: transform 0.25s ease;
}

.org-preview-loading {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.org-preview-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  text-align: center;
}

.org-preview-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* 9. MESA DE TRABAJO Y WORKBENCH DE FIRMA DIGITAL (ESTILO ILOVEPDF - TEMA REPTAR) */
.sign-workspace-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

/* 9.1 Barra Superior de Control */
.sign-top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sign-toolbar-left,
.sign-toolbar-center,
.sign-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sign-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.84rem;
  color: var(--text);
  max-width: 280px;
}

.sign-file-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sign-file-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.sign-nav-group,
.sign-zoom-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 4px;
  gap: 4px;
}

.sign-tool-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sign-tool-btn:hover:not(:disabled) {
  background: rgba(229, 37, 42, 0.1);
  color: var(--primary);
}

.sign-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sign-page-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 4px;
}

.sign-page-indicator input {
  width: 44px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-weight: 700;
  color: var(--text);
  padding: 2px 4px;
  font-size: 0.82rem;
}

.sign-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.sign-zoom-display {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 42px;
  text-align: center;
}

.sign-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sign-action-btn.secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
}

.sign-action-btn.secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

.sign-action-btn.danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.sign-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.16);
}

/* 9.2 Cuadrícula Principal de 3 Columnas */
.sign-workbench-grid {
  display: grid;
  grid-template-columns: 120px minmax(280px, 1fr) minmax(310px, 360px);
  gap: 12px;
  min-height: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
}

/* Columna 1: Miniaturas de Páginas */
.sign-sidebar-thumbs {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 740px;
  overflow: hidden;
}

.sign-thumbs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.sign-thumbs-title {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.sign-badge-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
}

.sign-thumbs-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sign-thumb-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sign-thumb-card:hover {
  transform: translateY(-2px);
  border-color: rgba(229, 37, 42, 0.4);
  box-shadow: 0 4px 12px rgba(229, 37, 42, 0.12);
}

.sign-thumb-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 37, 42, 0.22);
}

.sign-thumb-canvas-box {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.sign-thumb-canvas-box canvas {
  width: 100%;
  height: auto;
  display: block;
}

.sign-thumb-footer {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

.sign-thumb-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sign-thumb-count-tag {
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
}

/* Columna 2: Visor Interactivo y Lienzo */
.sign-viewport-wrapper {
  background: #eceff1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 16px;
  overflow: auto;
  max-height: 740px;
  position: relative;
}

[data-theme="dark"] .sign-viewport-wrapper {
  background: #11141a;
}

.sign-doc-canvas-area {
  position: relative;
  display: inline-block;
  margin: auto;
}

.sign-page-paper {
  position: relative;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
}

#sign-pdf-canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Capa de Colocación Interactiva */
.sign-placement-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 10;
}

.sign-placement-overlay.drag-over-active {
  background: rgba(229, 37, 42, 0.05);
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
}

/* Elementos colocados en la página */
.sign-placed-item {
  position: absolute;
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
  border: 1.5px dashed rgba(229, 37, 42, 0.45);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.4);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  z-index: 20;
  transition: border-color 0.15s;
}

.sign-placed-item:active,
.sign-placed-item.dragging {
  cursor: grabbing;
}

.sign-placed-item.selected {
  border: 2px solid var(--primary);
  background: rgba(229, 37, 42, 0.03);
  box-shadow: 0 0 0 3px rgba(229, 37, 42, 0.2);
  z-index: 30;
}

.sign-placed-item-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

.sign-placed-item-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sign-placed-item-content .placed-text-span {
  font-size: 1rem;
  font-weight: 700;
  color: #000000;
  white-space: nowrap;
  display: inline-block;
}

/* Badge circular rojo estilo iLovePDF */
.sign-item-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  background: var(--primary);
  color: #ffffff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 25;
}

/* Barra de acciones flotante sobre elemento seleccionado */
.sign-item-actions-bar {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 6px;
  display: none;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 40;
}

.sign-placed-item.selected .sign-item-actions-bar {
  display: flex;
}

.sign-item-action-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sign-item-action-icon:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.sign-item-action-icon.delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Tiradores de Redimensionamiento (4 esquinas) */
.sign-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 35;
}

.sign-placed-item.selected .sign-resize-handle {
  display: block;
}

.sign-resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.sign-resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.sign-resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.sign-resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }

.sign-page-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  z-index: 50;
}

.sign-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(229, 37, 42, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Columna 3: Panel de Herramientas y Campos */
.sign-sidebar-tools {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 740px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.sign-tools-panel-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.sign-tools-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sign-tools-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 3px 0 0;
  line-height: 1.35;
}

.sign-fields-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.sign-section-title {
  font-size: 0.70rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Tarjetas de Campos (Diseño de 2 Niveles para evitar recortes) */
.sign-field-card {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.sign-field-card:hover {
  border-color: rgba(229, 37, 42, 0.4);
  background: rgba(229, 37, 42, 0.02);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.sign-field-card.required {
  border-color: rgba(229, 37, 42, 0.35);
  background: rgba(229, 37, 42, 0.03);
}

.sign-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  min-width: 0;
  box-sizing: border-box;
}

.sign-card-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.sign-card-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 1px;
  flex-shrink: 0;
}

.sign-card-drag-handle:active {
  cursor: grabbing;
}

.sign-card-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sign-card-icon.badge-ac {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-weight: 800;
  font-size: 0.72rem;
}

.sign-card-label {
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.sign-card-body {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.sign-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.sign-card-edit-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  height: 26px;
  box-sizing: border-box;
}

.sign-card-edit-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.sign-card-add-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.sign-card-add-btn:hover {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.sign-card-preview {
  min-height: 26px;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.sign-card-preview img {
  max-height: 30px;
  max-width: 100%;
  object-fit: contain;
}

.sign-preview-placeholder {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sign-preview-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.cursive-demo {
  font-family: 'Great Vibes', cursive;
  font-size: 1.3rem !important;
  color: #000000;
}

.sign-inline-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.80rem;
  color: var(--text);
  font-weight: 600;
  box-sizing: border-box;
  min-width: 0;
}

.sign-inline-input:focus {
  border-color: var(--primary);
  outline: none;
}

.sign-date-row {
  display: flex;
  gap: 5px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.sign-inline-date {
  flex: 1 1 54%;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.75rem;
  color: var(--text);
  box-sizing: border-box;
}

.sign-inline-select {
  flex: 1 1 46%;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 5px;
  font-size: 0.74rem;
  color: var(--text);
  box-sizing: border-box;
  cursor: pointer;
}

.sign-logo-upload-wrap {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.sign-logo-preview-box {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  min-width: 0;
  text-align: center;
  cursor: pointer;
}

/* Footer y Botón Final */
.sign-footer-summary {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sign-placed-counter-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sign-btn-finish {
  width: 100%;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  background: var(--primary-gradient);
  box-shadow: 0 4px 14px rgba(229, 37, 42, 0.35);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.sign-btn-finish:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 37, 42, 0.45);
}

/* 9.3 Modales de Configuración de Firma e Iniciales */
.sign-modal-card {
  width: 95%;
  max-width: 680px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sign-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.sign-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sign-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.sign-modal-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 6px 14px 0;
  gap: 6px;
}

.sign-modal-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.sign-modal-tab-btn:hover {
  color: var(--text);
}

.sign-modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.sign-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Panel Dibujar */
.sign-draw-canvas-wrap {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

#sign-draw-canvas {
  width: 100%;
  height: 220px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.sign-draw-baseline {
  position: absolute;
  bottom: 45px;
  left: 20px;
  right: 20px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.sign-draw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.sign-color-picker,
.sign-stroke-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sign-tool-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.color-dot,
.color-dot-type {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.color-dot.active,
.color-dot-type.active {
  transform: scale(1.18);
  border-color: var(--text);
}

.sign-stroke-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.sign-stroke-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.sign-btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Panel Escribir (Tipográfico) */
.sign-type-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sign-text-field {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.sign-text-field:focus {
  outline: none;
  border-color: var(--primary);
}

.sign-type-options-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sign-font-styles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.sign-font-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  transition: all 0.2s ease;
}

.sign-font-card:hover {
  border-color: rgba(229, 37, 42, 0.4);
  transform: translateY(-2px);
}

.sign-font-card.active {
  border-color: var(--primary);
  background: rgba(229, 37, 42, 0.04);
  box-shadow: 0 0 0 2px rgba(229, 37, 42, 0.2);
}

.sign-font-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.sign-font-render {
  font-size: 1.8rem;
  text-align: center;
  line-height: 1.2;
}

.font-great-vibes { font-family: 'Great Vibes', 'Brush Script MT', cursive; }
.font-caveat { font-family: 'Caveat', cursive; font-size: 2rem; }
.font-dancing { font-family: 'Dancing Script', cursive; }
.font-sacramento { font-family: 'Sacramento', cursive; font-size: 2.2rem; }

/* Panel Subir Imagen */
.sign-upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.sign-upload-dropzone:hover {
  border-color: var(--primary);
  background: rgba(229, 37, 42, 0.04);
}

.sign-upload-icon {
  color: var(--primary);
  margin-bottom: 8px;
}

.sign-upload-main-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.sign-upload-sub-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.sign-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-secondary);
}

/* 9.4 Responsividad en Pantallas Medianas y Móviles */
@media (max-width: 1080px) {
  .sign-workbench-grid {
    grid-template-columns: 110px minmax(240px, 1fr) 290px;
    gap: 10px;
  }
  .sign-sidebar-tools {
    padding: 10px 8px;
    gap: 10px;
  }
  .sign-field-card {
    padding: 7px 8px;
  }
}

@media (max-width: 860px) {
  .sign-workbench-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    min-height: auto;
  }

  .sign-sidebar-thumbs {
    max-height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sign-thumbs-scrollable {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sign-thumb-card {
    min-width: 100px;
  }

  .sign-sidebar-tools {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: none;
  }

  .sign-font-styles-grid {
    grid-template-columns: 1fr;
  }
}

/* 10. SUB-TABS CONVERTIDOR */
.convert-subnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.subnav-pill {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.subnav-pill.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* 11. ACCIONES Y BOTONES PRINCIPALES */
.workspace-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn-primary-pdf {
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px rgba(229, 37, 42, 0.28);
}

.btn-primary-pdf:hover {
  background: var(--primary-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(229, 37, 42, 0.36);
}

.btn-secondary-pdf {
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary-pdf:hover {
  background: var(--bg-card);
  border-color: var(--border-highlight);
}

/* 12. RESPONSIVE */
/* 12. RESPONSIVE OPTIMIZADO PARA DISPOSITIVOS MÓVILES */
@media (max-width: 768px) {
  .pdf-workspace-card {
    padding: 1.5rem 1rem;
  }
  .pdf-tab-btn {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
  .hero-main-logo {
    width: 200px !important;
    height: 200px !important;
  }
  .queue-table {
    min-width: 520px;
  }
}

@media (max-width: 640px) {
  /* Pestañas superiores con deslizamiento horizontal táctil nativo */
  .pdf-nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 5px 6px;
    gap: 5px;
    border-radius: 12px;
    margin-bottom: 1.25rem;
  }
  .pdf-nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .pdf-tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 0.78rem;
    border-radius: 8px;
  }
  .pdf-tab-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Espacio de trabajo en teléfonos */
  .pdf-workspace-card {
    padding: 1.25rem 0.75rem;
    border-radius: 18px;
  }

  /* Dropzones táctiles */
  .pdf-dropzone {
    padding: 2rem 1rem;
    border-radius: 16px;
  }
  .dropzone-title {
    font-size: 1.15rem;
  }
  .dropzone-subtitle {
    font-size: 0.82rem;
  }

  /* Reorganizador de páginas en móvil */
  .pages-organizer-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    padding: 4px;
    max-height: 440px;
  }
  .page-thumb-card {
    padding: 6px;
  }
  .page-thumb-preview {
    height: 120px;
  }
  .page-controls-bar {
    gap: 3px;
  }
  .btn-page-ctrl {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  /* Modal de previsualización en móvil */
  .org-preview-card {
    width: 98%;
    max-height: 95vh;
    border-radius: 16px;
  }
  .org-preview-header {
    padding: 10px 14px;
  }
  .org-preview-title {
    font-size: 0.95rem;
  }
  .org-preview-body {
    padding: 10px;
    min-height: 240px;
  }
  .org-preview-nav-btn {
    width: 38px;
    height: 38px;
  }
  .org-preview-nav-prev {
    left: 8px;
  }
  .org-preview-nav-next {
    right: 8px;
  }

  /* Cola de conversión en móvil */
  .queue-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .queue-top-left {
    display: flex;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .global-convert-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .global-select {
    flex: 1;
    max-width: none;
  }
  #btn-conv-all-top,
  #btn-conv-download-all-top {
    width: 100%;
    justify-content: center;
  }
  .queue-footer-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .queue-footer-bar .btn-primary-action,
  .queue-footer-bar .btn-success-action {
    width: 100%;
    justify-content: center;
  }
  .queue-drop-overlay-content {
    padding: 1.5rem 1.2rem;
    max-width: 92%;
  }
  .queue-drop-overlay-icon {
    width: 54px;
    height: 54px;
  }
  .queue-drop-overlay-title {
    font-size: 1.1rem;
  }

  /* División de PDF en móvil */
  .split-mode-selector {
    grid-template-columns: 1fr;
  }
  .split-mode-card {
    padding: 10px 14px;
  }

  /* Lienzo de firma en móvil */
  .sign-tools-bar {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
  }

  /* Botón flotante en móvil */

}


/* ==========================================================================
   VENTAJAS & FAQ HOMOLOGADAS (IDÉNTICO A REPTARCONVERT)
   ========================================================================== */
.features-section {
  margin: 3.5rem 0;
}

.features-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1.5rem !important;
  margin-top: 2rem !important;
}

.feature-box {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 2.2rem 1.6rem !important;
  text-align: center !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease !important;
  position: relative !important;
}

.feature-box:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 14px 30px rgba(229, 37, 42, 0.08) !important;
  border-color: rgba(229, 37, 42, 0.4) !important;
}

.feature-box-icon {
  width: 62px !important;
  height: 62px !important;
  border-radius: 18px !important;
  background: rgba(229, 37, 42, 0.08) !important;
  color: var(--primary) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-bottom: 1.1rem !important;
  border: 1px solid rgba(229, 37, 42, 0.2) !important;
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease !important;
}

.feature-box:hover .feature-box-icon {
  transform: scale(1.1) !important;
  background: var(--primary-gradient) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(229, 37, 42, 0.25) !important;
  border-color: transparent !important;
}

.feature-tag {
  display: inline-block !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
  padding: 3px 10px !important;
  border-radius: 20px !important;
  background: rgba(229, 37, 42, 0.06) !important;
  color: var(--primary) !important;
  border: 1px solid rgba(229, 37, 42, 0.2) !important;
  margin-bottom: 0.75rem !important;
}

.feature-box h3 {
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  margin-bottom: 0.65rem !important;
  color: var(--text) !important;
  line-height: 1.3 !important;
}

.feature-box p {
  font-size: 0.88rem !important;
  color: var(--text-muted) !important;
  line-height: 1.55 !important;
  margin: 0 !important;
}

/* FAQ ACCORDIONS (COMPACTO Y ELEGANTE) */
.faq-container {
  max-width: 960px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1.1rem !important;
}

.faq-item {
  padding: 1.35rem 1.6rem !important;
  cursor: pointer !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  border-radius: var(--radius) !important;
  transition: all 0.25s ease !important;
}

.faq-item:hover {
  border-color: var(--primary) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

.faq-item.open {
  border-color: rgba(229, 37, 42, 0.35) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.faq-question {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-weight: 700 !important;
  font-size: 1.02rem !important;
  color: var(--text) !important;
  gap: 12px !important;
  user-select: none !important;
}

.faq-question:hover {
  color: var(--primary) !important;
}

.faq-arrow {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease !important;
  flex-shrink: 0 !important;
}

.faq-item.open .faq-arrow {
  transform: rotate(180deg) !important;
  color: var(--primary) !important;
}

.faq-answer {
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-top 0.25s ease !important;
  color: var(--text-muted) !important;
  font-size: 0.92rem !important;
  line-height: 1.65 !important;
  margin-top: 0 !important;
}

.faq-item.open .faq-answer {
  max-height: 800px !important;
  opacity: 1 !important;
  margin-top: 0.85rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px dashed var(--border) !important;
}

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: 1fr !important;
  }
}


/* ==========================================================================
   BOTÓN FLOTANTE DE CONTACTO Y SOPORTE PREMIUM (A LA DERECHA)
   ========================================================================== */
.floating-contact {
  position: fixed !important;
  bottom: 26px !important;
  right: 26px !important;
  left: auto !important;
  z-index: 10000 !important;
}

.floating-contact-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 22px !important;
  background: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 0.92rem !important;
  border-radius: 50px !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 6px 22px rgba(229, 37, 42, 0.4) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.floating-contact-btn:hover {
  transform: translateY(-3px) scale(1.02) !important;
  background: var(--primary-dark) !important;
  box-shadow: 0 10px 28px rgba(229, 37, 42, 0.5) !important;
}

.floating-contact-card {
  width: 330px !important;
  max-width: calc(100vw - 32px) !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 20px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16) !important;
  padding: 1.5rem !important;
  position: absolute !important;
  bottom: calc(100% + 14px) !important;
  right: 0 !important;
  left: auto !important;
  animation: cardFadeUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes cardFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   NUEVA EXPERIENCIA VISUAL PARA DIVIDIR PDF
   ========================================================================== */
.split-file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.split-file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.split-file-badge {
  background: rgba(229, 37, 42, 0.12);
  color: var(--primary);
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 800;
}

.split-btn-change {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.split-btn-change:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--text-muted);
}

.split-mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.split-mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.split-mode-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.split-mode-card.active {
  border-color: var(--primary);
  background: rgba(229, 37, 42, 0.04);
  box-shadow: 0 4px 14px rgba(229, 37, 42, 0.12);
}

.split-mode-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(229, 37, 42, 0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.split-mode-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
}

.split-mode-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.split-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.split-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pill-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-pill-sm:hover {
  background: var(--border);
}

.split-selected-counter {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.split-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  max-height: 480px;
  overflow-y: auto;
  padding: 10px 4px;
}

.split-thumb-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.split-thumb-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  border-color: rgba(229, 37, 42, 0.5);
}

.split-thumb-card.selected {
  border-color: var(--primary);
  background: rgba(229, 37, 42, 0.05);
  box-shadow: 0 4px 16px rgba(229, 37, 42, 0.2);
}

.split-check-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.2s;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.split-thumb-card.selected .split-check-badge {
  background: var(--primary);
  color: #ffffff;
}

.split-thumb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.btn-single-download {
  background: rgba(229, 37, 42, 0.1);
  color: var(--primary);
  border: none;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-single-download:hover {
  background: var(--primary);
  color: #ffffff;
  transform: scale(1.1);
}

.split-all-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.split-option-box {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.split-option-box h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.split-option-box p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.spin-icon {
  animation: spinAnim 0.9s linear infinite;
}

@keyframes spinAnim {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   10. SECCIÓN DE COLA DE CONVERSIÓN ESTILO REPTARCONVERT
   ========================================================================== */
.security-banner-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 16px);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.security-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.security-icon-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(229, 37, 42, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(229, 37, 42, 0.2);
}

.security-banner-title {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 2px;
}

.security-banner-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.security-banner-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.security-badge-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 9999px;
}

.queue-section {
  padding: 1.25rem 0;
}

.queue-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.queue-top-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-add-more {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  cursor: pointer;
}

.btn-add-more:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.global-convert-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.global-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.86rem;
  outline: none;
}

.global-select:focus {
  border-color: var(--primary);
}

.btn-primary-action {
  background: var(--primary-gradient, var(--primary));
  color: #ffffff !important;
  font-size: 0.96rem;
  font-weight: 800;
  padding: 0.7rem 1.7rem;
  border-radius: 10px;
  box-shadow: 0 4px 14px var(--primary-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--primary-glow);
  opacity: 0.95;
}

.btn-primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-success-action {
  background: #10b981 !important;
  color: #ffffff !important;
  font-size: 0.96rem;
  font-weight: 800;
  padding: 0.7rem 1.7rem;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-success-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
  opacity: 0.95;
}

.btn-sm-action {
  padding: 6px 14px !important;
  font-size: 0.82rem !important;
  border-radius: 8px !important;
}

.queue-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
}

.queue-table tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.queue-table tr:hover {
  background-color: var(--bg-secondary);
}

.queue-table td {
  padding: 0.85rem 0.6rem;
  vertical-align: middle;
}

.col-file-info {
  width: 42%;
}

.file-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reorder-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 4px;
  flex-shrink: 0;
}

.btn-reorder {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 22px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 0.65rem;
  transition: all 0.15s ease;
}

.btn-reorder:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-reorder:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.file-thumbnail-wrap {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-cat-badge {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 8px;
}

.file-cat-badge.cat-pdf {
  background: rgba(229, 37, 42, 0.1);
  color: var(--primary);
}

.file-cat-badge.cat-image {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.file-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.file-size {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.col-arrow {
  width: 6%;
  text-align: center;
  white-space: nowrap;
}

.convert-arrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.col-target-select {
  width: 24%;
}

.form-select {
  width: 100%;
  max-width: 190px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.form-select:focus {
  border-color: var(--primary);
}

.btn-item-settings {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 6px;
}

.btn-item-settings:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.col-status {
  width: 24%;
}

.pending-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-convert-row {
  background: var(--primary-gradient, var(--primary));
  color: #ffffff !important;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 2px 6px var(--primary-glow);
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
}

.btn-convert-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px var(--primary-glow);
  opacity: 0.95;
}

.done-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-download-row {
  background: #10b981 !important;
  color: #ffffff !important;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
  cursor: pointer;
  border: none;
}

.btn-download-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45) !important;
  opacity: 0.95;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-pending {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.converting-state-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 120px;
}

.converting-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
}

.converting-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
}

.converting-pct {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient, var(--primary));
  border-radius: 9999px;
  transition: width 0.25s ease;
}

.col-delete {
  width: 4%;
  text-align: right;
}

.btn-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-remove:hover {
  color: #ef4444;
}

.queue-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}



/* DROP OVERLAY EN COLA ACTIVA (ARRASTRAR Y SOLTAR ARCHIVOS) */
.queue-section {
  position: relative;
}

.queue-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(229, 37, 42, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 3px dashed var(--primary);
  border-radius: var(--radius, 14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  animation: overlayFadeIn 0.2s ease forwards;
}

.queue-drop-overlay-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 3rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: 440px;
}

.queue-drop-overlay-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(229, 37, 42, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounceMini 1s infinite alternate ease-in-out;
}

.queue-drop-overlay-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.queue-drop-overlay-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}


/* SECCIÓN DE CAMBIO RÁPIDO DE HERRAMIENTAS EN MENÚ MÓVIL */
.mobile-tools-section {
  display: none;
}

@media (max-width: 768px) {
  /* Mostrar botón hamburguesa en móviles */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-card) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 10px !important;
    width: 44px !important;
    height: 44px !important;
    cursor: pointer !important;
    color: var(--text) !important;
    transition: all 0.2s ease !important;
  }
  .mobile-menu-btn:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
  }

  /* Menú desplegable móvil */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1.5px solid var(--border);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.2);
    flex-direction: column;
    padding: 1.25rem 1.25rem 1.75rem;
    gap: 0.85rem;
    z-index: 2000;
  }
  .nav-links.active {
    display: flex !important;
    animation: menuSlideDown 0.2s ease forwards;
  }

  @keyframes menuSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Selector de herramientas en el menú móvil */
  .mobile-tools-section {
    display: block !important;
    width: 100%;
    padding: 12px 0 6px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
  }
  .mobile-tools-header {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
  }
  .mobile-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .mobile-tool-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 6px;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .mobile-tool-btn:hover,
  .mobile-tool-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(229, 37, 42, 0.3);
  }

  /* Dropdown de la suite dentro del menú móvil */
  .nav-dropdown {
    width: 100%;
  }
  .nav-dropdown-btn {
    width: 100%;
    justify-content: space-between;
  }
  .nav-dropdown-menu {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: 1px solid var(--border) !important;
    margin-top: 6px !important;
    background: var(--bg-secondary) !important;
  }

  /* CORRECCIÓN BOTÓN FLOTANTE DE CONTACTO EN MÓVIL */
  .contact-btn-text {
    display: none !important;
  }
  .floating-contact {
    bottom: 22px !important;
    right: 18px !important;
    z-index: 9999 !important;
  }
  .floating-contact-btn {
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 6px 22px rgba(229, 37, 42, 0.5) !important;
    border: none !important;
  }
  .floating-contact-btn svg {
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
  }
  .floating-contact-card {
    right: 0 !important;
    left: auto !important;
    bottom: calc(100% + 14px) !important;
    width: calc(100vw - 36px) !important;
    max-width: 320px !important;
  }
}

/* ==========================================================================
   HERRAMIENTAS INTEGRADAS: COMPRIMIR & OCR (NATIVAS REPTARPDF)
   ========================================================================== */
.compress-level-card {
  cursor: pointer;
  padding: 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.compress-level-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.compress-level-card.active {
  border-color: var(--primary) !important;
  background: rgba(229, 37, 42, 0.06) !important;
  box-shadow: 0 6px 18px rgba(229, 37, 42, 0.15) !important;
}

[data-theme="dark"] .compress-level-card.active {
  background: rgba(229, 37, 42, 0.12) !important;
}

/* ==========================================================================
   VIEWER RESPONSIVO & ZOOM (CENSURAR / EDITAR PDF)
   ========================================================================== */
#redact-canvas-wrapper,
#edit-canvas-wrapper {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  position: relative;
  scrollbar-width: thin;
}

[data-theme="dark"] #redact-canvas-wrapper,
[data-theme="dark"] #edit-canvas-wrapper {
  background: #020617;
  border-color: rgba(255, 255, 255, 0.1);
}

#redact-canvas,
#edit-canvas {
  border-radius: 4px;
}

/* ==========================================================================
   10. HERRAMIENTA: NUMERAR PÁGINAS (WORKBENCH INTERACTIVO CON PREVIEW EN VIVO)
   ========================================================================== */
.num-workspace-container {
  padding: 10px 0 24px;
}

.num-workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 390px);
  gap: 20px;
  align-items: start;
}

.num-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.num-preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.num-nav-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.num-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.num-nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.num-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.num-page-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  padding: 0 6px;
  min-width: 90px;
  text-align: center;
}

.num-cover-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(229, 37, 42, 0.12);
  color: var(--primary);
  border: 1px solid rgba(229, 37, 42, 0.25);
  margin-left: 4px;
}

.num-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 6px;
}

.num-zoom-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  border-radius: 4px;
  transition: background 0.15s;
}

.num-zoom-btn:hover {
  background: var(--bg-secondary);
}

.num-zoom-val {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
  color: var(--text-muted);
}

.num-zoom-btn-fit {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
  transition: all 0.15s;
}

.num-zoom-btn-fit:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.num-viewport-wrapper {
  background: #0f172a;
  min-height: 520px;
  max-height: 72vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  position: relative;
  scrollbar-width: thin;
}

[data-theme="dark"] .num-viewport-wrapper {
  background: #020617;
}

.num-page-paper {
  position: relative;
  display: inline-block;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  line-height: 0;
  transition: transform 0.2s ease;
  user-select: none;
}

#num-preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.num-live-badge {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1.5px dashed var(--primary);
  box-shadow: 0 4px 12px rgba(229, 37, 42, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  line-height: 1.2;
  transition: top 0.22s cubic-bezier(0.2, 0, 0, 1),
              bottom 0.22s cubic-bezier(0.2, 0, 0, 1),
              left 0.22s cubic-bezier(0.2, 0, 0, 1),
              right 0.22s cubic-bezier(0.2, 0, 0, 1),
              transform 0.22s cubic-bezier(0.2, 0, 0, 1);
}

.num-live-badge.dimmed {
  opacity: 0.35;
  border-color: #94a3b8;
  border-style: dotted;
  text-decoration: line-through;
  box-shadow: none;
}

.num-excluded-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 12;
}

.num-excluded-notice svg {
  flex-shrink: 0;
}

.num-preview-footer {
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.num-preview-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Sidebar Controles */
.num-sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.num-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.num-card-title {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.num-card-title svg {
  color: var(--primary);
}

.num-card-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.num-control-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.num-select,
.num-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.num-select:focus,
.num-input:focus {
  border-color: var(--primary);
}

/* Grid de Posición 3x2 */
.num-pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.num-pos-btn {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text);
}

.num-pos-btn span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.1;
}

.num-pos-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.num-pos-btn.active {
  border-color: var(--primary) !important;
  background: rgba(229, 37, 42, 0.08) !important;
  box-shadow: 0 3px 12px rgba(229, 37, 42, 0.18);
}

.num-pos-btn.active span {
  color: var(--primary);
  font-weight: 800;
}

.pos-dot {
  width: 24px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-card);
  position: relative;
}

.pos-dot::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.num-pos-btn.active .pos-dot::after {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

.pos-dot.top-left::after { top: 2px; left: 2px; }
.pos-dot.top-center::after { top: 2px; left: 50%; transform: translateX(-50%); }
.pos-dot.top-right::after { top: 2px; right: 2px; }
.pos-dot.bottom-left::after { bottom: 2px; left: 2px; }
.pos-dot.bottom-center::after { bottom: 2px; left: 50%; transform: translateX(-50%); }
.pos-dot.bottom-right::after { bottom: 2px; right: 2px; }

.num-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.num-checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.num-color-picker {
  position: static !important;
  top: auto !important;
  left: auto !important;
  width: 38px !important;
  height: 32px !important;
  padding: 2px !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  background: var(--bg-card) !important;
  box-sizing: border-box !important;
  display: inline-block !important;
  vertical-align: middle !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.num-color-picker:hover {
  border-color: var(--primary) !important;
}

.num-color-picker::-webkit-color-swatch-wrapper {
  padding: 1px !important;
  border-radius: 5px !important;
}

.num-color-picker::-webkit-color-swatch {
  border-radius: 5px !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
}

.num-color-picker::-moz-color-swatch {
  border-radius: 5px !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
}

.num-style-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 32px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.num-style-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.num-style-btn.active {
  background: rgba(229, 37, 42, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.num-custom-format-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
}

.num-action-box {
  margin-top: 4px;
}

.num-finish-btn {
  width: 100%;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(229, 37, 42, 0.35);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.num-finish-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 37, 42, 0.45);
}

.num-status-msg {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  min-height: 18px;
}

@media (max-width: 960px) {
  .num-workbench-grid {
    grid-template-columns: 1fr;
  }
  .num-viewport-wrapper {
    min-height: 400px;
    padding: 16px;
  }
}

/* ==========================================================================
   11. HERRAMIENTA: RECORTAR PDF (WORKBENCH VISUAL INTERACTIVO CON MARQUEE)
   ========================================================================== */
.crop-workspace-container {
  padding: 10px 0 24px;
}

.crop-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 18px;
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.crop-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.crop-file-badge {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crop-pill-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.crop-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.crop-workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 390px);
  gap: 20px;
  align-items: start;
}

.crop-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.crop-preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.crop-nav-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crop-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.crop-nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.crop-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.crop-page-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  padding: 0 6px;
  min-width: 90px;
  text-align: center;
}

.crop-dims-badge {
  font-size: 0.74rem;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(229, 37, 42, 0.1);
  color: var(--primary);
  border: 1px solid rgba(229, 37, 42, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.crop-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 6px;
}

.crop-zoom-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  border-radius: 4px;
  transition: background 0.15s;
}

.crop-zoom-btn:hover {
  background: var(--bg-secondary);
}

.crop-zoom-val {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 55px;
  text-align: center;
  color: var(--text-muted);
}

.crop-zoom-btn-action {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 3px;
  transition: all 0.15s;
}

.crop-zoom-btn-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.crop-viewport-wrapper {
  background: #0f172a;
  min-height: 530px;
  max-height: 74vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  position: relative;
  scrollbar-width: thin;
}

[data-theme="dark"] .crop-viewport-wrapper {
  background: #020617;
}

.crop-page-paper {
  position: relative;
  display: inline-block;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  line-height: 0;
  transition: transform 0.2s ease;
  user-select: none;
  overflow: hidden;
}

#crop-preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  pointer-events: none;
}

/* Marco de Recorte con máscara box-shadow continua */
.crop-marquee-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed #ffffff;
  outline: 2px solid var(--primary);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.65);
  cursor: move;
  touch-action: none;
  user-select: none;
  z-index: 25;
}

.crop-marquee-box.is-dragging {
  cursor: grabbing;
  outline-color: #f59e0b;
}

/* Líneas de composición (Regla de los Tercios) */
.crop-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.crop-grid-line.h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.crop-grid-line.h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.crop-grid-line.v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.crop-grid-line.v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

/* Tag flotante de dimensiones */
.crop-marquee-floating-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  line-height: 1.2;
}

/* Tiradores de Redimensionamiento (8 tiradores) */
.crop-handle {
  position: absolute;
  box-sizing: border-box;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 30;
  transition: transform 0.1s ease;
}

.crop-handle:hover {
  transform: scale(1.2);
  background: var(--primary);
  border-color: #ffffff;
}

/* Esquinas (12x12 px) */
.crop-handle.corner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.crop-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }

/* Bordes (Barras) */
.crop-handle.edge-h {
  width: 26px;
  height: 7px;
  border-radius: 4px;
}

.crop-handle.edge-v {
  width: 7px;
  height: 26px;
  border-radius: 4px;
}

.crop-handle.n { top: -4px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.crop-handle.s { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.crop-handle.w { left: -4px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.crop-handle.e { right: -4px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.crop-preview-footer {
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.crop-preview-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Sidebar Controles de Recorte */
.crop-sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.crop-card-title {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crop-card-title svg {
  color: var(--primary);
}

.crop-card-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.crop-control-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.crop-select,
.crop-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.crop-select:focus,
.crop-input:focus {
  border-color: var(--primary);
}

/* Grid de Márgenes 4 Direcciones */
.crop-margins-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.crop-margin-item {
  display: flex;
  flex-direction: column;
}

.crop-margin-item label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.crop-margin-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.crop-margin-input-wrap input {
  padding-right: 32px;
}

.crop-margin-unit {
  position: absolute;
  right: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

/* Chips de Preajustes */
.crop-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.crop-preset-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s ease;
}

.crop-preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.crop-preset-btn.active {
  background: rgba(229, 37, 42, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* Radio Group Alcance */
.crop-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crop-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.crop-radio-label input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Resumen Comparativo de Dimensiones */
.crop-summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.crop-stat-box {
  display: flex;
  flex-direction: column;
}

.crop-stat-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.crop-stat-val {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}

.crop-area-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #10b981;
  margin-top: 2px;
}

/* Botón Final de Recorte */
.crop-finish-btn {
  width: 100%;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(229, 37, 42, 0.35);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.crop-finish-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 37, 42, 0.45);
}

.crop-status-msg {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  min-height: 18px;
}

@media (max-width: 960px) {
  .crop-workbench-grid {
    grid-template-columns: 1fr;
  }
  .crop-viewport-wrapper {
    min-height: 400px;
    padding: 16px;
  }
}

/* ==========================================================================
   11. HERRAMIENTA: EDITAR PDF (EDITOR VISUAL, SELLOS, ANOTACIONES Y PAPEL)
   ========================================================================== */
.edit-workspace-container {
  padding: 16px 0;
  width: 100%;
}

.edit-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.edit-top-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.edit-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 6px;
}

.edit-page-counter {
  font-weight: 800;
  font-size: 0.84rem;
  min-width: 58px;
  text-align: center;
  color: var(--text);
}

.edit-icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 800;
  border-radius: 6px;
  color: var(--text);
  transition: background 0.15s ease;
}

.edit-icon-btn:hover {
  background: var(--bg-card);
}

.edit-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 6px;
}

.edit-zoom-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
}

.edit-zoom-val {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 58px;
  text-align: center;
  color: var(--text);
}

.edit-fit-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
  transition: all 0.15s ease;
}

.edit-fit-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.edit-tools-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.edit-tool-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.edit-tool-action-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.edit-tool-action-btn:active {
  transform: translateY(0);
}

.edit-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.edit-btn-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 800;
}

.btn-remove-action {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #ef4444;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-remove-action:hover {
  background: rgba(239, 68, 68, 0.16);
  transform: translateY(-1px);
}

/* Barra de Formato Contextual */
.edit-format-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  animation: editSlideDown 0.2s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes editSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.format-toolbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.format-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.format-options-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.format-select {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.82rem;
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.format-select:focus {
  border-color: var(--primary);
}

.format-toggle-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.format-toggle-btn:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

.format-toggle-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.format-color-wrap {
  display: inline-flex;
  align-items: center;
}

.edit-native-color-picker {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 34px;
  height: 32px;
  padding: 2px;
  background: var(--bg-card);
  cursor: pointer;
}

.edit-native-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.edit-native-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

.format-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.format-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s ease;
}

.format-icon-btn:hover {
  background: var(--bg-card);
}

.format-icon-btn.danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
}

.format-icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Viewport y Papel PDF Interactivo */
.edit-viewport-wrapper {
  background: #1e293b;
  border-radius: 14px;
  padding: 24px;
  min-height: 520px;
  max-height: 75vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
}

.edit-page-paper {
  position: relative;
  margin: auto;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: visible;
}

.edit-pdf-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.edit-placement-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 10;
}

/* Elementos Colocados en la Página */
.edit-placed-item {
  position: absolute;
  box-sizing: border-box;
  touch-action: none;
  cursor: grab;
  pointer-events: auto;
  z-index: 20;
  border: 1.5px dashed transparent;
  border-radius: 4px;
  transition: border-color 0.15s ease;
}

.edit-placed-item:hover {
  border-color: rgba(220, 38, 38, 0.5);
}

.edit-placed-item.dragging {
  cursor: grabbing;
  z-index: 50;
}

.edit-placed-item.selected {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
  z-index: 40;
}

/* Tiradores de Redimensionamiento */
.edit-placed-item .edit-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 45;
}

.edit-placed-item.selected .edit-handle {
  display: block;
}

.edit-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.edit-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.edit-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.edit-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }

/* Botón Rápido de Eliminar */
.edit-item-quick-del {
  position: absolute;
  top: -11px;
  right: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: 2px solid #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 46;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.edit-placed-item.selected .edit-item-quick-del,
.edit-placed-item:hover .edit-item-quick-del {
  display: flex;
}

.edit-item-quick-del:hover {
  transform: scale(1.15);
  background: #dc2626;
}

/* Contenido de Texto Editable */
.edit-text-box {
  width: 100%;
  height: 100%;
  outline: none;
  padding: 4px;
  box-sizing: border-box;
  line-height: 1.25;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: text;
  cursor: text;
}

.edit-text-box:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

/* Sello de Goma Interactivo */
.edit-stamp-inner {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2.5px solid;
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  user-select: none;
}

.stamp-main-text {
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.1;
}

.stamp-date-text {
  font-size: 0.68rem;
  font-weight: 700;
  margin-top: 3px;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

/* Resaltador y Borrador */
.edit-highlight-box {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  border: 1px dashed rgba(234, 179, 8, 0.5);
}

.edit-whiteout-box {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 3px;
  border: 1px dashed #cbd5e1;
}

/* Modal de Sellos */
.edit-stamp-modal-card {
  width: 95%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.edit-stamp-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 70vh;
}

.edit-stamp-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.edit-stamp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.edit-stamp-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.edit-stamp-preset-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stamp-preview-box {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 2px solid;
}

.stamp-green { border-color: #10b981; color: #10b981; background: rgba(16, 185, 129, 0.1); }
.stamp-red { border-color: #dc2626; color: #dc2626; background: rgba(220, 38, 38, 0.1); }
.stamp-blue { border-color: #2563eb; color: #2563eb; background: rgba(37, 99, 235, 0.1); }
.stamp-emerald { border-color: #059669; color: #059669; background: rgba(5, 150, 105, 0.1); }
.stamp-crimson { border-color: #e11d48; color: #e11d48; background: rgba(225, 29, 72, 0.1); }
.stamp-orange { border-color: #ea580c; color: #ea580c; background: rgba(234, 88, 12, 0.1); }
.stamp-purple { border-color: #7c3aed; color: #7c3aed; background: rgba(124, 58, 237, 0.1); }
.stamp-slate { border-color: #475569; color: #475569; background: rgba(71, 85, 105, 0.1); }

.stamp-preset-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

.edit-stamp-section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.edit-stamp-section-divider::before,
.edit-stamp-section-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.edit-stamp-section-divider span {
  padding: 0 10px;
}

.edit-custom-stamp-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.edit-custom-stamp-inputs {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.edit-stamp-color-picker {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.edit-help-hint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 768px) {
  .edit-stamp-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .edit-top-bar {
    padding: 8px 10px;
  }
  .edit-viewport-wrapper {
    padding: 12px;
    min-height: 380px;
  }
}

/* ==========================================================================
   FASE 5: WORKBENCH SPLIT-SCREEN OCR (VISOR PDF + PANEL DE TRANSCRIPCIÓN)
   ========================================================================== */
.ocr-workspace-container {
  display: block;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
}

.ocr-top-file-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ocr-split-grid {
  display: grid;
  grid-template-columns: minmax(400px, 1.15fr) minmax(360px, 1fr);
  gap: 20px;
  align-items: stretch;
}

/* Columna Izquierda: Visor del PDF / Imagen */
.ocr-left-col {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.ocr-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.ocr-nav-group,
.ocr-zoom-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ocr-btn-tool {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.ocr-btn-tool:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-secondary);
}

.ocr-btn-tool:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ocr-counter-badge {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 70px;
  text-align: center;
}

.ocr-viewport-wrapper {
  flex: 1;
  min-height: 520px;
  max-height: 720px;
  overflow: auto;
  background: #232733;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}

.ocr-page-paper {
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: inline-block;
  position: relative;
  transition: transform 0.15s ease-out;
  transform-origin: top center;
  line-height: 0;
}

#ocr-pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

#ocr-image-preview {
  display: none;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.ocr-viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Columna Derecha: Controles, Progreso y Transcripción */
.ocr-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ocr-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.ocr-options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.ocr-transcription-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.ocr-transcription-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.ocr-view-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.ocr-toggle-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ocr-toggle-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ocr-stats-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

.ocr-confidence-pill {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ocr-confidence-pill.medium {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.25);
}

.ocr-confidence-pill.low {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
}

.ocr-textarea-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

#ocr-result-text {
  flex: 1;
  width: 100%;
  min-height: 280px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#ocr-result-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 37, 42, 0.12);
}

.ocr-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .ocr-split-grid {
    grid-template-columns: 1fr;
  }
  .ocr-viewport-wrapper {
    min-height: 380px;
    max-height: 500px;
  }
}

@media (max-width: 640px) {
  .ocr-options-row {
    grid-template-columns: 1fr;
  }
  .ocr-actions-row {
    flex-direction: column;
  }
  .ocr-top-file-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}





