/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  /* Marca — teal, sin morado (ver DESIGN-TOKENS.md) */
  --primary:       #0D9488;
  --primary-dark:  #0B7A70;
  --primary-light: rgba(13,148,136,.08);
  --mint:          #2DD4BF;  /* acento claro — solo gradientes/highlights, nunca CTA sola */
  --graphite:      #334155;  /* acento neutro — categoría Utilidades */
  --success:       #16A34A;
  --success-light: #DCFCE7;
  --danger:        #DC2626;
  --danger-light:  rgba(220,38,38,.07);
  /* Neutrales con sesgo sutil hacia el teal, no grises puros */
  --gray-50:       #F3FAF9;
  --gray-100:      #F8FCFB;
  --gray-200:      #DCEAE7;
  --gray-400:      #6F8581;  /* antes #8CA19D: no llegaba a 4.5:1 sobre blanco */
  --gray-600:      #4B615E;
  --gray-800:      #142524;
  /* Usados por Dividir PDF y otros paneles pero nunca definidos (quedaban sin color) */
  --gray-300:      #B9D6D1;
  --gray-500:      #5E7470;
  --gray-700:      #2B3E3C;
  --white:         #FFFFFF;
  /* Color por formato (regla: el del formato que NO es PDF; solo-PDF = marca).
     Ámbar e imagen oscurecidos para que el ícono se distinga sobre blanco. */
  --c-pdf:         #0D9488;
  --c-word:        #0D9488;
  --c-excel:       #16A34A;
  --c-ppt:         #D97706;
  --c-img:         #E11D48;
  --c-util:        #334155;
  --c-media:       #0F766E;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --radius-full:   999px;
  --shadow-sm:     0 1px 4px rgba(20,37,36,.06), 0 1px 2px rgba(20,37,36,.04);
  --shadow-md:     0 4px 16px rgba(13,148,136,.08), 0 1px 4px rgba(20,37,36,.06);
  --shadow-lg:     0 8px 32px rgba(13,148,136,.12), 0 2px 8px rgba(20,37,36,.06);
  --header-h:      64px;
  --page-max:      1440px;  /* portada: ~6 tarjetas por fila en escritorio */
  --tool-max:      1180px;  /* pantalla de herramienta: más angosta, se lee mejor */
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}

/* Ícono de interfaz del sprite (trazo 2 sobre viewBox 24: no bajar) */
.ic {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic--sm { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Ancho máximo del contenido; Ordenar PDF lo libera (.is-workspace) */
.container { max-width: var(--page-max); padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
@media (min-width: 720px) { .container { padding: 0 32px; } }
.upload-section .container { max-width: var(--tool-max); }
.upload-section.is-workspace .container { max-width: 100%; }

/* ===== HEADER ===== */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gray-800);
}
.logo__icon-wrap { width: 34px; height: 34px; display: flex; }
.logo__icon-wrap svg { width: 34px; height: 34px; }
.logo__text { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.logo__svc {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--gray-600);
  padding-left: 10px;
  border-left: 1px solid var(--gray-200);
}

.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav__link {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}
.nav__link:hover { background: var(--gray-100); color: var(--gray-800); }

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 3px;
}
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-400);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  letter-spacing: 0.03em;
}
.lang-btn:hover { color: var(--primary); }
.lang-btn.active { background: var(--white); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.lang-divider { color: var(--gray-200); font-size: 0.75rem; user-select: none; }

/* Selector de servicios (Doczel Herramientas / Doczel TCG) */
.svc { position: relative; }
.svc__btn {
  display: flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 12px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-full);
  background: var(--white); color: var(--gray-800);
  font-family: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.svc__btn:hover { border-color: #B9D6D1; }
.svc__btn .ic { width: 16px; height: 16px; }
.svc__menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 290px; max-width: calc(100vw - 32px);
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 8px; display: grid; gap: 4px;
}
.svc__item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--gray-800); }
.svc__item:hover { background: var(--gray-100); }
.svc__item[aria-current="true"] { background: var(--primary-light); }
.svc__mark { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; }
.svc__mark--tcg { display: grid; place-items: center; background: #2A2A2E; color: #D4A93C; font-weight: 800; font-size: 1.05rem; }
.svc__name { display: block; font-weight: 700; font-size: 0.94rem; }
.svc__desc { display: block; font-size: 0.8rem; color: var(--gray-600); }

/* ===== HERO =====
   Partido en dos: mensaje a la izquierda, zona para soltar a la derecha.
   Reemplaza el carrusel de frases y los orbes decorativos. */
.hero {
  position: relative;
  padding: 56px 0 44px;
  overflow: hidden;
}
/* Trama de puntos que se desvanece hacia abajo + resplandor menta detrás
   del diagrama. En un pseudo-elemento para que la máscara no afecte al contenido. */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(640px 380px at 76% 45%, rgba(45,212,191,.18), transparent 70%),
    radial-gradient(circle, rgba(13,148,136,.14) 1px, transparent 1.5px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
          mask-image: linear-gradient(#000 60%, transparent);
}
.hero > .container { position: relative; }
.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 48px;
  align-items: center;
}
.hero__badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
}
.hero__title {
  margin-top: 18px;
  font-size: clamp(2.1rem, 4.6vw, 3.3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero__title > span { display: block; }
.hero__title em { font-style: normal; color: var(--primary); }
.hero__subtitle { margin-top: 16px; font-size: 1.1rem; color: var(--gray-600); max-width: 34ch; line-height: 1.55; }
.hero__stats { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.hero__stat { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--gray-600); }
.hero__stat strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--gray-800); font-variant-numeric: tabular-nums; }

