/* =============================================================
   Pliego — herramientas PDF en tu navegador
   1. Tokens · 2. Reset · 3. Utilidades · 4. Tipografía
   5. Componentes · 6. Secciones · 7. Herramienta · 8. Responsive
   ============================================================= */

/* ---------- 1. Tokens ---------- */
@font-face {
  font-family: "Bricolage";
  src: url("/assets/fonts/bricolage-latin.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
:root {
  --paper: #f7f6f1;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --ink: #11201c;
  --ink-2: #33423e;
  --muted: #66736f;
  --line: #e4e1d6;
  --line-2: #d6d2c4;
  --pine: #0e7c66;
  --pine-700: #095445;
  --pine-600: #0a6655;
  --pine-50: #e5f2ee;
  --sun: #f4a62a;
  --sun-50: #fdf2dd;
  --danger: #b4332a;
  --danger-50: #fbe9e7;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(17, 32, 28, .05), 0 6px 20px rgba(17, 32, 28, .06);
  --shadow-lg: 0 2px 4px rgba(17, 32, 28, .05), 0 18px 48px rgba(17, 32, 28, .10);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Bricolage", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1320px;
  --gutter: clamp(16px, 4vw, 32px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1714;
    --surface: #16211d;
    --surface-2: #1a2622;
    --ink: #eef3f0;
    --ink-2: #c8d3cf;
    --muted: #93a39e;
    --line: #26352f;
    --line-2: #33453e;
    --pine: #3fbf9f;
    --pine-700: #8fe0c9;
    --pine-600: #5fd0b2;
    --pine-50: #173029;
    --sun-50: #33280f;
    --danger: #ff8a7f;
    --danger-50: #3a1d1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .4);
  }
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--pine-600); text-underline-offset: 3px; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
::selection { background: var(--pine); color: #fff; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- 3. Utilidades ---------- */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--ink); color: var(--paper);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
[hidden] { display: none !important; }

/* ---------- 4. Tipografía ---------- */
.h1, h1 { font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 1.2rem + 3vw, 3.2rem); }
h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; }
.lead { font-size: clamp(1.02rem, .95rem + .4vw, 1.2rem); color: var(--ink-2); max-width: 62ch; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pine-600); }
.prose p, .prose li { color: var(--ink-2); }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: .9em; }
.prose h2 { margin: 2.2rem 0 .8rem; }
.prose h3 { margin: 1.6rem 0 .5rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .35em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .93rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.todo { background: var(--sun-50); border-bottom: 2px dashed var(--sun); padding: 0 .2em; font-weight: 600; }

/* ---------- 5. Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 999px;
  font-weight: 650; font-size: .96rem; line-height: 1.2; text-decoration: none;
  transition: background-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out), color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pine); color: #fff; box-shadow: 0 6px 18px rgba(14, 124, 102, .28); }
.btn-primary:hover { background: var(--pine-600); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #06231c; } .btn-primary:hover { background: var(--pine-700); } }
.btn-primary[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--pine); color: var(--pine-600); }
.btn-sm { min-height: 36px; padding: .35rem .8rem; font-size: .86rem; }
.btn-lg { min-height: 52px; padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn-xl { min-height: 58px; padding: .9rem 2rem; font-size: 1.12rem; width: 100%; }
.btn-link { color: var(--muted); font-size: .92rem; text-decoration: underline; text-underline-offset: 3px; padding: .4rem; }
.btn-link:hover { color: var(--pine-600); }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .86rem; font-weight: 600; color: var(--ink-2);
}
.chip svg { width: 16px; height: 16px; color: var(--pine); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand img, .brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.03em; }
.brand-name b { color: var(--sun); }
.nav { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.nav > a, .menu-tools > summary {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: .4rem .8rem;
  border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
}
.nav > a:hover, .menu-tools > summary:hover { background: var(--surface); color: var(--ink); }
.menu-tools { position: relative; }
.menu-tools > summary { list-style: none; }
.menu-tools > summary::-webkit-details-marker { display: none; }
.menu-tools > summary svg { width: 16px; height: 16px; transition: transform .2s; }
.menu-tools[open] > summary svg { transform: rotate(180deg); }
.mega {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(860px, 92vw);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 1.2rem; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.mega h3 { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.mega a { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .93rem; }
.mega a:hover { background: var(--surface-2); }
.mega .ico { width: 28px; height: 28px; border-radius: 8px; }
.mega .ico svg { width: 16px; height: 16px; }
.nav > a.nav-secondary { display: none; }

/* Ad slots — espacio reservado para evitar saltos (CLS) */
.ad-slot {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 100%; background: repeating-linear-gradient(135deg, var(--surface-2) 0 12px, var(--surface) 12px 24px);
  border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted);
  font-size: .72rem; font-weight: 700; letter-spacing: .18em; overflow: hidden;
}
.ad-header-wrap { padding-block: 10px; border-bottom: 1px solid var(--line); background: var(--paper); }
.ad-header { min-height: 100px; max-width: 970px; margin-inline: auto; }
.ad-content { min-height: 280px; margin-block: 2.5rem; }
.ad-sidebar { min-height: 600px; }
.ad-done { min-height: 250px; max-width: 336px; margin-inline: auto; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.ico {
  flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  color: #fff; background: var(--c, var(--pine));
}
.ico svg { width: 26px; height: 26px; }

/* Tool cards (portada) */
.tool-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.tcard {
  position: relative; display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem 1.2rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); overflow: hidden;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s;
}
.tcard::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--c);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease-out);
}
.tcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.tcard:hover::after { transform: scaleX(1); }
.tcard h3 { font-size: 1.08rem; }
.tcard p { font-size: .92rem; color: var(--muted); line-height: 1.5; }
.tcard .badge { position: absolute; top: 1rem; right: 1rem; font-size: .7rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--sun-50); color: #8a5a00; }
@media (prefers-color-scheme: dark) { .tcard .badge { color: var(--sun); } }

