@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-400.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-500.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700.woff2") format("woff2");
}

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --primary: #20798b;
  --primary-dark: #175d6b;
  --primary-tint: #e6f2f3;
  --primary-disabled: #9dc4ca;
  --border: #e5e7eb;
  --success: #16a34a;
  --success-tint: #ecfdf3;
  --success-text: #14532d;
  --info-tint: #eef2ff;
  --info-text: #3730a3;
  --danger: #dc2626;
  --danger-tint: #fef2f2;
  --danger-text: #7f1d1d;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}

header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header.topbar a.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 20px;
}

.lang-switcher {
  margin-left: auto;
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 999px;
  padding: 3px;
}

.lang-switcher button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-switcher button:hover {
  color: var(--text);
}

.lang-switcher button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.admin-link {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.admin-link:hover { color: var(--primary); }

.tool-card[hidden] { display: none; }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.admin-summary {
  color: var(--text-muted);
  font-size: 14px;
  margin: -18px 0 24px;
}

.service-list { display: grid; gap: 10px; }

.service-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.service-row .tool-icon { flex: 0 0 auto; }
.service-info { flex: 1; min-width: 0; }
.service-info strong { display: block; font-size: 14px; }
.service-info small { color: var(--text-muted); }

.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: #cbd5e1;
  transition: .15s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow);
  transition: .15s;
}
.switch input:checked + .switch-slider { background: var(--success); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.admin-note { margin-top: 22px; padding: 14px 16px; border-radius: var(--radius); background: var(--info-tint); color: var(--info-text); font-size: 13px; }

@media (max-width: 520px) {
  .admin-link { font-size: 0; }
  .admin-link::before { content: "⚙️"; font-size: 19px; }
}

header.topbar .brand-logo {
  height: 50px;
  width: auto;
  display: block;
}

header.topbar .brand-divider {
  width: 1px;
  height: 30px;
  background: var(--border);
}

header.topbar .brand-tagline {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 600;
}

@media (max-width: 520px) {
  header.topbar {
    padding: 12px 16px;
    gap: 8px;
  }

  header.topbar .brand-logo {
    height: 36px;
  }

  header.topbar .brand-divider,
  header.topbar .brand-tagline {
    display: none;
  }

  .lang-switcher button {
    padding: 6px 9px;
  }
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
}

.page-subtitle {
  color: var(--text-muted);
  margin: 0 0 32px;
  font-size: 15px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card:not(.disabled):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.tool-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-tint);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.tool-name {
  font-weight: 600;
  font-size: 16px;
}

.tool-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.tool-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 10px;
  width: fit-content;
}

.tool-badge.featured {
  color: var(--primary);
  background: var(--primary-tint);
}

.tool-card.featured {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-tint) 0%, var(--surface) 60%);
}

/* Herramienta: Unir PDF */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 20px;
}

.back-link:hover {
  color: var(--text);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.dropzone .icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.dropzone .title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.dropzone .hint {
  color: var(--text-muted);
  font-size: 13px;
}

#file-input {
  display: none;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-item.dragging {
  opacity: 0.4;
}

.file-item .drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  user-select: none;
}

.file-item .order-badge {
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item .file-icon {
  color: var(--primary);
  font-size: 20px;
}

.file-item .file-thumb,
.file-item .file-thumb-placeholder {
  width: 34px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 4px;
}

.file-item .file-thumb {
  object-fit: cover;
  box-shadow: var(--shadow);
  background: #fff;
}

.file-item .file-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 15px;
}

.file-item .file-info {
  flex: 1;
  min-width: 0;
}

.file-item .file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item .file-size {
  font-size: 12px;
  color: var(--text-muted);
}

.file-item .move-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.icon-btn.remove:hover {
  color: var(--danger);
  background: var(--primary-tint);
}

.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-count {
  font-size: 13px;
  color: var(--text-muted);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: var(--primary-disabled);
  cursor: not-allowed;
}

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

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

.status-box {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}

.status-box.show {
  display: block;
}

.status-box.info {
  background: var(--info-tint);
  color: var(--info-text);
}

.status-box.success {
  background: var(--success-tint);
  color: var(--success-text);
}

.status-box.error {
  background: var(--danger-tint);
  color: var(--danger-text);
}