.hero-drop {
  background: var(--white);
  border: 2px dashed #9FD3CC;
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.hero-drop.drag-over { border-color: var(--primary); background: #F0FBF9; }
.hero-drop.drag-over .flow__halo { transform: scale(1.25); opacity: .9; }
.hero-drop__row { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; justify-content: space-between; }
.hero-drop__text { flex: 1 1 240px; min-width: 0; }
.hero-drop__title { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.hero-drop__sub { margin-top: 4px; color: var(--gray-600); font-size: 0.94rem; }

/* ── Diagrama de conversión (SVG en línea) ── */
.hero-drop__art {
  border-radius: 18px;
  padding: 14px 10px;
  background: linear-gradient(160deg, #ECF8F6 0%, #F7FCFB 60%, #FFFFFF 100%);
  border: 1px solid #E0F0ED;
}
.flow { display: block; width: 100%; height: auto; max-height: 300px; overflow: visible; }
.flow text { font-family: inherit; }
.flow__page { fill: #fff; stroke: #CFE3DF; stroke-width: 1.5; filter: drop-shadow(0 8px 14px rgba(13,148,136,.14)); }
.flow__page--back { fill: #E3F5F2; stroke: #B5DDD6; filter: none; }
.flow__badge { fill: var(--gray-800); }
.flow__badge-t { fill: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.flow__ink { fill: var(--gray-800); opacity: .78; }
.flow__line-txt { fill: #DCEAE7; }
.flow__table { fill: #F3FAF9; stroke: #CFE3DF; stroke-width: 1.2; }
.flow__table-l { fill: none; stroke: #CFE3DF; stroke-width: 1.2; }
.flow__img { fill: rgba(13,148,136,.12); }
.flow__img-m { fill: rgba(13,148,136,.45); }

.flow__wire {
  fill: none;
  stroke: var(--t, var(--primary));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 3 7;
  opacity: .7;
  animation: flowDash 1.1s linear infinite;
}
.flow__halo { fill: rgba(45,212,191,.22); transform-box: fill-box; transform-origin: center; animation: flowPulse 2.6s ease-in-out infinite; transition: transform .2s, opacity .2s; }
.flow__hub { fill: var(--primary); }
.flow__hub-ic { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.flow__out { animation: flowIn .5s ease-out both; }
.flow__out:nth-of-type(2) { animation-delay: .08s; }
.flow__out:nth-of-type(3) { animation-delay: .16s; }
.flow__out:nth-of-type(4) { animation-delay: .24s; }
.flow__tile { fill: #fff; stroke: color-mix(in srgb, var(--t) 28%, white); stroke-width: 1.5; filter: drop-shadow(0 4px 10px rgba(20,37,36,.06)); }
.flow__doc { fill: var(--t); }
.flow__fmt { fill: var(--gray-800); font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.flow__app { fill: var(--gray-600); font-size: 11.5px; font-weight: 600; }

@keyframes flowDash  { to { stroke-dashoffset: -20; } }
@keyframes flowPulse { 0%, 100% { transform: scale(.9); opacity: .55; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes flowIn    { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

.trust {
  list-style: none;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600);
}
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust .ic { width: 16px; height: 16px; color: var(--primary); }

/* Resultado de soltar un archivo en el hero */
.detect { margin-top: 18px; padding: 16px; border-radius: var(--radius-md); background: var(--gray-100); border: 1px solid var(--gray-200); }
.detect__file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detect__file .ic { color: var(--primary); }
.detect__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.detect__meta { margin-left: auto; flex-shrink: 0; font-size: 0.8rem; color: var(--gray-400); font-variant-numeric: tabular-nums; }
.detect__q { margin-top: 12px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gray-600); }
.detect__empty { margin-top: 10px; font-size: 0.94rem; color: var(--gray-600); }

/* Enlace compacto a una herramienta (hero, "¿algo más?") */
.chip-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 4px 12px 4px 4px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--white); color: var(--gray-800);
  font-size: 0.875rem; font-weight: 600; text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chip:hover { border-color: var(--card-c, var(--primary)); box-shadow: var(--shadow-sm); }
.chip--main { border-color: var(--card-c, var(--primary)); background: color-mix(in srgb, var(--card-c, var(--primary)) 7%, white); }
.chip .tool-card__icon-wrap { width: 32px; height: 32px; border-radius: 9px; }
.chip .tool-card__icon-wrap svg { width: 18px; height: 18px; }

/* ===== TOOLS SECTION ===== */
.tools-section { padding: 24px 0 64px; }
.tools-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.tools-head__title { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.tools-head__sub { margin-top: 4px; color: var(--gray-600); }

.tool-search { position: relative; flex: 1 1 320px; max-width: 420px; }
.tool-search > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.tool-search input {
  width: 100%; height: 48px;
  padding: 0 64px 0 44px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--white); color: var(--gray-800);
  font-family: inherit; font-size: 0.94rem; font-weight: 500;
}
.tool-search input::placeholder { color: var(--gray-400); }
.tool-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.tool-search__kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font: 600 0.72rem ui-monospace, Consolas, monospace; color: var(--gray-400);
  border: 1px solid var(--gray-200); border-bottom-width: 2px; border-radius: 6px;
  padding: 2px 6px; background: var(--gray-100);
}

.category-bar { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-full);
  background: var(--white); color: var(--gray-600);
  font-family: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.cat-btn small { font-size: 0.75rem; font-weight: 500; color: var(--gray-400); font-variant-numeric: tabular-nums; }
.cat-btn:hover { border-color: #B9D6D1; color: var(--gray-800); }
.cat-btn.active { background: var(--gray-800); border-color: var(--gray-800); color: var(--white); }
.cat-btn.active small { color: #A9C2BE; }

.color-legend { list-style: none; margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: var(--gray-600); }
.color-legend li { display: inline-flex; align-items: center; gap: 6px; }
.color-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--card-c); }

/* Cada categoría es su propia sección con encabezado visible */
.category-block { margin-top: 32px; }
.category-block__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.category-block__title { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-600); }
.category-block__count { font-size: 0.75rem; color: var(--gray-400); font-variant-numeric: tabular-nums; }

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

/* ===== TOOL CARDS =====
   --card-c (inline por tarjeta) = color del formato; tiñe el ícono y el
   borde al pasar el mouse. Sin --card-c cae al teal de marca. */
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-800);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--card-c, var(--primary)) 40%, var(--gray-200));
}
.tool-card__icon-wrap {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-c, var(--primary)) 11%, white);
  color: var(--card-c, var(--primary));
}
.tool-card__icon-wrap svg { width: 22px; height: 22px; display: block; }
.tool-card__body { min-width: 0; }

/* Formato de entrada → salida (data-fmt en la tarjeta). Va con CSS y no
   con data-i18n porque son nombres de formato, iguales en todo idioma. */
.tool-card[data-fmt]::after {
  content: attr(data-fmt);
  position: absolute;
  top: 18px; right: 16px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Franja de color arriba, aparece al pasar el mouse */
.tool-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--card-c, var(--primary));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.2s ease-out;
}
.tool-card:hover::before, .tool-card:focus-visible::before { transform: scaleX(1); }
.tool-card:hover .tool-card__icon-wrap { background: var(--card-c, var(--primary)); color: var(--white); }
.tool-card__icon-wrap { transition: background 0.15s, color 0.15s; }
.tool-card__title { display: block; font-size: 1rem; font-weight: 700; }
.tool-card__desc { display: block; margin-top: 3px; font-size: 0.875rem; line-height: 1.45; color: var(--gray-600); }
.tool-card mark { background: rgba(45,212,191,.32); color: inherit; border-radius: 3px; padding: 0 1px; }

.tools-empty {
  margin-top: 28px; padding: 28px;
  display: grid; gap: 4px; justify-items: center; text-align: center;
  border: 1px dashed var(--gray-200); border-radius: var(--radius-md);
  background: var(--white); color: var(--gray-600);
}
.tools-empty strong { color: var(--gray-800); }

/* ===== PANTALLA DE HERRAMIENTA ===== */
.upload-section {
  padding: 28px 0 48px;
  animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.875rem; color: var(--gray-400); }
.crumbs a { color: var(--gray-600); font-weight: 600; text-decoration: none; }
.crumbs a:hover { color: var(--primary-dark); }

.tool-head { margin-top: 14px; display: flex; gap: 16px; align-items: center; }
.tool-head__icon { width: 56px; height: 56px; border-radius: 16px; }
.tool-head__icon svg { width: 28px; height: 28px; }
.tool-head__title { font-size: clamp(1.6rem, 3.2vw, 2.15rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.tool-head__desc { margin-top: 4px; color: var(--gray-600); }

.steps { list-style: none; margin-top: 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.step {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--white);
  font-size: 0.94rem; font-weight: 600; color: var(--gray-400);
}
.step > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step__n {
  width: 26px; height: 26px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 2px solid var(--gray-200); border-radius: 50%;
  font-size: 0.8rem; font-weight: 800;
}
.step__n .ic { width: 14px; height: 14px; stroke-width: 3; }
.step.is-now { color: var(--gray-800); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.step.is-now .step__n { border-color: var(--primary); color: var(--primary); }
.step.is-done { color: var(--gray-600); }
.step.is-done .step__n { background: var(--primary); border-color: var(--primary); color: var(--white); }

.tool-work { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }

/* Ordenar PDF trae su propia barra con "Volver" y título: se oculta el
   encabezado, los pasos y el lateral, y la tarjeta usa todo el ancho. */
.upload-section.is-workspace .crumbs,
.upload-section.is-workspace .tool-head,
.upload-section.is-workspace .steps,
.upload-section.is-workspace .tool-aside { display: none; }
.upload-section.is-workspace .tool-work { display: block; margin-top: 0; }
.upload-section.is-workspace { padding-top: 0; }

/* ===== CARD ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  min-width: 0;
  text-align: center;
  border: 1px solid var(--gray-200);
}

/* Área de trabajo a ancho completo (Ordenar PDF): la tarjeta deja de ser un
   recuadro visible y pasa a ser solo un contenedor. */
.card--workspace {
  max-width: 100%;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

/* ===== ERROR EN LA TARJETA ===== */
.tool-error {
  display: flex; gap: 14px; align-items: flex-start;
  margin-bottom: 18px; padding: 16px;
  border: 1px solid #F5C2C2; border-radius: var(--radius-md);
  background: var(--danger-light);
  text-align: left;
}
.tool-error > .ic { width: 22px; height: 22px; color: var(--danger); margin-top: 1px; }
.tool-error__title { font-weight: 800; color: #991B1B; }
.tool-error__msg { margin-top: 4px; font-size: 0.94rem; color: #7F1D1D; }
.tool-error__actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== DROPZONE ===== */
.dropzone {
  border: 2px dashed #9FD3CC;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  padding: 40px 20px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: #F0FBF9; }
.dropzone__icon {
  width: 56px; height: 56px; margin-bottom: 4px;
  display: grid; place-items: center;
  border-radius: 16px; background: var(--primary-light); color: var(--primary);
}
.dropzone__icon .ic { width: 26px; height: 26px; }
.dropzone__title { font-size: 1.2rem; font-weight: 800; color: var(--gray-800); }
.dropzone__subtitle { font-size: 0.94rem; color: var(--gray-600); }
.dropzone .btn { margin-top: 6px; }
.dropzone__limit { margin-top: 4px; font-size: 0.8rem; color: var(--gray-400); }

/* ===== FILE INFO ===== */
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left;
}
.file-info__icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px; background: var(--white); border: 1px solid var(--gray-200);
  color: var(--primary);
}
.file-info__details { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-info__name { font-weight: 700; font-size: 0.94rem; color: var(--gray-800); overflow-wrap: anywhere; }
.file-info__size { font-size: 0.8rem; color: var(--gray-400); font-variant-numeric: tabular-nums; }

.btn-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-600);
  transition: color 0.2s, border-color 0.2s;
}
.btn-icon:hover { color: var(--danger); border-color: #F5C2C2; }

/* ===== PROGRESS ===== */
.progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}
.progress-bar {
  width: 100%;
  height: 10px;
  background: #E4F1EE;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--mint));
  border-radius: 999px;
  animation: indeterminate 1.5s ease-in-out infinite;
}
@keyframes indeterminate {
  0%   { width: 10%; margin-left: 0%; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 10%; margin-left: 90%; }
}
.progress-label { font-size: 0.94rem; color: var(--gray-800); font-weight: 600; }

/* ===== DOWNLOAD ===== */
.download-wrap { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.download-head { display: flex; gap: 14px; align-items: center; }
.success-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--success-light); color: var(--success);
}
.success-icon .ic { width: 24px; height: 24px; stroke-width: 2.5; }
.download-title { font-size: 1.3rem; font-weight: 800; color: var(--gray-800); }
.download-sub { font-size: 0.94rem; color: var(--gray-600); }
.download-file {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--gray-100);
}
.download-file__name { flex: 1 1 160px; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.download-wrap > #convertAnotherBtn { align-self: flex-start; }

.next-tools { padding-top: 16px; border-top: 1px solid var(--gray-200); }
.next-tools__q { font-weight: 700; font-size: 0.94rem; }

.donate-nudge {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--gray-100);
}
.donate-nudge > .ic { color: var(--primary); }
.donate-nudge__text { flex: 1 1 200px; font-size: 0.875rem; color: var(--gray-600); margin: 0; }
.donate-nudge__btn { font-size: 0.875rem; font-weight: 700; color: var(--primary-dark); text-decoration: none; }
.donate-nudge__btn:hover { text-decoration: underline; }

/* ===== LATERAL ===== */
.tool-aside { display: grid; gap: 14px; }
.aside-box { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 18px; }
.aside-box__title { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-600); }
.aside-box__list { list-style: none; margin-top: 12px; display: grid; gap: 10px; font-size: 0.94rem; }
.aside-box__list li { display: flex; gap: 10px; align-items: flex-start; }
.aside-box__list .ic { width: 18px; height: 18px; color: var(--primary); margin-top: 2px; }
.related { margin-top: 10px; display: grid; gap: 4px; }
.related__item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.94rem; color: var(--gray-800); text-decoration: none; }
.related__item:hover { background: var(--gray-100); }
.related__item .tool-card__icon-wrap { width: 34px; height: 34px; border-radius: 9px; }
.related__item .tool-card__icon-wrap svg { width: 18px; height: 18px; }

/* ===== CARD ACTIONS ===== */
.card__actions { margin-top: 20px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 0.94rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn--primary { background: var(--primary); color: var(--white); }
.btn--primary:hover { background: var(--primary-dark); }
.btn--success { background: var(--success); color: var(--white); }
.btn--success:hover { background: #15803D; }
.btn--ghost { background: var(--white); color: var(--gray-800); border-color: var(--gray-200); }
.btn--ghost:hover { background: var(--gray-100); border-color: #B9D6D1; }
.btn--large { min-height: 52px; padding: 0 26px; font-size: 1rem; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 0.875rem; }

/* ===== IMÁGENES A PDF ===== */
.img-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
}

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}

.img-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
  background: var(--gray-100);
  aspect-ratio: 1;
}

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

.img-thumb__name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.52);
  color: #fff;
  font-size: 0.62rem;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.img-thumb__remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.img-thumb__remove:hover { background: var(--danger); }

.img-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.img-count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
}

/* ===== UNIR PDFs ===== */
.merge-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  border-radius: 14px;
  border: 2px dashed transparent;
  transition: border-color 0.15s, background 0.15s;
}
.merge-preview-wrap.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.merge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}

