/**
 * Herramientas PDF — diseño editorial de RÜM (oct 2026), igual que Criterios
 * (RUM_Tools/Coordinacion/criterios.php): fondo blanco, Syne en títulos, Inter en
 * texto, etiquetas y botones en versalitas, filetes cálidos en vez de sombras y
 * primario durazno en píldora. Tokens --rx-* de assets/css/rum_shell_editorial.css
 * (los carga navbar.php), con respaldo por si la página sale sin navbar.
 */

@font-face { font-family: "Syne"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/assets/home/fonts/syne-var.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/assets/home/fonts/inter-var.woff2) format("woff2"); }

html { background: #fff; }

body.rum-pdft {
  margin: 0;
  background: #fff;
  color: var(--rx-ink, #1C1F26);
  font-family: var(--rx-f-sans, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.pdft {
  --ink: var(--rx-ink, #1C1F26);
  --ink-2: var(--rx-ink-2, #4A4F5A);
  --muted: #6B7079;
  --label: var(--rx-muted, #8A8F98);
  --rule: var(--rx-rule, #ECE4DA);
  --rule-strong: var(--rx-rule-strong, #DDD1C3);
  --paper-2: var(--rx-paper-2, #FAF7F3);
  --peach: var(--rx-peach, #F3D2B2);
  --peach-2: var(--rx-peach-2, #EEBF95);
  --peach-ink: var(--rx-peach-ink, #5C3A21);
  --terra: var(--rx-terracotta, #B8784C);
  --f-display: var(--rx-f-display, "Syne", "Inter", system-ui, sans-serif);
  --f-sans: var(--rx-f-sans, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
  --ok: #3E7A4F;
  --mid: #9A6417;
  --bad: #B4483C;
  --bad-bg: rgba(180, 72, 60, .09);

  box-sizing: border-box;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(20px, 2.6vw, 40px) clamp(16px, 2.4vw, 36px) 64px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.pdft *,
.pdft *::before,
.pdft *::after {
  box-sizing: border-box;
}

/* ---------- Encabezado ---------- */

.pdft-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 22px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--label);
  text-decoration: none;
  transition: color .2s ease;
}

.pdft-back:hover,
.pdft-back:focus-visible {
  color: var(--ink);
}

.ed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.ed-head__text {
  flex: 1 1 460px;
  min-width: 0;
}

.ed-kicker {
  display: block;
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--terra);
}

.ed-head h1 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1.02;
  letter-spacing: -.025em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ed-lede {
  margin: 14px 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.ed-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 100%;
}

.ed-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

/* ---------- Botones: píldora Inter en versalitas ---------- */

.pdft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--peach);
  background: var(--peach);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}

.pdft-btn:hover,
.pdft-btn:focus-visible {
  background: var(--peach-2);
  border-color: var(--peach-2);
}

.pdft-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.pdft-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.pdft-btn--quiet {
  background: transparent;
  border-color: var(--rule-strong);
}

.pdft-btn--quiet:hover,
.pdft-btn--quiet:focus-visible {
  background: transparent;
  border-color: var(--ink);
}

.pdft-btn--quiet:disabled:hover {
  border-color: var(--rule-strong);
}

.pdft-btn--sm {
  min-height: 30px;
  padding: 0 12px;
  font-size: 10.5px;
}

/* ---------- Elegir tarea: celdas con filete; la activa en tinta ---------- */

.pdft-tasks {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  margin: 0 0 30px;
  border-radius: 10px;
  overflow: hidden;
}

.pdft-task {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 16px 16px 18px;
  border: 0;
  background: #fff;
  box-shadow: 0 0 0 1px var(--rule);
  color: var(--ink);
  font-family: var(--f-sans);
  text-align: left;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.pdft-task:hover {
  background: var(--paper-2);
}

.pdft-task:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.pdft-task__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  color: var(--terra);
}

.pdft-task__icon svg {
  width: 24px;
  height: 24px;
}

.pdft-task__name {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: -.015em;
}

.pdft-task__sub {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.pdft-task.is-on,
.pdft-task.is-on:hover {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 0 0 1px var(--ink);
}

.pdft-task.is-on .pdft-task__icon {
  color: var(--peach);
}

.pdft-task.is-on .pdft-task__sub {
  color: rgba(255, 255, 255, .66);
}

/* ---------- Mesa de trabajo ---------- */

.pdft-workspace {
  position: relative;
}

.pdft-head h2 {
  margin: 0 0 6px;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}

.pdft-head p {
  margin: 0 0 18px;
  max-width: 70ch;
  color: var(--muted);
  font-size: 14px;
}

.pdft-drop {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 190px;
  padding: 28px 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: 10px;
  background: var(--paper-2);
  cursor: pointer;
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
}

.pdft-drop:hover,
.pdft-drop:focus-visible {
  border-color: var(--ink);
  outline: none;
}

.pdft-drop strong {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--ink);
}

.pdft-drop p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pdft-drop .pdft-btn {
  pointer-events: none;
}

.pdft-drop input[type="file"] {
  display: none;
}

.pdft-drop.is-compact {
  min-height: 0;
  grid-template-columns: auto 1fr;
  justify-items: start;
  text-align: left;
  padding: 12px 16px;
  gap: 2px 14px;
}

.pdft-drop.is-compact strong {
  font-size: 16px;
}

.pdft-drop.is-compact strong,
.pdft-drop.is-compact p {
  grid-column: 2;
}

.pdft-drop.is-compact .pdft-drop__btn {
  grid-column: 1;
  grid-row: 1 / span 2;
}

#pdftApp.is-dropping .pdft-drop {
  border-color: var(--ink);
}

#pdftApp.is-dropping .pdft-workspace::after {
  content: attr(data-drop-label);
  position: absolute;
  inset: -8px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--ink);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-family: var(--f-display);
  font-size: 26px;
  letter-spacing: -.015em;
  pointer-events: none;
  z-index: 5;
}

/* ---------- Opciones de la tarea ---------- */

.pdft-options {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin: 20px 0 0;
}

.pdft-options[hidden] {
  display: none;
}

.pdft-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.pdft-choice legend,
.pdft-field__label {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--label);
}

.pdft-choice__opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 320px;
  padding: 11px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.pdft-choice__opt:hover {
  border-color: var(--ink);
}

.pdft-choice__opt:has(input:checked) {
  border-color: var(--ink);
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.pdft-choice__opt input {
  margin: 3px 0 0;
  accent-color: var(--ink);
}

.pdft-choice__opt strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.pdft-choice__opt small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Nombre del archivo (extraer) */
.pdft-field {
  flex: 1 1 340px;
  max-width: 520px;
  min-width: 0;
}

.pdft-name {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color .2s ease;
}

.pdft-name:focus-within {
  border-color: var(--ink);
}

.pdft-name input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 14px;
}

.pdft-name input::placeholder {
  color: #A3A7AE;
}

.pdft-name span {
  display: grid;
  place-items: center;
  padding: 0 12px;
  border-left: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--label);
  font-size: 13px;
}

.pdft-field__hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- Barra de acciones ---------- */

.pdft-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 22px 0 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.pdft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pdft-actions .pdft-btn {
  min-height: 42px;
  padding-inline: 22px;
  font-size: 11.5px;
}

.pdft-count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pdft-tools-right {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.pdft-selbar {
  display: flex;
  gap: 6px;
}

.pdft-selbar[hidden] {
  display: none;
}

.pdft-status {
  min-height: 1.4em;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-2);
}

.pdft-status.is-ok { color: var(--ok); font-weight: 600; }
.pdft-status.is-warn { color: var(--mid); }
.pdft-status.is-err { color: var(--bad); font-weight: 600; }

.pdft-progress {
  height: 3px;
  margin: 0 0 12px;
  border-radius: 999px;
  background: var(--rule);
  overflow: hidden;
}

.pdft-progress[hidden] {
  display: none;
}

.pdft-progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width .2s ease;
}

/* ---------- Páginas ---------- */

.pdft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.pdft-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: grab;
  transition: border-color .2s ease, opacity .15s ease;
}

.pdft-card:hover {
  border-color: var(--rule-strong);
}

.pdft-card.is-dragging {
  opacity: .45;
}

.pdft-card.is-over {
  border-color: var(--terra);
  box-shadow: inset 0 0 0 1px var(--terra);
}

.pdft-card.is-selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.pdft-card__frame {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  padding: 12px;
  background: var(--paper-2);
}

.pdft-card__frame canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 0 0 1px var(--rule-strong);
  transition: transform .2s ease;
}

/* Girada 90/270: el lado largo pasa a ser el ancho; se reduce para que quepa. */
.pdft-card.is-rotated .pdft-card__frame canvas {
  max-width: 78%;
  max-height: 78%;
}

.pdft-card.is-loading .pdft-card__frame canvas {
  width: 70%;
  height: 90%;
  background: linear-gradient(90deg, #F1EBE3, #FAF7F3, #F1EBE3);
  background-size: 200% 100%;
  animation: pdft-shimmer 1.2s linear infinite;
  box-shadow: none;
}

@keyframes pdft-shimmer {
  from { background-position: 200% 0; }
  to { background-position: 0 0; }
}

.pdft-card__sel {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

#pdftApp[data-task="extraer"] .pdft-card__sel {
  display: grid;
}

#pdftApp[data-task="extraer"] .pdft-card__frame {
  cursor: pointer;
}

.pdft-card__sel input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.pdft-card__tools {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  padding: 6px 6px 0;
}

.pdft-card__btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.pdft-card__btn svg {
  width: 17px;
  height: 17px;
}

.pdft-card__btn:hover,
.pdft-card__btn:focus-visible {
  background: var(--paper-2);
  color: var(--ink);
  outline: none;
}

.pdft-card__btn.is-del:hover,
.pdft-card__btn.is-del:focus-visible {
  background: var(--bad-bg);
  color: var(--bad);
}

.pdft-card:first-child .is-move:first-child,
.pdft-card:last-child .is-move:last-child {
  visibility: hidden;
}

.pdft-card__foot {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 2px 12px 10px;
  font-size: 12px;
}

.pdft-card__num {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.pdft-card__src {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--label);
}

#pdftApp.is-busy .pdft-card {
  pointer-events: none;
  opacity: .8;
}

/* ---------- Pie ---------- */

.pdft-cde {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

.pdft-cde summary {
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
}

.pdft-cde p {
  margin: 10px 0 0;
}

.pdft-cde__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.pdft-cde__row input {
  width: 130px;
  padding: 9px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 14px;
}

.pdft-cde__row input:focus {
  border-color: var(--ink);
}

.pdft-privacy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 13px;
}

.pdft-privacy::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  transform: translateY(-1px);
}

@media (max-width: 1080px) {
  .pdft-tasks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ed-pill {
    display: none;
  }
  .pdft-tasks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 24px;
  }
  .pdft-task {
    padding: 12px 12px 14px;
  }
  .pdft-task__icon {
    margin-bottom: 2px;
  }
  .pdft-task__name {
    font-size: 15px;
  }
  .pdft-task__sub {
    display: none;
  }
  .pdft-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .pdft-tools-right {
    margin-left: 0;
  }
  .pdft-actions,
  .pdft-actions .pdft-btn {
    width: 100%;
  }
}