.result-box {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.result-box.show {
  display: flex;
}

.result-box .result-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 220px;
}

.result-box .result-info > div {
  min-width: 0;
}

.result-box .result-info > div > div:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-box .file-icon {
  font-size: 28px;
  color: var(--success);
}

.crop-preview-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.crop-preview-wrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #fff;
}

.crop-mask {
  position: absolute;
  background: rgba(20, 20, 20, 0.55);
  pointer-events: none;
}

.step-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 24px 0 10px;
}

.step-label:first-of-type {
  margin-top: 0;
}

.table-preview-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0 20px;
}

.table-preview {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  white-space: nowrap;
}

.table-preview th,
.table-preview td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}

.table-preview th {
  background: var(--bg);
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.word-freq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.word-freq-row {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.word-freq-term {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-freq-bar-wrap {
  background: var(--bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.word-freq-bar {
  background: var(--primary);
  height: 100%;
  border-radius: 999px;
}

.word-freq-count {
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.citations-heading {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 10px;
}

.citations-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.citations-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.chapter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: inherit;
}

.chapter-row input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.chapter-title {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-pages {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.citations-list a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.citations-list a:hover {
  text-decoration: underline;
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 20px 0;
}

.form-field-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}

.form-field-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-field-row input[type="text"],
.form-field-row select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.form-field-row input[type="text"]:focus,
.form-field-row select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-field-row input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--primary);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 400;
}

.radio-option input {
  accent-color: var(--primary);
}

.flatten-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.flatten-label input {
  accent-color: var(--primary);
}

.compare-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.compare-page-body {
  font-size: 13.5px;
  line-height: 1.7;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.compare-page-body del {
  background: var(--danger-tint);
  color: var(--danger-text);
  text-decoration: line-through;
  border-radius: 3px;
}

.compare-page-body ins {
  background: var(--success-tint);
  color: var(--success-text);
  text-decoration: none;
  border-radius: 3px;
}

.diff-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.diff-del-sample,
.diff-ins-sample {
  border-radius: 3px;
  padding: 0 4px;
  font-size: 12px;
}

.diff-del-sample {
  background: var(--danger-tint);
  color: var(--danger-text);
  text-decoration: line-through;
}

.diff-ins-sample {
  background: var(--success-tint);
  color: var(--success-text);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.search-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.search-page {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.search-snippet {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 6px;
}

.search-snippet:last-of-type {
  margin-bottom: 0;
}

.search-snippet mark {
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}

.search-more {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.text-preview {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

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

#reset-row {
  margin-top: 20px;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success-text);
  background: var(--success-tint);
  padding: 2px 9px;
  border-radius: 999px;
  margin-top: 6px;
}

.privacy-note {
  margin-top: 32px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* Herramientas: Dividir PDF / Comprimir PDF */

.file-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.file-summary .file-icon {
  color: var(--primary);
  font-size: 24px;
}

.file-summary .file-info {
  flex: 1;
  min-width: 0;
}

.file-summary .file-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-summary .file-meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.option-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-card .option-title {
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-card .option-title::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.option-card .option-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.option-card:hover {
  border-color: var(--primary);
}

.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.option-card.selected .option-title::before {
  border-color: var(--primary);
  border-width: 5px;
}

.field {
  margin: 20px 0;
}

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.field .field-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.field .field-error {
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 6px;
  display: none;
}

.field .field-error.show {
  display: block;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 20px 0;
}

.option-row .field {
  margin: 0;
  flex: 1 1 140px;
  min-width: 140px;
}

.option-row input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.option-row input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
}

.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 420px;
}

.position-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

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

.position-btn.selected {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary);
}

.range-row {
  display: flex;
  gap: 10px;
  margin: 4px 0 8px;
  flex-wrap: wrap;
}

.range-row input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.range-row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.watermark-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
  margin: 20px 0;
}

.watermark-controls .field {
  margin: 0 0 18px;
}

.watermark-controls input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.watermark-controls input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.watermark-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.watermark-preview-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.watermark-preview canvas {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #fff;
}

@media (max-width: 720px) {
  .watermark-layout {
    grid-template-columns: 1fr;
  }
}

.size-compare {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.size-compare .size-before {
  color: var(--text-muted);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.size-compare .size-arrow {
  color: var(--text-muted);
}

.size-compare .size-after {
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.size-compare .size-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--success-tint);
  color: var(--success-text);
}

.size-compare .size-badge.flat {
  background: var(--info-tint);
  color: var(--info-text);
}

.thumbnails-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 14px;
  flex-wrap: wrap;
}

.thumbnails-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.thumbnails-links {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.manual-toggle {
  display: block;
  margin: 4px 0 4px;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.thumbnail-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.thumbnail-card:not(.static):hover {
  border-color: var(--primary);
}

.thumbnail-card canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow);
  background: #fff;
}

.thumbnail-card .thumb-page-num {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.thumbnail-card.selected {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.thumbnail-card.selected .thumb-page-num {
  color: var(--primary);
}

.thumbnail-card .thumb-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
}

.thumbnail-card.selected .thumb-check {
  display: flex;
}

.thumbnail-card.static {
  cursor: default;
}

.thumbnail-card.static:hover {
  border-color: var(--border);
}

.info-note {
  background: var(--info-tint);
  color: var(--info-text);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 20px 0;
}

.password-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.password-field {
  position: relative;
  flex: 1;
}

.password-field input {
  width: 100%;
  padding: 11px 44px 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

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

.password-toggle-btn {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.password-toggle-btn:hover {
  opacity: 1;
}

.thumbnail-loading {
  font-size: 13px;
  color: var(--text-muted);
  padding: 24px 0;
  text-align: center;
}

/* Herramientas: Rotar PDF / Organizar PDF */

.thumb-canvas-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thumb-canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.2s ease;
}

.thumb-rotation-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.5;
}

.thumb-rotation-badge:empty {
  display: none;
}

.thumbnail-card.draggable {
  cursor: grab;
}

.thumbnail-card.rotate-card {
  cursor: pointer;
}

.thumbnail-card.rotate-card:hover {
  border-color: var(--primary);
}

.thumbnail-card.dragging {
  opacity: 0.4;
}

.thumb-controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}

.thumb-controls .icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 3px 5px;
  font-size: 12px;
}

.thumbnail-card.removed {
  opacity: 0.35;
}

.thumbnail-card .drag-handle-thumb {
  position: absolute;
  bottom: 4px;
  left: 4px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: grab;
  user-select: none;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.page-nav button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
}

.page-nav button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#page-indicator {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.page-preview-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  touch-action: none;
}

.page-preview-wrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #fff;
}

.sig-overlay {
  position: absolute;
  border: 1.5px dashed var(--primary);
  cursor: move;
  touch-action: none;
  background: rgba(255, 255, 255, 0.05);
}

.sig-overlay img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}

.sig-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  cursor: nwse-resize;
  touch-action: none;
}