.merge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  user-select: none;
  -webkit-touch-callout: none;
  transition: box-shadow 0.15s, opacity 0.15s, border-color 0.15s;
}

.merge-item.dragging {
  box-shadow: 0 8px 20px rgba(0,0,0,0.14);
  border-color: var(--primary);
  opacity: 0.92;
  position: relative;
  z-index: 5;
  pointer-events: none;
}

.merge-item__handle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  color: var(--gray-400);
  font-size: 1rem;
  line-height: 1;
  letter-spacing: -1px;
  cursor: grab;
}
.merge-item.dragging .merge-item__handle { cursor: grabbing; color: var(--primary); }

.merge-item__num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--white);
  background: var(--primary);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.merge-item__icon { font-size: 1.1rem; flex-shrink: 0; }

.merge-item__name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merge-item__size {
  font-size: 0.78rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

.merge-item .img-thumb__remove {
  position: static;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.5;
}
.merge-item .img-thumb__remove:hover { opacity: 1; }

.merge-drop-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px dashed var(--gray-300);
  color: var(--gray-400);
  font-size: 0.82rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  cursor: default;
}
.merge-preview-wrap.drag-over .merge-drop-row {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ===== PDF A IMÁGENES — selector de formato ===== */
.format-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(13,148,136,0.15);
}

