.ed-main { max-width: 1000px; }
.ed-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.ed-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.ed-bar b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.ed-bar .spacer { flex: 1; }
.ed-btn { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 7px 12px; font: inherit; font-size: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.ed-btn:hover { border-color: var(--accent); }
.ed-btn.on { background: var(--accent-soft); border-color: var(--accent); }
.ed-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.ed-primary:hover { filter: brightness(1.1); }
.ed-btn:disabled { opacity: .5; cursor: progress; }
.ed-select { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 7px 8px; font: inherit; font-size: 14px; }
.ed-ask { display: flex; gap: 8px; margin-top: 10px; }
.ed-ask input { flex: 1; min-width: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; padding: 10px 14px; font: inherit; outline: none; }
.ed-ask input:focus { border-color: var(--accent); }
.ed-status { min-height: 20px; margin: 8px 2px; color: var(--muted); font-size: 14px; }
.ed-status.err { color: #e5484d; }

/* Documento (Word, texto) */
.ed-doc { background: #fff; color: #111; border-radius: 6px; padding: 56px 64px; min-height: 70vh; box-shadow: 0 6px 24px rgba(0,0,0,.25); font: 16px/1.6 Georgia, "Times New Roman", serif; outline: none; }
.ed-doc table { border-collapse: collapse; } .ed-doc td, .ed-doc th { border: 1px solid #bbb; padding: 4px 8px; }

/* Hoja de cálculo */
.ed-sheet-wrap { overflow: auto; max-height: 75vh; border: 1px solid var(--border); border-radius: 10px; }
.ed-sheet { border-collapse: collapse; background: var(--surface); font-size: 14px; }
.ed-sheet td, .ed-sheet th { border: 1px solid var(--border); min-width: 90px; padding: 5px 8px; }
.ed-sheet th { background: var(--bg); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
.ed-sheet td:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* PDF: páginas con capa de respuestas encima */
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ed-page { position: relative; box-shadow: 0 6px 24px rgba(0,0,0,.3); background: #fff; }
.ed-page img { display: block; width: 100%; height: auto; }
.ed-page.adding { cursor: text; }
.ed-box { position: absolute; min-width: 40px; border: 1px dashed rgba(124,92,255,.7); background: rgba(124,92,255,.08); color: #0b1a6e; font-family: Helvetica, Arial, sans-serif; padding: 0 2px; outline: none; white-space: pre-wrap; line-height: 1.15; border-radius: 3px; }
.ed-box:focus { border-style: solid; background: rgba(124,92,255,.15); }
.ed-box.filled { animation: ed-pop .4s ease; }
@keyframes ed-pop { from { background: rgba(124,92,255,.45); } to { background: rgba(124,92,255,.08); } }
@media (prefers-reduced-motion: reduce) { .ed-box.filled { animation: none; } }
@media (max-width: 600px) { .ed-doc { padding: 24px 18px; } }

/* ===== Editor PDF estilo Acrobat ===== */
.ed-main:has(.pdfx) { max-width: none; }
.pdfx { display: grid; grid-template-columns: 132px 52px 1fr; gap: 12px; align-items: start; }
.pdfx-thumbs { position: sticky; top: 70px; max-height: calc(100vh - 150px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; scrollbar-width: thin; }
.pdfx-thumb { position: relative; border-radius: 8px; transition: transform .2s; }
.pdfx-thumb img { width: 100%; display: block; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.25); cursor: pointer; transition: transform .25s, opacity .2s; background: #fff; }
.pdfx-thumb:hover img { outline: 2px solid var(--accent); }
.pdfx-thumb > span { display: block; text-align: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.pdfx-thumb-acts { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.pdfx-thumb:hover .pdfx-thumb-acts { opacity: 1; }
.pdfx-thumb-acts button { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: rgba(20,20,28,.85); color: #fff; cursor: pointer; }
.pdfx-thumb-acts button:hover { background: var(--accent); }
.pdfx-thumb.pdfx-deleted img { opacity: .25; }
.pdfx-tools { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.pdfx-tool { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.pdfx-tool:hover { background: var(--accent-soft); transform: translateY(-1px); }
.pdfx-tool.on { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(124,92,255,.45); }
.pdfx-sep { width: 22px; height: 1px; background: var(--border); margin: 2px auto; display: inline-block; }
.pdfx-stage { position: relative; min-width: 0; }
.pdfx-zoom { position: sticky; top: 70px; z-index: 4; display: flex; align-items: center; gap: 4px; width: max-content; margin: 0 0 10px auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.pdfx-zoom button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 17px; cursor: pointer; }
.pdfx-zoom button:hover { background: var(--accent-soft); }
.pdfx-zoom span { min-width: 46px; text-align: center; font-size: 13px; color: var(--muted); }
.pdfx .ed-pages { gap: 22px; padding-bottom: 40px; }
.pdfx .ed-page { border-radius: 4px; transition: transform .3s ease, opacity .2s; animation: pdfx-in .4s ease backwards; }
@keyframes pdfx-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ed-page.pdfx-deleted { opacity: .25; filter: grayscale(1); }
.pdfx-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pdfx-ink path { fill: none; stroke: #0b1a6e; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pdfx-layer { position: absolute; inset: 0; }
.ed-page[data-tool="text"] .pdfx-layer { cursor: text; }
.ed-page[data-tool="highlight"] .pdfx-layer, .ed-page[data-tool="whiteout"] .pdfx-layer { cursor: crosshair; }
.ed-page[data-tool="draw"] .pdfx-layer { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='3' fill='%230b1a6e'/%3E%3C/svg%3E") 10 10, crosshair; touch-action: none; }
.pdfx-mark { position: absolute; pointer-events: none; border-radius: 2px; }
.pdfx-highlight { background: rgba(255, 220, 40, .42); mix-blend-mode: multiply; }
.pdfx-whiteout { background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.pdfx-image { background: center / contain no-repeat; outline: 1px dashed rgba(124,92,255,.5); }
.pdfx-dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.pdfx-dialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.pdfx-dialog h3 { margin: 0 0 10px; }
.pdfx-dialog canvas { display: block; width: min(520px, 80vw); height: auto; aspect-ratio: 520 / 180; background: #fff; border-radius: 12px; touch-action: none; cursor: crosshair; }
.pdfx-dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
/* Barra de formato del documento */
.ed-fmt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.ed-fmt button { min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.ed-fmt button:hover { background: var(--accent-soft); }
.ed-fmt .pdfx-sep { width: 1px; height: 20px; margin: 0 4px; }
.ed-bar { box-shadow: 0 6px 20px rgba(0,0,0,.15); }
@media (max-width: 760px) { .pdfx { grid-template-columns: 1fr; } .pdfx-thumbs { display: none; } .pdfx-tools { flex-direction: row; flex-wrap: wrap; position: static; } }
@media (prefers-reduced-motion: reduce) { .pdfx .ed-page { animation: none; } }

.pdfx .ed-page { user-select: none; -webkit-user-select: none; }
.pdfx .ed-page .ed-box { user-select: text; -webkit-user-select: text; }
.pdfx-circle { border: 2px solid #e5194a; border-radius: 50%; transform: scale(1.25); }
.pdfx-circle.filled { animation: ed-pop .5s ease; }
.ed-answer { font-size: 15px; padding: 8px 16px; box-shadow: 0 4px 14px rgba(124,92,255,.45); }

/* ===== Diseño sobrio (sin emojis ni adornos) ===== */
.cv-top { padding: 18px 24px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.cv-top h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.cv-sub { font-size: 12px; letter-spacing: .02em; }
.ed-bar { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: 8px 0 12px; }
.ed-bar b { font-weight: 600; font-size: 15px; }
.ed-btn { border-radius: 8px; font-weight: 500; }
.ed-primary, .ed-answer { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; font-weight: 600; }
.ed-primary:hover, .ed-answer:hover { filter: none; opacity: .88; }
.ed-ask input { border-radius: 8px; background: transparent; }
.pdfx-tools, .pdfx-thumbs, .pdfx-zoom { box-shadow: none; border-radius: 12px; }
.pdfx-tool.on { background: var(--text); color: var(--bg); box-shadow: none; }

/* Barra de progreso con tiempo estimado */
.ed-progress { display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; font-size: 13px; color: var(--muted); }
.ed-progress-bar { flex: 1; height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.ed-progress-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .5s ease; }
.ed-progress span { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Barras de desplazamiento finas y discretas (nada de barras blancas) */
* { scrollbar-width: thin; scrollbar-color: rgba(127,127,127,.35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(127,127,127,.32); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(127,127,127,.55); }

/* Mover, cambiar tamaño y formato */
.ed-page:not([data-tool]) .pdfx-mark, .ed-page[data-tool="select"] .pdfx-mark { pointer-events: auto; cursor: move; }
.pdfx-mark.pdfx-sel, .ed-box.pdfx-sel { outline: 2px solid #7c5cff; outline-offset: 1px; }
.pdfx-hud { position: absolute; z-index: 5; pointer-events: none; }
.pdfx-mv { position: absolute; left: -2px; right: -2px; top: -16px; height: 14px; border-radius: 6px 6px 0 0; background: #7c5cff; cursor: move; pointer-events: auto; }
.pdfx-mv::after { content: "⠿"; position: absolute; left: 50%; top: -3px; translate: -50% 0; color: #fff; font-size: 13px; }
.pdfx-rs { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #7c5cff; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.pdfx-x { position: absolute; right: -10px; top: -26px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #e5194a; color: #fff; font: 700 14px/20px system-ui; cursor: pointer; pointer-events: auto; padding: 0; }
.pdfx-fbar { position: absolute; left: -2px; top: -50px; display: flex; gap: 3px; align-items: center; padding: 4px; border-radius: 10px; background: var(--surface, #1c1c22); border: 1px solid var(--border, #333); box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: auto; white-space: nowrap; }
.pdfx-fbar[hidden] { display: none; }
.pdfx-fbar select, .pdfx-fbar button { height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--text, #eee); font: 12px system-ui; cursor: pointer; padding: 0 6px; }
.pdfx-fbar button:hover, .pdfx-fbar button.on { background: var(--accent-soft, rgba(124,92,255,.2)); }
.pdfx-fbar .pdfx-sw { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid #fff3; }
.pdfx-replace { position: absolute; left: 0; top: -52px; min-height: 28px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: 12px system-ui; cursor: pointer; pointer-events: auto; white-space: nowrap; }
.pdfx-replace[hidden] { display: none; }
.cv-image-size { flex: 1 0 100%; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.cv-image-size select { min-height: 36px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.pdfx-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.pdfx-tabs button { flex: 1; height: 32px; border: 1px solid var(--border, #333); border-radius: 8px; background: transparent; color: var(--text, #eee); cursor: pointer; font: inherit; }
.pdfx-tabs button.on { background: var(--accent-soft, rgba(124,92,255,.2)); border-color: #7c5cff; }
.pdfx-signame { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--border, #333); background: var(--bg, #111); color: var(--text, #eee); padding: 0 12px; font: 16px inherit; box-sizing: border-box; }
.pdfx-sigstyles, .pdfx-siglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; max-height: 260px; overflow: auto; }
.pdfx-sigitem { position: relative; }
.pdfx-sigopt { width: 100%; padding: 6px; border-radius: 10px; border: 2px solid transparent; background: #fff; cursor: pointer; }
.pdfx-sigopt.on { border-color: #7c5cff; }
.pdfx-sigopt img { width: 100%; height: 56px; object-fit: contain; display: block; }
.pdfx-sigdel { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #e5194a; color: #fff; cursor: pointer; }
.pdfx-sigmsg { grid-column: 1 / -1; color: var(--muted, #999); font-size: 14px; }
.pdfx-sigsave { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; }
.pdfx-stamps { display: flex; flex-wrap: wrap; gap: 6px; }
.pdfx-tool.act { color: var(--accent); background: var(--accent-soft); position: relative; }
.pdfx-tool[data-n]::after { content: attr(data-n); position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; border-radius: 7px; background: var(--accent); color: #fff; font: 700 9px/14px system-ui; text-align: center; }
/* Imagen propia del PDF seleccionada para reemplazarla (r10) */
.pdfx-mark.pdfx-pdfimage { pointer-events: none !important; outline: 2px dashed #7c5cff; outline-offset: -2px; background: center / 100% 100% no-repeat; }
.pdfx-hud.is-pdfimage .pdfx-replace { top: 8px; left: 8px; font-weight: 600; }
.pdfx-hud.is-pdfimage .pdfx-mv, .pdfx-hud.is-pdfimage .pdfx-rs { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999; padding: 10px 16px; border-radius: 14px; background: rgba(44,44,46,.96); color: #fff; font: 14px system-ui; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.toast.error { background: #d92d3a; }