.sig-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sig-tab-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.sig-tab-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.sig-panel {
  margin-bottom: 16px;
}

#sig-draw-canvas {
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: crosshair;
  max-width: 100%;
  touch-action: none;
}

.sig-style-options {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.sig-style-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
}

.sig-style-btn.active {
  border-color: var(--primary);
  color: var(--primary);
}

.style-cursive { font-family: "Segoe Script", "Brush Script MT", cursive; }
.style-elegant { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.style-bold { font-family: "Poppins", sans-serif; font-weight: 700; font-style: italic; }

#sig-type-preview {
  min-height: 70px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 32px;
  color: #111;
  overflow: hidden;
}

.sig-upload-preview {
  margin-top: 10px;
  max-width: 260px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.sig-upload-preview img {
  max-width: 100%;
  display: block;
}

.sig-placement-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0;
}

.match-page-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.match-page-header {
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.match-page-body {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.match-thumb-wrap {
  position: relative;
  flex: 0 0 auto;
  max-width: 240px;
}

.match-thumb-wrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #fff;
}

.match-list {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.match-row input[type="checkbox"] {
  accent-color: var(--primary);
  flex-shrink: 0;
}

.match-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.match-badge.type-email { background: #e3f0ff; color: #1a5fb4; }
.match-badge.type-dni,
.match-badge.type-nie { background: #ffe8e0; color: #b3401f; }
.match-badge.type-phone { background: #eaf7e6; color: #2e7d32; }

.match-value {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