.format-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
}

.format-options {
  display: flex;
  gap: 12px;
}

.format-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
  border-radius: 10px;
  border: 2px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
}

.format-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

.format-option input[type="radio"] { display: none; }

.format-option__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
}

.format-option__hint {
  font-size: 0.72rem;
  color: var(--gray-400);
}

/* ===== MARCA DE AGUA ===== */
.watermark-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(13,148,136,0.15);
}

/* ===== REDIMENSIONAR IMAGEN ===== */
.resize-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(13,148,136,0.15);
}

.resize-inputs {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.resize-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.resize-field__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.resize-input {
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-800);
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}
.resize-input:focus { border-color: var(--primary); }
.resize-input::-webkit-outer-spin-button,
.resize-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.resize-x {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-400);
  padding-bottom: 8px;
  flex-shrink: 0;
}

.resize-hint {
  font-size: 0.78rem;
  color: var(--gray-400);
  text-align: center;
}

.resize-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 4px;
  border-top: 1px solid rgba(13,148,136,0.12);
}

.resize-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.resize-slider-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-600);
}

.resize-percent-badge {
  background: var(--primary);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 100px;
  min-width: 52px;
  text-align: center;
}

.resize-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  accent-color: var(--primary);
  cursor: pointer;
  outline: none;
}