.cat { margin-top: 2.2rem; }
.cat-head { display: flex; align-items: baseline; gap: .7rem; margin-bottom: 1rem; }
.cat-head h2 { font-size: 1.3rem; }
.cat-head span { color: var(--muted); font-size: .9rem; }

/* Search */
.search {
  position: relative; max-width: 560px; margin-top: 1.6rem;
}
.search svg { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 54px; padding: .8rem 1rem .8rem 3rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); font-size: 1rem; box-shadow: var(--shadow);
}
.search input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pine) 18%, transparent); }
.no-results { margin-top: 2rem; padding: 1.5rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* ---------- 6. Secciones ---------- */
.page-grid { display: grid; gap: 2rem; padding-block: 1.6rem 3rem; }
.page-main { min-width: 0; }
.page-aside { display: none; }

.hero { padding-block: 1.6rem .6rem; }
.hero h1 { max-width: 20ch; }
.hero .lead { margin-top: .9rem; }
.trust { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.privacy-banner {
  display: flex; gap: 1rem; align-items: center; margin-top: 1.4rem; padding: 1rem 1.2rem;
  background: var(--pine-50); border: 1px solid color-mix(in srgb, var(--pine) 25%, transparent);
  border-radius: var(--radius); color: var(--ink);
}
.privacy-banner svg { width: 34px; height: 34px; color: var(--pine); flex: none; }
.privacy-banner strong { display: block; }
.privacy-banner span { font-size: .92rem; color: var(--ink-2); }

.section { margin-top: 3rem; }
.section > h2 { margin-bottom: 1.1rem; }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); counter-reset: s; }
.step { position: relative; padding: 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.step::before {
  counter-increment: s; content: counter(s); display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--c, var(--pine)); color: #fff; font-weight: 800; margin-bottom: .7rem;
}
.step p { color: var(--muted); font-size: .94rem; margin-top: .3rem; }
.perks { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.perk { display: flex; gap: .8rem; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.perk svg { width: 28px; height: 28px; color: var(--pine); flex: none; }
.perk p { color: var(--muted); font-size: .92rem; margin-top: .15rem; }

.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px;
}
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.15rem; font-weight: 650; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--pine); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 1.15rem 1.1rem; color: var(--ink-2); }

.related-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.rcard { display: flex; align-items: center; gap: .7rem; padding: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 650; font-size: .95rem; transition: border-color .2s, transform .2s var(--ease-out); }
.rcard:hover { border-color: var(--c); transform: translateY(-2px); }
.rcard .ico { width: 38px; height: 38px; border-radius: 10px; }
.rcard .ico svg { width: 20px; height: 20px; }

.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.breadcrumbs li + li::before { content: "›"; margin-right: .4rem; }