.resize-slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--gray-400);
  padding: 0 2px;
}

/* ===== GENERADOR DE QR ===== */
.qr-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(13,148,136,0.15);
}

.qr-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-800);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.qr-textarea:focus { border-color: var(--primary); }

/* ===== PDF CON CONTRASEÑA ===== */
.password-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(13,148,136,0.15);
}

.password-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.2s;
}
.password-input:focus { border-color: var(--primary); }

.btn-password-toggle {
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-password-toggle:hover { background: var(--primary-light); border-color: var(--primary); }

/* ===== ORDENAR PDF ===== */
/* Esta herramienta usa un área de trabajo a ancho completo en vez de la
   tarjeta angosta: la tarjeta se vacía con .card--workspace (ver más abajo)
   y el panel trae su propia barra de acciones fija. */
.reorder-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.reorder-loading {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.875rem;
  padding: 40px 0;
}

/* ── Barra de acciones (fija bajo el header del sitio) ───────────────────── */
/* Fondo y borde propios, distintos del header blanco, para que se lea como
   parte de la herramienta y no como una segunda fila del sitio. El margen
   negativo cancela el padding de .container y la deja a sangre completa. */
.reorder-toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  margin: 0 -32px 34px;
  background: #E6F5F3;
  border-bottom: 1px solid #C9E7E3;
  box-shadow: 0 4px 14px rgba(13,148,136,0.10);
}
.reorder-toolbar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--mint));
}
.reorder-toolbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px 14px;
  text-align: left;
}

/* Franja propia para los archivos adjuntos: así al sumar PDFs crecen hacia
   abajo en vez de empujar las acciones a otra fila. Tope de dos filas y el
   resto con scroll, para que la barra no se coma la pantalla. */
.reorder-toolbar__files-row {
  display: flex;
  align-items: flex-start;
  padding: 0 32px 16px;
}
.reorder-toolbar__files-row .reorder-files {
  max-height: 88px;
  overflow-y: auto;
  align-content: flex-start;
}

.reorder-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.reorder-back:hover { border-color: var(--primary); color: var(--primary); }

.reorder-toolbar__title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--gray-800);
}
.reorder-toolbar__title svg { width: 19px; height: 19px; color: var(--primary); }

.reorder-count {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gray-600);
  background: rgba(255,255,255,0.7);
  border: 1px solid #C9E7E3;
  padding: 4px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reorder-toolbar__spacer { flex: 1; }

/* ── Chips de archivos adjuntos ──────────────────────────────────────────── */
.reorder-files {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reorder-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-left: 4px solid var(--file-color, var(--primary));
  border-radius: 10px;
  padding: 6px 10px 6px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-800);
  max-width: 250px;
}
.reorder-chip__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reorder-chip__count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray-400);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.reorder-chip__x {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px;
  border-radius: 4px;
  flex-shrink: 0;
}
.reorder-chip__x:hover { color: var(--danger); background: #FEE2E2; }

/* Mismo alto que los chips, para que la fila quede pareja al envolverse. */
.reorder-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px dashed #C9E7E3;
  background: none;
  color: var(--gray-600);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.reorder-add svg { width: 18px; height: 18px; }
.reorder-add:hover { border-color: var(--primary); color: var(--primary); background: var(--white); }

/* ── Acciones globales ───────────────────────────────────────────────────── */
.reorder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.reorder-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.reorder-tool-btn svg { width: 15px; height: 15px; }
.reorder-tool-btn:hover { border-color: var(--primary); color: var(--primary); }
.reorder-tool-btn--danger:hover { border-color: var(--danger); color: var(--danger); background: #FEE2E2; }

.reorder-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.86rem;
}
.reorder-save svg { width: 15px; height: 15px; }

/* ── Grilla de páginas ───────────────────────────────────────────────────── */
/* Máximo 7 por fila, con tope de ancho para que en pantallas grandes las
   miniaturas no queden desproporcionadas. */
.reorder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 34px;
  max-width: 1560px;
  margin: 0 auto;
  padding-bottom: 40px;
}
@media (min-width: 900px)  { .reorder-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1200px) { .reorder-grid { grid-template-columns: repeat(7, 1fr); } }