/* Footer */
.site-footer { margin-top: 3rem; background: #0d1a16; color: #c5d1cc; padding-block: 3rem 1.5rem; }
.site-footer a { color: #e8efec; text-decoration: none; }
.site-footer a:hover { color: var(--sun); text-decoration: underline; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.footer-grid h2 { font-family: var(--sans); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: #8ea39b; margin-bottom: .8rem; }
.footer-grid ul { list-style: none; padding: 0; display: grid; gap: .45rem; font-size: .93rem; }
.footer-brand p { font-size: .92rem; margin-top: .8rem; max-width: 34ch; }
.footer-brand .brand { color: #fff; }
.footer-bottom { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid #22332d; display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; justify-content: space-between; font-size: .85rem; color: #8ea39b; }
.footer-bottom button { color: #e8efec; text-decoration: underline; font-size: .85rem; }

/* Cookie banner (preparado para sustituir por una CMP certificada) */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 80; max-width: 560px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 1.2rem 1.25rem;
}
.cookie-banner h2 { font-size: 1.08rem; font-family: var(--sans); }
.cookie-banner p { font-size: .9rem; color: var(--ink-2); margin-top: .4rem; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.cookie-actions .btn { flex: 1 1 auto; }
.cookie-prefs { margin-top: .9rem; display: grid; gap: .6rem; }
.cookie-prefs label { display: flex; gap: .7rem; align-items: flex-start; font-size: .9rem; }
.cookie-prefs input { margin-top: .3rem; accent-color: var(--pine); width: 18px; height: 18px; }

/* ---------- 7. Herramienta ---------- */
.tool-hero { margin-bottom: 1.1rem; }
.tool-hero h1 { display: flex; align-items: center; gap: .8rem; }
.tool-hero h1 .ico { width: 52px; height: 52px; }
.tool-hero .lead { margin-top: .5rem; }

.tool-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: clamp(12px, 2.4vw, 22px);
  min-height: 300px;
}
.st { display: none; }
.tool-card[data-state="idle"] .st-idle,
.tool-card[data-state="work"] .st-work,
.tool-card[data-state="busy"] .st-busy,
.tool-card[data-state="done"] .st-done,
.tool-card[data-state="error"] .st-error { display: block; }
.tool-card.keep-rendered[data-state="busy"] .st-work {
  display: block; position: absolute; left: -30000px; top: 0; width: calc(100% - 44px); pointer-events: none;
}
.noscript { padding: 1rem; background: var(--sun-50); border-radius: 10px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem;
  min-height: 260px; padding: 2rem 1rem; text-align: center; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--c, var(--pine)) 45%, var(--line-2));
  border-radius: calc(var(--radius-lg) - 6px);
  background: color-mix(in srgb, var(--c, var(--pine)) 5%, var(--surface));
  transition: background-color .2s, border-color .2s, transform .2s var(--ease-out);
}
.dropzone:hover, .dropzone.is-over { background: color-mix(in srgb, var(--c, var(--pine)) 11%, var(--surface)); border-color: var(--c, var(--pine)); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone > svg { width: 54px; height: 54px; color: var(--c, var(--pine)); }
.dz-title { font-size: clamp(1.1rem, 1rem + .6vw, 1.4rem); font-weight: 750; }
.dz-sub { color: var(--muted); font-size: .95rem; }
.dropzone .btn { margin-top: .4rem; background: var(--c, var(--pine)); box-shadow: none; }
.dz-limits { margin-top: .8rem; text-align: center; font-size: .85rem; color: var(--muted); }
.privacy-badge {
  display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: .9rem;
  font-size: .9rem; color: var(--ink-2); text-align: center;
}
.privacy-badge svg { width: 18px; height: 18px; color: var(--pine); flex: none; }

.work-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.work-title { font-weight: 700; margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.work-body { display: grid; gap: 1.2rem; }
.workspace {
  min-width: 0; min-height: 200px; padding: 12px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.options { display: flex; flex-direction: column; gap: 1rem; }
.options .btn-xl { margin-top: .3rem; background: var(--c, var(--pine)); box-shadow: 0 8px 22px color-mix(in srgb, var(--c, var(--pine)) 35%, transparent); }
.options .btn-xl:hover { filter: brightness(1.07); }
.tip { font-size: .88rem; color: var(--muted); }
.warn { font-size: .88rem; padding: .7rem .85rem; border-radius: 10px; background: var(--danger-50); color: var(--danger); }
.notice {
  display: flex; gap: .6rem; font-size: .85rem; line-height: 1.5; color: var(--ink-2);
  padding: .75rem .85rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
}
.notice svg { width: 18px; height: 18px; flex: none; color: var(--muted); margin-top: 1px; }

/* Controles de formulario */
.field { display: flex; flex-direction: column; gap: .4rem; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-size: .85rem; font-weight: 700; color: var(--ink-2); padding: 0; }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%; min-height: 44px; padding: .5rem .75rem; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--c, var(--pine)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--pine)) 20%, transparent); }
.field .hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.row { display: flex; gap: .6rem; align-items: flex-end; }
.row > * { flex: 1; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 42px; padding: .4rem .7rem;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  font-size: .88rem; font-weight: 600; cursor: pointer; text-align: center; transition: all .15s;
}
.seg input:checked + span { border-color: var(--c, var(--pine)); background: color-mix(in srgb, var(--c, var(--pine)) 10%, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1px var(--c, var(--pine)); }
.seg input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }
.seg.stack { flex-direction: column; }
.seg.stack span { justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start; padding: .6rem .8rem; }
.seg.stack small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.posgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 220px; }
.posgrid span { min-height: 38px; padding: 0; }
.check { display: flex; align-items: flex-start; gap: .6rem; font-size: .92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--c, var(--pine)); margin-top: 1px; flex: none; }
.range { display: flex; align-items: center; gap: .7rem; }
.range input { flex: 1; accent-color: var(--c, var(--pine)); }
.range output { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; font-size: .88rem; font-weight: 700; }
input[type="color"] { width: 48px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 3px; cursor: pointer; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Miniaturas */
.thumbs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.thumb-item {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.thumb-item.is-sel { border-color: var(--c, var(--pine)); box-shadow: 0 0 0 2px var(--c, var(--pine)); }
.thumb-item.is-dragging { opacity: .45; }
.thumb-item.is-off { opacity: .35; }
.sortable .thumb-item { cursor: grab; }
.thumb-box { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 6px; background: var(--surface-2); }
.thumb-box canvas, .thumb-box img { width: auto; height: auto; max-width: 100%; max-height: 100%;box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; transition: transform .25s var(--ease-out); object-fit: contain; }
.thumb-cap { font-size: .78rem; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-name { font-size: .8rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-tools { display: flex; justify-content: center; gap: 4px; }
.tbtn {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.tbtn:hover { color: var(--c, var(--pine)); border-color: var(--c, var(--pine)); }
.tbtn svg { width: 16px; height: 16px; }
.handle { position: absolute; top: 10px; left: 10px; z-index: 2; touch-action: none; cursor: grab; background: var(--surface); border-radius: 7px; box-shadow: var(--shadow); }
.sel-mark { position: absolute; top: 10px; right: 10px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; background: var(--c, var(--pine)); color: #fff; display: none; place-items: center; }
.sel-mark svg { width: 14px; height: 14px; }
.thumb-item.is-sel .sel-mark { display: grid; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line-2); border-top-color: var(--c, var(--pine)); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Vista previa grande (marca de agua, números, Word, Excel) */
.preview-stage { position: relative; margin-inline: auto; width: fit-content; max-width: 100%; }
.preview-stage canvas { max-width: 100%; height: auto; box-shadow: 0 2px 10px rgba(0,0,0,.18); background: #fff; }
.preview-nav { display: flex; justify-content: center; align-items: center; gap: .6rem; margin-top: .7rem; font-size: .88rem; color: var(--muted); }
.docx-host { max-height: 70vh; overflow: auto; border-radius: 10px; background: #e9e7e0; }
.docx-host .docx-wrapper { padding: 20px !important; background: #e9e7e0 !important; }
.docx-host.fit .docx-wrapper { zoom: var(--z, 1); }
.docx-host .docx-wrapper > section.docx { box-shadow: 0 2px 10px rgba(0,0,0,.2) !important; margin-bottom: 20px !important; }
.docx-host .mm-wrapper { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.docx-host.fit .mm-wrapper { zoom: var(--z, 1); }
.mm-page { width: 794px; min-height: 1123px; padding: 76px 83px; background: #fff; color: #111; box-shadow: 0 2px 10px rgba(0,0,0,.2); font-family: Calibri, Carlito, Arial, sans-serif; font-size: 14.6px; line-height: 1.35; }
.mm-page p { margin: 0 0 10px; }
.mm-page table { border-collapse: collapse; margin: 8px 0; }
.mm-page td, .mm-page th { border: 1px solid #999; padding: 4px 6px; }
.mm-page img { max-width: 100%; }
.docx-host.capturing .docx-wrapper, .docx-host.capturing .mm-wrapper { zoom: 1 !important; }
.sheet-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.sheet-tabs button { padding: .35rem .8rem; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.sheet-tabs button[aria-selected="true"] { border-color: var(--c); color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.sheet-preview { overflow: auto; max-height: 60vh; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.sheet-preview table { border-collapse: collapse; font-size: .8rem; color: #111; }
.sheet-preview td, .sheet-preview th { border: 1px solid #ddd; padding: 3px 8px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.sheet-preview th { background: #f1f4f2; position: sticky; top: 0; }
.sheet-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.sheet-list .check small { color: var(--muted); }
.file-info { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.file-info .thumb-box { width: 140px; flex: none; }
.file-info dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; font-size: .92rem; }
.file-info dt { color: var(--muted); }
.file-info dd { font-weight: 650; overflow-wrap: anywhere; }

/* Firma */
.sign-pages { display: grid; gap: 18px; max-height: 75vh; overflow: auto; padding: 6px; }
.sign-page { position: relative; margin-inline: auto; width: 100%; max-width: 820px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.sign-page canvas { width: 100%; height: auto; }
.sign-page .pno { position: absolute; left: 8px; top: 8px; font-size: .75rem; background: rgba(17,32,28,.75); color: #fff; padding: .1rem .45rem; border-radius: 6px; }
.sign-page.is-armed { cursor: copy; outline: 2px dashed var(--c); outline-offset: 3px; }
.placed { position: absolute; touch-action: none; cursor: move; border: 1.5px dashed var(--c); border-radius: 4px; }
.placed img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.placed .p-del, .placed .p-rs { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow); }
.placed .p-del { top: -13px; right: -13px; }
.placed .p-rs { bottom: -13px; right: -13px; cursor: nwse-resize; touch-action: none; }
.placed svg { width: 14px; height: 14px; }
.sigpad-wrap { position: relative; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.sigpad { width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.sigpad-wrap .baseline { position: absolute; left: 8%; right: 8%; bottom: 34px; border-bottom: 1px solid #ddd; pointer-events: none; }
.sigpad-wrap .hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: .75rem; color: #999; pointer-events: none; }
.swatches { display: flex; gap: 6px; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--sw); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--c); }
.sig-current { display: flex; align-items: center; gap: .8rem; padding: .6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sig-current img { width: 120px; height: 50px; object-fit: contain; background: #fff; border-radius: 6px; }

/* Progreso / resultado */
.st-busy { padding: 3rem 1rem; text-align: center; }
.busy-label { font-weight: 700; font-size: 1.1rem; }
.progress { height: 12px; max-width: 520px; margin: 1.2rem auto .8rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--c, var(--pine)), color-mix(in srgb, var(--c, var(--pine)) 60%, var(--sun))); border-radius: inherit; transition: width .25s ease; }
.busy-sub { font-size: .88rem; color: var(--muted); }
.st-done { text-align: center; padding: 1.5rem .5rem 1rem; }
.done-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--pine-50); color: var(--pine); }
.done-icon svg { width: 34px; height: 34px; }
.done-title { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.done-info { color: var(--ink-2); margin-top: .4rem; }
.done-stats { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1rem; margin-top: .8rem; padding: .6rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 650; }
.done-stats .good { color: var(--pine-600); }
.done-actions { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-top: 1.4rem; }
.done-actions .btn-xl { max-width: 380px; background: var(--c, var(--pine)); }
.ad-gap { height: 36px; }
.ad-gap + .ad-label { font-size: .72rem; color: var(--muted); margin-bottom: 6px; }
.next-steps { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.next-steps h3 { margin-bottom: .9rem; }
.next-steps .related-grid { text-align: left; }
.st-error { text-align: center; padding: 2.5rem 1rem; }
.st-error .ico { margin: 0 auto 1rem; background: var(--danger); }
.error-msg { max-width: 56ch; margin: 0 auto 1.2rem; color: var(--ink-2); }
.error-msg strong { color: var(--ink); display: block; font-size: 1.1rem; margin-bottom: .3rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 90; max-width: min(520px, 92vw);
  background: var(--ink); color: var(--paper); padding: .75rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .92rem;
}

/* ---------- 8. Responsive ---------- */
@media (min-width: 720px) {
  .nav > a.nav-secondary { display: inline-flex; }
  .ad-header { min-height: 90px; }
}
@media (min-width: 960px) {
  .work-body { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .options { position: sticky; top: 84px; }
  .hero { padding-top: 2.4rem; }
}
@media (min-width: 1280px) {
  .page-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .page-aside { display: block; }
  .page-aside .sticky { position: sticky; top: 88px; }
}
@media (max-width: 539px) {
  .mega { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; max-height: calc(100vh - 90px); overflow: auto; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .dropzone { min-height: 220px; }
}
@media print { .site-header, .ad-slot, .ad-header-wrap, .site-footer, .cookie-banner { display: none !important; } }