.reorder-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--gray-200);
  border-top: 3px solid var(--file-color, var(--primary));
  border-radius: 8px;
  padding: 10px 10px 8px;
  background: var(--white);
  cursor: move;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
  user-select: none;
}
/* El realce toma el color del archivo de origen: es el rastro que indica de
   qué PDF viene cada página cuando hay varios adjuntos. */
.reorder-thumb:hover {
  border-color: var(--file-color, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--file-color, var(--primary)) 26%, transparent), var(--shadow-md);
  transform: translateY(-2px);
}
.reorder-thumb.dragging {
  border-color: var(--file-color, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--file-color, var(--primary)) 40%, transparent), var(--shadow-lg);
  transform: scale(0.95);
}
.reorder-thumb.dragging .reorder-thumb__imgwrap,
.reorder-thumb.dragging .reorder-thumb__num { opacity: 0.35; }
.reorder-thumb.drag-over-thumb {
  border-color: var(--file-color, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--file-color, var(--primary)) 30%, transparent), var(--shadow-md);
  transform: scale(1.03);
}

.reorder-thumb__imgwrap {
  width: 100%;
  aspect-ratio: 1 / 1.32;
  overflow: hidden;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}

.reorder-thumb img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  pointer-events: none;
  transition: transform 0.2s ease;
}

/* z-index obligatorio: .reorder-thumb__imgwrap contiene una imagen con
   transform (la rotación), lo que crea un contexto de apilamiento y haría
   que la hoja se pinte encima de estos botones. */
.reorder-thumb__actions {
  position: absolute;
  z-index: 3;
  top: 7px;
  left: 7px;
  right: 7px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

/* Superficie neutra y borde fino; el color vive en el trazo del icono, no en
   un relleno pastel. El color pleno queda para el hover, donde sí comunica
   la acción. Nitidez: el grosor renderizado es stroke-width x (tamaño /
   viewBox) — con 18px sobre viewBox 24 y stroke 2 da 1.5px. No bajar de 2,
   valores menores dan fracciones que el navegador difumina. */
.reorder-thumb__btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 2px rgba(31,41,55,0.07);
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.reorder-thumb__btn svg { width: 18px; height: 18px; }

.reorder-thumb__btn--rotate { color: var(--primary); }
.reorder-thumb__btn--rotate:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.reorder-thumb__btn--delete { color: var(--danger); }
.reorder-thumb__btn--delete:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.reorder-thumb__num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-600);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  /* En pantallas angostas no cabe todo en una línea: acá sí se permite que
     las acciones bajen, pero como bloque completo y no partidas. */
  .reorder-toolbar__inner { padding: 14px 20px 10px; gap: 12px; flex-wrap: wrap; }
  .reorder-toolbar__files-row { padding: 0 20px 12px; }
  .reorder-toolbar__spacer { display: none; }
  .reorder-actions { width: 100%; flex-wrap: wrap; }
  .reorder-save { flex: 1; justify-content: center; }
  .reorder-grid { gap: 20px; }
}

/* ===== DIVIDIR PDF ===== */
.split-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  padding: 8px 0;
}

.split-info { text-align: center; }

.split-pages-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.split-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.split-pool-section { width: 100%; }

.split-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.split-page-chip {
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.13s;
  font-family: inherit;
}
.split-page-chip:hover:not([disabled]) {
  background: var(--primary);
  color: var(--white);
}
.split-page-chip.used {
  border-color: var(--gray-200);
  color: var(--gray-400);
  cursor: default;
  opacity: 0.5;
}
.split-page-chip.assigned {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-size: 0.78rem;
}
.split-page-chip.assigned:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #ef4444;
}

.split-parts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.split-part {
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.split-part.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}
.split-part:hover:not(.active) { border-color: var(--gray-300); }

.split-part-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.split-part-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-700);
}
.split-part.active .split-part-title { color: var(--primary); }

.split-part-del {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.12s;
}
.split-part-del:hover { background: #fee2e2; color: #ef4444; }

.split-part-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  align-items: center;
}

.split-part-empty {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-style: italic;
}

.split-add-part-btn {
  align-self: flex-start;
  background: none;
  border: 1.5px dashed var(--gray-300);
  border-radius: 8px;
  color: var(--gray-500);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.13s;
}
.split-add-part-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ===== ROTATE TOOL ===== */
.rotate-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}

.pdf-preview-box {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 400px;
  height: 400px;
  max-width: 100%;
}

#pdfPreviewCanvas {
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  display: block;
  max-width: 340px;
  max-height: 340px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.rotate-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-rotate {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(13,148,136,0.4);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  color: white;
}

.btn-rotate svg { width: 28px; height: 28px; }

.btn-rotate:hover {
  background: var(--primary-dark);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(13,148,136,0.5);
}

.btn-rotate:active { transform: scale(0.95); }
.btn-rotate:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.rotate-angle-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
}

.rotate-actions { width: 100%; display: flex; justify-content: center; }

/* ===== FOOTER (común a todos los servicios de Doczel) ===== */
.footer {
  margin-top: auto;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}
.footer__inner {
  padding-top: 36px;
  padding-bottom: 28px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
}
.footer__about { margin-top: 12px; max-width: 36ch; font-size: 0.94rem; color: var(--gray-600); }
.footer__head { margin-bottom: 10px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-400); }
.footer__list { list-style: none; display: grid; gap: 8px; font-size: 0.94rem; }
.footer__list a { color: var(--gray-800); text-decoration: none; }
.footer__list a:hover { color: var(--primary-dark); }
.footer__donate { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.footer__donate .ic { width: 18px; height: 18px; color: var(--primary); }
.footer__copy { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--gray-200); font-size: 0.8rem; color: var(--gray-400); }

/* ===== ERROR TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1F2937;
  color: var(--white);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 920px) {
  .hero__inner { grid-template-columns: 1fr; gap: 28px; }
  .tool-work { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .nav__link, .logo__svc, .svc__btn-label { display: none; }
  .hero { padding: 28px 0 24px; }
  .hero-drop { padding: 16px; }
  .hero-drop__art { padding: 8px 4px; }
  .hero-drop__row .btn { width: 100%; justify-content: center; }
  /* En celular la tarjeta vuelve a ser horizontal: una por fila, más compacta */
  .tools-grid { grid-template-columns: 1fr; gap: 10px; }
  .tool-card { flex-direction: row; padding: 16px; }
  .tool-card[data-fmt]::after { top: 16px; }
  .tool-card__title { padding-right: 92px; }
  .tool-search { max-width: none; }
  .tool-search input { padding-right: 14px; }
  .tool-search__kbd { display: none; }
  /* Pasos en una fila: solo el actual muestra su texto, para no empujar
     la zona de carga fuera de la primera pantalla */
  .steps { grid-template-columns: auto auto auto; justify-content: start; }
  .step { padding: 6px 10px; }
  .step:not(.is-now) > span:last-child { display: none; }
  .card { padding: 20px 16px; }
  .footer__inner { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ===== SEO CONTENT BLOCK =====
   Lo inyecta main.py en cada URL de herramienta (h1 + intro + pasos). */
.tool-seo {
  padding-top: 48px;
  padding-bottom: 64px;
  border-top: 1px solid var(--gray-200);
}
.tool-seo__h1 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gray-800);
  margin-bottom: 12px;
}
.tool-seo__intro { max-width: 68ch; font-size: 1rem; line-height: 1.7; color: var(--gray-600); margin-bottom: 20px; }
.tool-seo__steps {
  list-style: none;
  counter-reset: paso;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.tool-seo__steps li {
  counter-increment: paso;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--gray-200);
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--gray-600);
}
.tool-seo__steps li::before {
  content: counter(paso);
  display: block;
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
}


/* ── Firmar PDF ─────────────────────────────────────────────────────────────── */
.sign-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.sign-canvas-box {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  overflow: hidden;
}

#signCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none; /* permite dibujar con el dedo sin hacer scroll */
}

.sign-controls {
  display: flex;
  justify-content: flex-end;
}

.sign-options {
  display: flex;
  gap: 12px;
}

.sign-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sign-page-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sign-page-row .resize-input { width: 80px; }

.sign-page-total {
  font-size: 0.88rem;
  color: var(--gray-400);
  white-space: nowrap;
}

select.resize-input { text-align: left; cursor: pointer; }

.sign-allpages {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
}

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

/* ── Recortar audio/video ───────────────────────────────────────────────────── */
.trim-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* Selector de formato con muchas opciones (audio): permitir salto de línea */
.format-options--wrap {
  flex-wrap: wrap;
}

.format-options--wrap .format-option {
  padding: 10px 18px;
}

@media (max-width: 560px) {
  .sign-options { flex-direction: column; }
}

.nav__link--always { display: inline-block !important; }
