
:root{
  --bg:#f4f7fb;
  --card:#fff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#dbe4ef;
  --primary:#ec1f31;
  --shadow:0 12px 34px rgba(15,23,42,.08);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--text);
  background:var(--bg);
}
button,input{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}
.view{min-height:100vh}

/* Inicio */
.upload-view{
  min-height:100vh;
  padding:24px 42px 50px;
  display:flex;
  flex-direction:column;
}
.home-brand{
  width:min(1500px,100%);
  margin:0 auto 10px;
  display:flex;
  align-items:center;
  gap:10px;
}
.brand-mark{
  width:42px;height:42px;border-radius:12px;
  display:grid;place-items:center;
  background:linear-gradient(145deg,#ff4350,#d80f21);
  color:#fff;font-weight:950;
  box-shadow:0 8px 20px rgba(236,31,49,.20);
}
.brand-mark.small{width:36px;height:36px;border-radius:10px;font-size:13px}
.home-brand>div,.editor-brand>div{display:flex;flex-direction:column;line-height:1.05}
.home-brand strong,.editor-brand strong{font-size:17px}
.home-brand small,.editor-brand small{font-size:11px;color:var(--muted);margin-top:4px}

.hero{
  width:min(1500px,100%);
  margin:auto;
  text-align:center;
}
.eyebrow{
  color:var(--primary);
  font-size:12px;
  font-weight:950;
  letter-spacing:.17em;
}
.hero h1{
  max-width:980px;
  margin:10px auto;
  font-size:clamp(35px,4vw,56px);
  line-height:1.04;
  letter-spacing:-.04em;
}
.hero-copy{
  max-width:850px;
  margin:0 auto 24px;
  color:#475569;
  font-size:18px;
  line-height:1.5;
}
.primary-btn,.generate-btn{
  border:0;color:#fff;
  background:linear-gradient(135deg,#f12c3c,#dc1224);
  box-shadow:0 12px 27px rgba(236,31,49,.22);
  font-weight:900;border-radius:13px;
}
.primary-btn{padding:16px 25px;font-size:17px}
.primary-btn:hover,.generate-btn:hover{transform:translateY(-1px);filter:brightness(.98)}
.format-note{margin:9px 0 18px;color:#8693a6;font-size:12px}
.drop-zone{
  min-height:300px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:30px;background:#fff;border:2px dashed #c7d3e2;border-radius:24px;
  box-shadow:var(--shadow);transition:.18s ease;outline:none;
}
.drop-zone:hover,.drop-zone.dragover,.drop-zone:focus{
  border-color:var(--primary);background:#fffafb;transform:translateY(-1px)
}
.drop-icons{display:flex;gap:8px;margin-bottom:17px}
.drop-icons span{
  min-width:54px;height:54px;padding:0 10px;border-radius:16px;
  display:grid;place-items:center;background:#fff0f2;color:var(--primary);
  font-size:12px;font-weight:950;
}
.drop-icons span:nth-child(2){background:#eef6ff;color:#2563eb}
.drop-icons span:nth-child(3){background:#eef5ff;color:#1d4ed8;font-size:19px}
.drop-zone h2{font-size:27px;margin:0 0 6px}
.drop-zone>p{margin:0;color:var(--muted)}
.drop-meta{display:flex;gap:9px;margin-top:23px;color:#7c8ba0;font-size:12px}
.local-note{
  max-width:920px;margin:18px auto 0;padding:14px 17px;text-align:left;
  display:flex;gap:12px;border:1px solid #d8eee3;background:#f0faf5;border-radius:16px;
}
.check{
  width:31px;height:31px;flex:0 0 auto;display:grid;place-items:center;
  border-radius:50%;background:#1aa368;color:#fff;font-weight:950;
}
.local-note strong{color:#145f3c}
.local-note p{margin:3px 0 0;font-size:13px;color:#4f6f5f;line-height:1.45}

/* Editor sin barras fijas */
.editor-view{
  min-height:100vh;
  padding:14px 36px 42px;
}
.editor-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:9px;
}
.editor-brand{display:flex;align-items:center;gap:9px;min-width:180px}
.toolbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.tool-btn{
  border:1px solid #d8e2ee;
  background:#fff;color:#203047;border-radius:10px;
  padding:10px 13px;font-size:12px;font-weight:900;
}
.tool-btn:hover{border-color:#aebfd2;background:#f8fafc}
.delete-mode-btn.active{
  background:#d7192d;color:#fff;border-color:#d7192d;
  box-shadow:0 6px 18px rgba(215,25,45,.20);
}
.rotate-mode-btn.active{
  background:#173b72;color:#fff;border-color:#173b72;
  box-shadow:0 6px 18px rgba(23,59,114,.18);
}
.content-mode-btn.active{
  background:#5b21b6;color:#fff;border-color:#5b21b6;
  box-shadow:0 6px 18px rgba(91,33,182,.18);
}
.generate-btn{
  padding:11px 17px;
  min-width:185px;
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  font-size:12px;
}
.mode-hint{
  margin:0 0 10px;
  padding:8px 11px;
  border-radius:10px;
  background:#eef3f8;
  color:#64748b;
  font-size:11px;
}
.mode-hint.delete-active{
  background:#fff0f2;
  color:#a51427;
  border:1px solid #f5c4ca;
}
.mode-hint.rotate-active{
  background:#eef5ff;
  color:#173b72;
  border:1px solid #bfd4f4;
}
.mode-hint.content-active{
  background:#f5f0ff;
  color:#5b21b6;
  border:1px solid #d7c5f7;
}

/* Archivos cargados: banda muy compacta */
.source-strip{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.source-chip{
  --source:#e31b2b;
  min-width:0;
  max-width:360px;
  display:flex;
  align-items:center;
  gap:7px;
  padding:7px 8px 7px 10px;
  border:1px solid color-mix(in srgb,var(--source) 32%,#dbe4ef);
  border-left:5px solid var(--source);
  background:color-mix(in srgb,var(--source) 5%,white);
  border-radius:10px;
}
.source-type{
  font-size:9px;font-weight:950;color:var(--source);
  background:color-mix(in srgb,var(--source) 12%,white);
  border-radius:7px;padding:5px 6px;flex:0 0 auto;
}
.source-name{
  min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-size:11px;font-weight:850;color:#223149;flex:1;
}
.source-count{font-size:9px;color:#718097;white-space:nowrap}
.source-icon-btn{
  width:28px;height:28px;border:1px solid #d7e0eb;background:#fff;
  color:#32435b;border-radius:7px;display:grid;place-items:center;
  font-size:12px;font-weight:950;flex:0 0 auto;
}
.source-icon-btn:hover{border-color:var(--source);color:var(--source)}

/* Todas las páginas comparten una sola cuadrícula */
.pages-stream{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(145px,1fr));
  gap:10px;
  align-items:start;
}
.page-card{
  --source:#e31b2b;
  position:relative;
  min-width:0;
  padding:8px;
  border:1px solid #dfe7f0;
  border-top:5px solid var(--source);
  border-radius:13px;
  background:color-mix(in srgb,var(--source) 3.5%,#f3f6fa);
  transition:.16s ease;
}
.page-card:hover{transform:translateY(-1px);box-shadow:0 7px 18px rgba(15,23,42,.08)}
.page-card.file-start::before{
  content:attr(data-source-label);
  position:absolute;top:4px;left:8px;z-index:7;
  max-width:calc(100% - 16px);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  padding:3px 6px;border-radius:6px;
  background:var(--source);color:#fff;
  font-size:8px;font-weight:950;
  box-shadow:0 3px 8px rgba(15,23,42,.12);
}
.canvas-wrap{
  position:relative;
  aspect-ratio:1/1.414;
  background:#fff;border:1px solid #d6e0eb;border-radius:7px;
  overflow:hidden;display:flex;align-items:center;justify-content:center;
  cursor:pointer;user-select:none;
}
.canvas-wrap:hover{outline:2px solid color-mix(in srgb,var(--source) 28%,transparent)}
.canvas-wrap canvas{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}
.deleted-overlay{
  position:absolute;inset:0;display:none;z-index:5;
  flex-direction:column;align-items:center;justify-content:center;gap:3px;
  background:rgba(202,18,40,.80);color:#fff;text-align:center;
}
.page-card.deleted .deleted-overlay{display:flex}
.deleted-overlay .big-x{font-size:48px;line-height:.8;font-weight:300}
.deleted-overlay strong{font-size:12px;letter-spacing:.08em}
.deleted-overlay small{font-size:9px;opacity:.9}
.page-caption{
  margin-top:6px;display:flex;align-items:center;justify-content:space-between;
  gap:5px;font-size:10px;font-weight:900;color:#1d2c42;
}
.page-source-dot{
  width:7px;height:7px;border-radius:50%;background:var(--source);display:inline-block;margin-right:4px
}
.rotation-label{color:#6a7a91}
.page-actions{display:grid;grid-template-columns:1fr 1fr 1fr;gap:5px;margin-top:5px}
.page-action{
  min-height:29px;border-radius:7px;border:1px solid transparent;
  font-size:9px;font-weight:900;
}
.page-action.rotate-content{background:#5b21b6;color:#fff}
.page-action.rotate-content:hover{background:#4c1d95}
.page-action.rotate-page{background:#162238;color:#fff}
.page-action.rotate-page:hover{background:#0f172a}
.page-action.delete{background:#fff;color:#d31b31;border-color:#f2b8c0}
.page-action.delete:hover,.page-card.deleted .page-action.delete{
  background:#d31b31;color:#fff;border-color:#d31b31;
}

/* Vista previa */
.preview-modal{
  position:fixed;inset:0;z-index:300;
  display:grid;place-items:center;
  padding:18px;
  background:rgba(8,15,28,.72);
  backdrop-filter:blur(5px);
}
.preview-shell{
  width:min(980px,92vw);
  height:min(86vh,820px);
  background:#fff;border-radius:16px;overflow:hidden;
  box-shadow:0 28px 80px rgba(0,0,0,.34);
  display:flex;flex-direction:column;
}
.preview-head{
  min-height:58px;padding:11px 14px 11px 18px;
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  border-bottom:1px solid #dce4ee;
}
.preview-head>div{min-width:0;display:flex;flex-direction:column}
.preview-head strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.preview-head small{font-size:10px;color:#718096;margin-top:3px}
.close-preview{
  width:36px;height:36px;border:0;border-radius:9px;
  background:#f1f5f9;color:#26364c;font-size:25px;line-height:1;
}
.close-preview:hover{background:#e2e8f0}
.preview-stage{
  position:relative;
  flex:1;
  min-height:0;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:#e8edf4;
}
.preview-stage canvas{
  display:block;
  background:#fff;
  box-shadow:0 12px 35px rgba(15,23,42,.18);
}
.preview-deleted{
  position:absolute;top:18px;right:18px;
  padding:8px 12px;border-radius:8px;background:#c91c31;color:#fff;
  font-size:11px;font-weight:950;letter-spacing:.06em;
}

/* DOCX temporal */
.word-stage{
  position:fixed;left:-12000px;top:0;width:1200px;min-height:1000px;
  pointer-events:none;z-index:-100;background:#fff;
}

/* Carga y avisos */
.busy-overlay{
  position:fixed;inset:0;z-index:400;display:grid;place-items:center;
  background:rgba(245,247,251,.78);backdrop-filter:blur(5px);
}
.busy-card{
  min-width:280px;border:1px solid #dbe4ef;background:#fff;border-radius:18px;
  box-shadow:0 20px 55px rgba(15,23,42,.16);padding:24px;text-align:center;
}
.busy-card strong{display:block;margin-top:12px}
.busy-card small{display:block;margin-top:4px;color:#748398}
.spinner{
  width:34px;height:34px;margin:auto;border:4px solid #edf1f6;border-top-color:var(--primary);
  border-radius:50%;animation:spin .8s linear infinite
}
@keyframes spin{to{transform:rotate(360deg)}}
.toast{
  position:fixed;top:18px;left:50%;transform:translate(-50%,-14px);
  opacity:0;pointer-events:none;z-index:500;
  background:#111827;color:#fff;border-radius:11px;padding:11px 14px;
  font-size:12px;font-weight:800;box-shadow:0 12px 30px rgba(0,0,0,.2);
  transition:.18s ease;
}
.toast.show{opacity:1;transform:translate(-50%,0)}

@media(max-width:900px){
  .editor-view{padding:12px 18px 34px}
  .editor-toolbar{align-items:flex-start;flex-direction:column}
  .toolbar-actions{width:100%;justify-content:flex-start}
  .generate-btn{margin-left:auto}
}

/* ================================================================
   V18 · Barra organizada, optimización progresiva y panel flotante
   ================================================================ */
html,body{max-width:100%;overflow-x:hidden}
.editor-topbar-inner{gap:14px!important}
.editor-primary-actions{gap:8px!important}
.header-search-btn{
  min-height:42px;padding:0 13px;display:flex;align-items:center;gap:7px;
  border:1px solid #d8e2ee;border-radius:12px;color:#26364c;background:#fff;
  font-size:11px;font-weight:900;white-space:nowrap
}
.header-search-btn:hover{border-color:#9eb8e8;color:#155bdd;background:#f7faff}
.header-search-btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

.editor-toolbar{position:relative!important;top:auto!important;overflow:visible!important}
.commandbar{
  width:100%!important;min-height:0!important;margin:0!important;padding:7px 12px!important;
  display:flex!important;flex-wrap:wrap!important;align-items:stretch!important;justify-content:center!important;
  gap:5px!important;overflow:visible!important;scrollbar-width:none!important
}
.commandbar::-webkit-scrollbar{display:none!important}
.command-group{
  min-width:0!important;min-height:76px!important;height:auto!important;padding:2px 7px 4px!important;
  flex:0 1 auto!important;display:flex!important;justify-content:flex-start!important;
  border:0!important;border-right:1px solid #e3e9f0!important;gap:1px!important
}
.command-group:last-child{border-right:0!important}
.command-group>.toolbar-label,.toolbar-label{height:13px!important;min-height:13px!important;line-height:13px!important;margin:0 0 2px!important;font-size:7.5px!important;letter-spacing:.15em!important}
.command-buttons{min-height:58px!important;height:auto!important;display:flex!important;align-items:stretch!important;justify-content:center!important;gap:2px!important;flex-wrap:nowrap!important}
.tool-tile{
  min-width:52px!important;width:52px!important;height:58px!important;min-height:58px!important;padding:4px 3px!important;
  display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:2px!important;
  border-radius:9px!important;font-size:8px!important;line-height:1.08!important
}
.tool-tile>span:last-child{font-size:8px!important;font-weight:850!important;line-height:1.08!important}
.tool-glyph{height:22px;display:grid;place-items:center;color:currentColor;font-size:20px!important;line-height:1!important;font-style:normal}
.tool-count{top:2px!important;right:2px!important}
.file-command{min-width:116px!important}.page-command{min-width:224px!important}.edit-command{min-width:535px!important;flex:1 1 535px!important}.document-command{min-width:224px!important}.insert-command{min-width:116px!important}.security-command{min-width:116px!important}
.image-tool-stack{height:58px!important}.image-tool-stack .tool-tile{height:45px!important;min-height:45px!important}.view-images-btn{height:13px!important;min-height:13px!important;line-height:12px!important}

.extract-command{min-width:164px!important}
.extract-control{
  width:150px!important;min-height:58px!important;display:grid!important;grid-template-columns:64px 1fr!important;
  align-items:center!important;justify-items:center!important;gap:5px!important
}
.extract-counter{width:64px!important;height:27px!important}.extract-counter button{width:22px!important;height:27px!important}.extract-counter>span{min-width:20px!important;display:flex!important;flex-direction:column!important;align-items:center!important;line-height:1!important;gap:0!important}.extract-counter b{font-size:11px!important}.extract-counter small{font-size:6px!important}
.extract-groups{width:76px!important;min-height:52px!important;display:grid!important;grid-template-columns:repeat(4,17px)!important;grid-auto-rows:23px!important;gap:3px!important;align-content:center!important;justify-content:center!important}
.extract-groups .extract-btn{width:20px!important;height:20px!important;border-radius:5px!important}.extract-groups .extract-btn b{font-size:9px!important}.extract-groups .extract-btn span{top:-4px!important;right:-4px!important;min-width:12px!important;height:12px!important;padding:0 2px!important;border-width:1px!important;font-size:6px!important}
.extract-empty{grid-column:1/5;color:#94a3b8;font-size:7px;white-space:normal;text-align:center}

.optimization-command{min-width:148px!important}
.optimization-panel{width:135px;min-height:58px;display:grid;grid-template-columns:1fr auto;grid-template-rows:31px 17px;gap:3px 5px;align-items:center}
.optimization-panel>div{display:flex;flex-direction:column;line-height:1.05}.optimization-panel>div small{color:#7b899d;font-size:7px;font-weight:800}.optimization-panel>div b{margin-top:3px;color:#172033;font-size:12px}
.optimization-panel>button{height:30px;padding:0 8px;border:0;border-radius:8px;color:#fff;background:#155bdd;font-size:8px;font-weight:900}.optimization-panel>button:hover{background:#0f49b4}.optimization-panel>button.at-limit{color:#64748b;background:#e7edf5}
.optimization-panel>small{grid-column:1/3;color:#64748b;font-size:7px;font-weight:800;text-align:center}

.pages-workspace{min-height:calc(100vh - 220px)!important;padding-top:10px!important}
.preview-shell{position:relative!important}
.preview-stage canvas{background:#fff}
#annotationCanvas.annotation-canvas{background:transparent!important;box-shadow:none!important}
.preview-footer{position:relative;z-index:72;min-height:51px}
.preview-actions{display:flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;flex-wrap:wrap!important;overflow:visible!important}
.show-tools-btn{min-height:37px;padding:0 13px;border:1px solid #9fbdf3;border-radius:9px;color:#155bdd;background:#edf4ff;font-size:10px;font-weight:900}.show-tools-btn.active{color:#fff;background:#155bdd;border-color:#155bdd}
.preview-tools-panel{
  position:absolute;z-index:70;left:12px;right:12px;bottom:57px;max-height:min(52vh,430px);overflow-y:auto;overflow-x:hidden;
  border:1px solid #d7e1ec;border-radius:15px;background:rgba(255,255,255,.98);box-shadow:0 18px 48px rgba(15,23,42,.24);backdrop-filter:blur(12px)
}
.floating-tools-head{min-height:36px;padding:5px 9px 4px 13px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #e8edf3}.floating-tools-head strong{font-size:11px}.floating-tools-head button{width:28px;height:28px;border:0;border-radius:7px;color:#475569;background:#eef2f7;font-size:18px}
.preview-edit-toolbar{
  padding:7px!important;display:grid!important;grid-template-columns:repeat(11,minmax(54px,1fr))!important;
  align-items:stretch!important;gap:4px!important;overflow:visible!important;border-bottom:1px solid #edf1f5!important;background:#f8fafc!important
}
.preview-edit-toolbar>button{min-width:0!important;width:auto!important;height:43px!important;padding:3px 4px!important;white-space:normal!important;display:flex!important;flex-direction:column!important;gap:1px!important}
.preview-edit-toolbar>button span{display:block!important;font-size:7.5px!important}
.preview-tool-options{max-height:none!important;padding:7px 9px!important;gap:8px!important;overflow:visible!important}
.shape-gallery{width:100%;display:grid;grid-template-columns:repeat(11,minmax(34px,1fr));gap:4px;padding-bottom:6px;border-bottom:1px solid #e8edf3}
.shape-gallery button{height:31px;border:1px solid #d9e2ec;border-radius:7px;color:#334155;background:#fff;font-size:18px;font-weight:800}.shape-gallery button:hover,.shape-gallery button.active{color:#155bdd;border-color:#8fb3f5;background:#edf4ff}
.shape-content-options{width:100%;display:grid;grid-template-columns:auto auto minmax(150px,1fr) auto auto auto auto;gap:5px;align-items:center}
.shape-content-options label{display:flex;align-items:center;gap:4px;color:#64748b;font-size:8px;font-weight:850}.shape-content-options input[type="color"]{width:26px;height:25px;padding:1px;border:1px solid #cbd5e1;border-radius:6px}.shape-content-options input[type="range"]{width:70px}.shape-content-options input[type="text"]{height:29px;padding:5px 8px;border:1px solid #d7e0ea;border-radius:7px;font-size:9px}.shape-content-options button{height:29px;padding:0 8px;border:1px solid #cbd7e5;border-radius:7px;color:#334155;background:#fff;font-size:8px;font-weight:850}.shape-content-options button:hover:not(:disabled){color:#155bdd;border-color:#8fb3f5;background:#f4f8ff}.shape-content-options button:disabled{opacity:.4;cursor:not-allowed}

@media(max-width:1450px){.edit-command{order:8;flex:1 1 100%!important}.command-group{border-right:0!important}.commandbar{justify-content:center!important}}
@media(max-width:900px){.editor-topbar{position:relative!important}.editor-primary-actions{grid-template-columns:1fr 1fr!important}.header-search-btn{min-height:38px;justify-content:center}.header-search-btn span{display:none}.editor-language{grid-column:auto!important}.commandbar{padding:6px!important}.command-group{max-width:100%!important}.edit-command{min-width:100%!important}.edit-command .command-buttons{flex-wrap:wrap!important}.preview-edit-toolbar{grid-template-columns:repeat(4,minmax(58px,1fr))!important}.shape-gallery{grid-template-columns:repeat(6,minmax(34px,1fr))}.shape-content-options{grid-template-columns:1fr 1fr}.shape-content-options input[type="text"]{grid-column:1/3}.preview-actions-label{display:none}.preview-tools-panel{left:6px;right:6px}.preview-actions{gap:3px!important}.preview-action-btn{min-width:75px!important}.show-tools-btn{width:100%}}
@media(max-width:650px){
  .upload-view{padding:18px 13px 36px}
  .hero h1{font-size:35px}
  .hero-copy{font-size:16px}
  .primary-btn{width:100%;font-size:14px}
  .drop-zone{min-height:260px;padding:20px}
  .editor-view{padding:10px 10px 28px}
  .editor-brand{width:100%}
  .toolbar-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .generate-btn{min-width:0;margin:0;grid-column:1/3;width:100%}
  .source-chip{max-width:100%;flex:1 1 100%}
  .pages-stream{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .preview-modal{padding:7px}
  .preview-shell{width:100%;height:96vh}
}

/* ========================================================================== */
/* V16 · EDITOR DIRECTO, BARRA COMPACTA Y HERRAMIENTAS DE PREPARACIÓN         */
/* ========================================================================== */

html,body{max-width:100%;overflow-x:hidden}
body{background:#f6f8fc}
main{min-height:calc(100vh - 46px)}
.editor-view.view{display:block!important;min-height:calc(100vh - 46px);padding:0!important;background:#f6f8fc}
.editor-topbar{position:sticky!important;top:0;z-index:160;background:rgba(255,255,255,.97);border-bottom:1px solid #dde5ef;backdrop-filter:blur(12px)}
.editor-topbar-inner{min-height:68px!important;padding:7px 30px!important;gap:18px}
.editor-logo{width:49px!important;height:55px!important;border-radius:12px!important;box-shadow:0 10px 22px rgba(239,35,60,.2)}
.editor-identity>div>strong{font-size:20px!important;letter-spacing:-.025em}
.editor-identity small{font-size:10px!important;margin-top:3px!important}
.editor-primary-actions{gap:8px!important}
.editor-language{height:42px!important;min-width:150px!important;border-radius:11px!important}
.reset-btn,.generate-btn{height:44px!important;border-radius:11px!important;padding:0 17px!important;font-size:12px!important}
.generate-btn{min-width:145px!important;box-shadow:0 9px 22px rgba(239,35,60,.23)!important}

.editor-toolbar{position:sticky!important;top:68px!important;z-index:150!important;margin:0!important;padding:0!important;border:0!important;border-bottom:1px solid #dfe7f0!important;border-radius:0!important;background:rgba(255,255,255,.98)!important;box-shadow:0 7px 18px rgba(15,23,42,.055)!important}
.commandbar{width:100%!important;min-height:108px!important;padding:6px 22px 7px!important;display:flex!important;justify-content:center!important;align-items:stretch!important;gap:0!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-gutter:stable}
.command-group{min-height:94px!important;padding:4px 12px 3px!important;border-left:1px solid #e2e8f0!important;display:flex!important;flex-direction:column!important;justify-content:flex-start!important;align-items:center!important;gap:3px!important}
.command-group:first-child{border-left:0!important}
.toolbar-label{height:15px!important;margin:0!important;font-size:8.5px!important;line-height:15px!important;letter-spacing:.105em!important;color:#68778c!important}
.command-buttons{display:flex!important;align-items:center!important;justify-content:center!important;gap:4px!important;min-height:68px!important}
.tool-tile{position:relative!important;min-width:66px!important;width:auto!important;height:67px!important;padding:5px 7px!important;border:1px solid transparent!important;border-radius:11px!important;background:transparent!important;color:#172033!important;font-size:9.5px!important;line-height:1.1!important;transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease!important}
.tool-tile:hover:not(:disabled){background:#f4f7fb!important;border-color:#dfe7f1!important;transform:translateY(-1px)!important}
.tool-tile:focus-visible,.mini-add-file:focus-visible,.quality-option:focus-visible,.exact-weight-btn:focus-visible{outline:3px solid rgba(37,99,235,.22)!important;outline-offset:2px!important}
.tool-tile.active{background:#edf4ff!important;border-color:#bed3ff!important;color:#155bdd!important;box-shadow:0 5px 13px rgba(37,99,235,.09)!important}
.tool-tile:disabled,.quality-option:disabled,.extract-counter button:disabled{opacity:.34!important;cursor:not-allowed!important;transform:none!important}
.tool-icon-svg{width:21px!important;height:21px!important;margin-bottom:4px!important;stroke-width:2!important}
.file-command{min-width:136px!important}
.documents-tool{min-width:93px!important;color:#155bdd!important}
.documents-tool.has-documents{background:#edf4ff!important;border-color:#cbdcff!important}
.tool-count{position:absolute;top:4px;right:5px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#155bdd;color:#fff;font-size:8px;line-height:17px;text-align:center}
.mini-add-file{width:26px;height:42px;border:1px solid #d8e3ef;border-radius:9px;background:#fff;color:#155bdd;font-size:18px;font-weight:900;cursor:pointer}
.mini-add-file:hover{background:#edf4ff;border-color:#bcd1ff}
.rotate-command{min-width:244px!important}
.delete-command{min-width:88px!important}
.extract-command{min-width:216px!important}
.prepare-command{min-width:154px!important}
.prepare-command .tool-tile{min-width:70px!important}
.procedure-tool{color:#c03b14!important}
.scan-tool{color:#087f70!important}
.signature-command{min-width:76px!important}
.image-command{min-width:83px!important}
.image-tool-stack{min-height:68px!important}
.extract-control{min-height:68px!important;justify-content:center!important;gap:4px!important}
.extract-counter{height:30px!important}
.extract-groups{min-height:24px!important;gap:3px!important}
.extract-btn{width:27px!important;height:23px!important;border-radius:7px!important}
.extract-empty{font-size:7px!important;max-width:150px!important}

.quality-command{min-width:260px!important}
.quality-panel{min-height:68px!important;width:100%!important;display:grid!important;grid-template-columns:1fr 91px!important;grid-template-rows:18px 1fr!important;column-gap:6px!important;row-gap:2px!important;align-items:stretch!important}
.original-weight{grid-column:1/2;grid-row:1;display:flex!important;align-items:center!important;justify-content:space-between!important;font-size:10px!important;padding:0 3px!important}
.original-weight span,.original-weight b{font-size:10px!important;color:#172033!important}
.quality-options{grid-column:1;grid-row:2;width:100%!important;display:flex!important;flex-direction:column!important;gap:2px!important}
.quality-option{width:100%!important;min-height:16px!important;height:16px!important;padding:0 19px 0 7px!important;border-radius:7px!important;display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;font-size:9.5px!important;font-weight:850!important}
.quality-option span,.quality-option b{font-size:9.5px!important;line-height:1!important}
.quality-option i{right:6px!important;font-size:9px!important}
.exact-weight-btn{grid-column:2;grid-row:1/3;border:1px solid #d8e2ee;border-radius:10px;background:#fff;color:#344155;padding:5px 5px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;cursor:pointer}
.exact-weight-btn>span{font-size:17px;color:#2563eb;font-weight:950}
.exact-weight-btn strong{font-size:8.5px;line-height:1.05}
.exact-weight-btn small{max-width:78px;font-size:7.5px;color:#718096;line-height:1.1}
.exact-weight-btn:hover{background:#f5f8ff;border-color:#b9d0ff}
.exact-weight-btn.active{background:#eaf2ff;border-color:#9fc0ff;color:#15499a}

.pages-workspace{min-height:calc(100vh - 222px - 46px)!important;padding:11px 28px 23px!important;background:#f6f8fc!important}
.pages-heading{min-height:30px!important;margin-bottom:9px!important}
.pages-heading-copy{display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:8px!important}
.pages-heading-copy>strong{font-size:11px!important;letter-spacing:.07em!important}
.page-stats{gap:5px!important}
.page-stats span{height:25px!important;padding:0 9px!important;border-radius:8px!important;background:#fff!important;border:1px solid #dce5ef!important;box-shadow:0 2px 7px rgba(15,23,42,.035)!important}
.drag-hint{font-size:9px!important;color:#708096!important}
.pages-workspace .pages-stream{grid-template-columns:repeat(auto-fill,minmax(155px,1fr))!important;gap:11px!important}
.pages-workspace .page-card{padding:7px!important;border-radius:13px!important;box-shadow:0 5px 15px rgba(15,23,42,.055)!important;border-color:#dfe7f0!important;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease!important}
.pages-workspace .page-card:hover{transform:translateY(-2px)!important;box-shadow:0 10px 22px rgba(15,23,42,.09)!important;border-color:#c7d4e3!important}
.pages-workspace .canvas-wrap{border-radius:8px!important}
.page-number-badge{box-shadow:0 5px 11px color-mix(in srgb,var(--source) 25%,transparent)!important}
.page-source-dot{background:var(--source)!important}
.drag-grip{opacity:.72!important}

.editor-empty-state{height:calc(100vh - 278px);min-height:280px;display:flex;align-items:center;justify-content:center;padding:8px 0 2px}
.editor-drop-zone{width:min(100%,1180px);height:min(100%,390px);min-height:260px;border:2px dashed #c8d5e5;border-radius:20px;background:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;cursor:pointer;box-shadow:0 10px 28px rgba(15,23,42,.045);transition:border-color .18s ease,background .18s ease,transform .18s ease}
.editor-drop-zone:hover,.editor-drop-zone.dragover{border-color:#ef233c;background:#fffafb;transform:translateY(-1px)}
.editor-drop-zone .drop-icons{display:flex;gap:7px;margin-bottom:13px}
.editor-drop-zone .drop-icons span{width:43px;height:43px;border-radius:12px;display:grid;place-items:center;font-size:9px;font-weight:950}
.editor-drop-zone .drop-icons span:nth-child(1){background:#fff0f2;color:#ef233c}.editor-drop-zone .drop-icons span:nth-child(2){background:#f2edff;color:#7c3aed}.editor-drop-zone .drop-icons span:nth-child(3){background:#eaf2ff;color:#2563eb;font-size:16px}.editor-drop-zone .drop-icons span:nth-child(4){background:#eaf8ef;color:#16843b}.editor-drop-zone .drop-icons span:nth-child(5){background:#fff0e9;color:#e85b18}
.editor-drop-zone h2{margin:0 0 4px;font-size:23px;color:#111a2e;letter-spacing:-.025em}
.editor-drop-zone>p{margin:0 0 13px;color:#6f7e92;font-size:12px}
.editor-drop-zone .primary-btn{padding:10px 18px!important;border-radius:10px!important;font-size:12px!important;margin-bottom:11px!important}
.editor-drop-zone .drop-meta{display:flex;gap:8px;color:#7b8aa0;font-size:9px}

.documents-card{width:min(720px,calc(100vw - 28px))!important}
.documents-summary{display:flex;align-items:center;gap:8px;margin:0 0 13px}
.documents-summary>span{padding:7px 10px;border-radius:9px;background:#f4f7fb;color:#607087;font-size:10px}
.documents-summary>span b{color:#172033;font-size:12px}
.documents-summary>button{margin-left:auto;border:0;border-radius:9px;background:#155bdd;color:#fff;padding:9px 12px;font-weight:850;font-size:10px;cursor:pointer}
.documents-list{display:flex!important;flex-direction:column!important;gap:7px!important;max-height:52vh;overflow:auto;padding:2px!important}
.documents-list .source-chip{width:100%!important;min-height:52px!important;height:auto!important;padding:7px 9px!important;border:1px solid #e0e7ef!important;border-left:4px solid var(--source)!important;border-radius:10px!important;background:#fff!important;display:flex!important;align-items:center!important;gap:9px!important}
.documents-list .source-type{min-width:45px!important;background:color-mix(in srgb,var(--source) 10%,white)!important;color:var(--source)!important;border-radius:8px!important;font-size:9px!important;font-weight:950!important;text-align:center!important}
.documents-list .source-copy{min-width:0;flex:1}
.documents-list .source-name{display:block!important;font-size:10.5px!important;font-weight:900!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
.documents-list .source-count{display:block!important;margin-top:2px!important;font-size:8.5px!important;color:#758399!important}
.documents-list .source-icon-btn{width:27px!important;height:27px!important;border-radius:8px!important}
.empty-documents{margin:22px 0;text-align:center;color:#718096;font-size:12px}
.output-plan-summary{display:flex;flex-wrap:wrap;gap:5px;margin:9px 0 3px}.output-plan-summary span{padding:6px 8px;border-radius:8px;background:#edf8f3;color:#087f5b;font-size:8.5px;font-weight:850}

.compact-settings-card{width:min(430px,calc(100vw - 28px))!important}
.settings-card{width:min(620px,calc(100vw - 28px))!important}
.weight-input-row,.inline-input{display:grid;grid-template-columns:1fr 88px;gap:7px}
.weight-input-row{margin:15px 0 9px}
.weight-input-row input,.weight-input-row select,.inline-input input,.inline-input select,.settings-grid>label>select{width:100%;height:44px;border:1px solid #d4deea;border-radius:10px;background:#fff;color:#172033;padding:0 12px;font:800 13px inherit}
.preset-chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.preset-chips button{border:1px solid #d8e2ee;border-radius:8px;background:#f7f9fc;color:#42516a;padding:7px 10px;font-size:9px;font-weight:850;cursor:pointer}
.settings-check{display:flex;align-items:flex-start;gap:9px;padding:10px 11px;margin:8px 0;border:1px solid #e0e7ef;border-radius:10px;background:#f9fbfd;color:#35435a;font-size:10px;font-weight:750;line-height:1.35}
.settings-check input{margin-top:1px;accent-color:#155bdd}
.modal-secondary{width:100%;min-height:40px;margin-top:7px;border:1px solid #d5dfeb;border-radius:10px;background:#fff;color:#3f4e65;font-size:10px;font-weight:900;cursor:pointer}
.settings-note{display:block;margin-top:9px;color:#75849a;font-size:9px;line-height:1.4;text-align:center}
.procedure-presets,.scan-presets{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:14px 0}
.procedure-presets button,.scan-presets button{min-height:68px;border:1px solid #dbe4ee;border-radius:11px;background:#fff;color:#26344a;padding:9px;text-align:left;cursor:pointer}
.procedure-presets button b,.scan-presets button b{display:block;font-size:10px}.procedure-presets button small,.scan-presets button small{display:block;margin-top:4px;color:#78869a;font-size:8px;line-height:1.3}
.procedure-presets button.active,.scan-presets button.active{border-color:#9fc0ff;background:#edf4ff;color:#154a9c;box-shadow:0 5px 13px rgba(37,99,235,.08)}
.settings-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:9px 0}
.settings-grid>label{display:flex;flex-direction:column;gap:5px;color:#4d5d73;font-size:9px;font-weight:850}
.settings-grid>label>select,.inline-input input,.inline-input select{height:39px;font-size:10px;padding:0 8px}
.inline-input{grid-template-columns:1fr 64px}
.modal-actions-row{display:grid;grid-template-columns:1fr 1.45fr;gap:7px;margin-top:9px}.modal-actions-row .modal-secondary{margin:0}.modal-actions-row .modal-primary{margin:0}

.site-footer{min-height:46px!important;padding:8px 28px!important;background:#fff!important;border-top:1px solid #dfe7ef!important;font-size:9px!important}
.site-footer nav{gap:16px!important}.site-footer button{font-size:9px!important}

@media(max-width:1250px){
  .commandbar{justify-content:flex-start!important}
}
@media(max-width:760px){
  .editor-topbar-inner{padding:8px 12px!important}.editor-primary-actions{width:100%;justify-content:flex-end}.editor-identity small{display:none}.editor-language{min-width:120px!important}.reset-btn span{display:none}.reset-btn{width:44px!important;padding:0!important}.generate-btn{min-width:126px!important}
  .editor-toolbar{top:114px!important}.commandbar{padding-left:8px!important;padding-right:8px!important}.pages-workspace{padding:10px 11px 20px!important}.editor-empty-state{height:calc(100vh - 328px);min-height:330px}.pages-workspace .pages-stream{grid-template-columns:repeat(2,minmax(0,1fr))!important}.drag-hint{width:100%}
  .procedure-presets,.scan-presets,.settings-grid{grid-template-columns:1fr}.procedure-presets button,.scan-presets button{min-height:54px}.modal-actions-row{grid-template-columns:1fr}
  .site-footer{flex-direction:column!important;gap:7px!important}.site-footer nav{justify-content:center;flex-wrap:wrap;gap:9px!important}
}


/* V5: diferenciación visual de las dos rotaciones */
.source-icon-btn.content-rotate{color:#5b21b6}
.source-icon-btn.page-rotate{color:#173b72}
.rotation-label{
  white-space:nowrap;
  font-size:9px;
}


/* V6 - controles dentro de la vista previa */
.preview-actions{
  display:flex;
  justify-content:center;
  gap:10px;
  padding:14px 18px 18px;
  border-top:1px solid #e2e8f0;
  background:#fff;
  flex-wrap:wrap;
}
.preview-actions .page-action{
  min-width:140px;
}
.preview-head small{
  display:block;
  margin-top:4px;
}


/* =========================================================
   V7 - Barra de herramientas organizada
   ========================================================= */
.editor-toolbar{
  position:sticky;
  top:0;
  z-index:80;
  display:block;
  margin:-14px -36px 10px;
  padding:10px 36px 9px;
  background:rgba(244,247,251,.97);
  border-bottom:1px solid #dfe7f0;
  backdrop-filter:blur(12px);
}
.editor-summary-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:7px;
}
.toolbar-groups{
  display:grid;
  grid-template-columns:auto 1px 1fr 1px auto;
  align-items:end;
  gap:14px;
}
.toolbar-group{
  display:flex;
  flex-direction:column;
  gap:5px;
  min-width:0;
}
.toolbar-label{
  font-size:9px;
  line-height:1;
  font-weight:950;
  letter-spacing:.14em;
  color:#8492a6;
}
.toolbar-group-buttons{
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
}
.edit-group{justify-self:center}
.result-group{justify-self:end}
.toolbar-divider{
  width:1px;
  height:34px;
  align-self:end;
  margin-bottom:1px;
  background:#d8e1ec;
}
.toolbar-groups .tool-btn{
  min-height:37px;
  padding:9px 13px;
}
.toolbar-groups .generate-btn{
  min-height:37px;
  padding:9px 18px;
  min-width:165px;
}
/* Mantener los botones estables: el texto no cambia de ancho cuando se activa */
.content-mode-btn.active,
.rotate-mode-btn.active,
.delete-mode-btn.active{
  position:relative;
  padding-left:27px;
}
.content-mode-btn.active::before,
.rotate-mode-btn.active::before,
.delete-mode-btn.active::before{
  content:"●";
  position:absolute;
  left:11px;
  top:50%;
  transform:translateY(-50%);
  font-size:9px;
}

/* =========================================================
   V7 - Miniaturas uniformes por orientación
   ========================================================= */
.pages-stream{
  grid-auto-flow:row;
  align-items:start;
}
.canvas-wrap{
  width:100%;
  aspect-ratio:210 / 297;
}
.page-card.landscape .canvas-wrap{
  aspect-ratio:297 / 210;
}
.canvas-wrap canvas{
  width:100%!important;
  height:100%!important;
  object-fit:contain;
}

/* =========================================================
   V7 - Vista previa con zoom real
   ========================================================= */
.preview-shell{
  width:min(1180px,94vw);
  height:min(92vh,900px);
}
.preview-head{
  gap:12px;
}
.preview-title-block{
  flex:1;
  min-width:180px;
}
.preview-zoom-tools{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex-wrap:wrap;
}
.preview-tool-btn,
.preview-zoom-level,
.preview-fit-btn{
  border:1px solid #d9e2ed;
  background:#fff;
  color:#26384f;
  border-radius:8px;
  height:32px;
  padding:0 10px;
  font-size:11px;
  font-weight:850;
}
.preview-tool-btn{
  width:34px;
  padding:0;
  font-size:18px;
}
.preview-zoom-level{
  min-width:56px;
}
.preview-fit-btn.active{
  background:#183b71;
  border-color:#183b71;
  color:#fff;
}
.preview-stage{
  overflow:auto!important;
  justify-content:flex-start!important;
  align-items:flex-start!important;
  padding:20px!important;
}
.preview-stage::before{
  content:"";
  flex:1 0 0;
}
.preview-stage canvas{
  flex:0 0 auto;
  margin:auto;
}
.preview-stage::after{
  content:"";
  flex:1 0 0;
}
.preview-actions{
  padding-top:10px;
  padding-bottom:12px;
}

@media(max-width:1000px){
  .editor-toolbar{
    margin:-12px -18px 10px;
    padding:9px 18px;
  }
  .toolbar-groups{
    grid-template-columns:1fr;
    gap:8px;
  }
  .toolbar-divider{display:none}
  .edit-group,.result-group{justify-self:stretch}
  .toolbar-group-buttons{width:100%}
  .result-group .generate-btn{width:100%}
  .preview-head{align-items:flex-start}
  .preview-zoom-tools{order:3;width:100%}
}
@media(max-width:650px){
  .editor-toolbar{
    margin:-10px -10px 8px;
    padding:8px 10px;
  }
  .toolbar-group-buttons{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .edit-group .toolbar-group-buttons{
    grid-template-columns:repeat(3,1fr);
  }
  .toolbar-groups .tool-btn{padding:8px 7px;font-size:10px}
  .preview-fit-btn{display:none}
}


/* =========================================================
   V8 - Interfaz limpia: paneles por categoría
   ========================================================= */
.editor-view{
  padding:10px 30px 34px;
}
.editor-toolbar{
  position:sticky;
  top:0;
  z-index:90;
  margin:-10px -30px 8px;
  padding:8px 30px;
  background:rgba(244,247,251,.97);
  border-bottom:1px solid #dfe7f0;
  backdrop-filter:blur(14px);
}
.editor-toolbar-inner{
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:center;
  gap:18px;
}
.compact-brand{
  min-width:170px;
  display:flex;
  align-items:center;
  gap:9px;
}
.toolbar-panels{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:stretch;
}
.toolbar-panel{
  min-width:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:5px;
  padding:7px 9px;
  border:1px solid #dfe6ef;
  border-radius:12px;
  background:rgba(255,255,255,.78);
  box-shadow:0 2px 8px rgba(15,23,42,.03);
}
.toolbar-panel.edit-panel{
  justify-self:center;
}
.toolbar-panel.result-panel{
  min-width:185px;
}
.toolbar-label{
  font-size:8px;
  font-weight:950;
  letter-spacing:.14em;
  color:#8a98ab;
  line-height:1;
}
.toolbar-group-buttons{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:nowrap;
}
.toolbar-panel .tool-btn{
  min-height:34px;
  padding:7px 11px;
  border-radius:9px;
  white-space:nowrap;
  font-size:11px;
}
.toolbar-panel .generate-btn{
  min-height:34px;
  min-width:165px;
  padding:7px 14px;
  font-size:11px;
}
.mode-hint{
  min-height:28px;
  display:flex;
  align-items:center;
  margin:0 0 8px;
  padding:6px 10px;
  border-radius:9px;
  font-size:10px;
}

/* Archivos cargados como una banda discreta */
.sources-panel{
  margin-bottom:9px;
}
.sources-heading{
  margin:0 0 5px 2px;
  color:#8a98ab;
  font-size:8px;
  line-height:1;
  font-weight:950;
  letter-spacing:.14em;
}
.source-strip{
  margin-bottom:0;
  gap:7px;
  flex-wrap:nowrap;
  overflow-x:auto;
  padding-bottom:2px;
  scrollbar-width:thin;
}
.source-chip{
  flex:1 1 240px;
  max-width:none;
  min-width:220px;
  padding:6px 7px 6px 9px;
  border-radius:9px;
}
.source-icon-btn{
  width:27px;
  height:27px;
}

/* =========================================================
   V8 - Miniaturas limpias, sin botones debajo
   ========================================================= */
.pages-stream{
  grid-template-columns:repeat(auto-fill,minmax(142px,1fr));
  gap:9px;
  align-items:start;
}
.page-card{
  padding:7px;
  border-radius:12px;
}
.page-caption{
  min-height:20px;
  margin-top:5px;
  padding:0 1px;
  font-size:10px;
}
.page-actions{
  display:none!important;
}
.canvas-wrap{
  cursor:zoom-in;
}
.editor-view.mode-content .canvas-wrap,
.editor-view.mode-page .canvas-wrap{
  cursor:cell;
}
.editor-view.mode-delete .canvas-wrap{
  cursor:crosshair;
}
.rotation-label{
  font-size:8px;
  color:#7a899d;
}

/* =========================================================
   V8 - Vista previa profesional y compacta
   ========================================================= */
.preview-modal{
  padding:14px;
  background:rgba(10,18,31,.72);
}
.preview-shell{
  width:min(1120px,94vw)!important;
  height:min(90vh,880px)!important;
  border-radius:15px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  background:#fff;
}
.preview-head{
  flex:0 0 auto;
  min-height:58px!important;
  height:auto!important;
  padding:9px 12px 9px 16px!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto 38px;
  align-items:center!important;
  gap:12px!important;
  border-bottom:1px solid #dce4ee;
  background:#fff;
}
.preview-head>div{
  min-width:0;
}
.preview-head .preview-title-block{
  display:flex!important;
  flex-direction:column!important;
  justify-content:center;
}
.preview-title-block strong{
  font-size:13px!important;
  line-height:1.2;
}
.preview-title-block small{
  margin-top:3px!important;
  font-size:9px!important;
}
.preview-head .preview-zoom-tools{
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:center!important;
  flex-wrap:nowrap!important;
  gap:5px!important;
  width:auto!important;
  order:initial!important;
}
.preview-tool-btn,
.preview-zoom-level,
.preview-fit-btn{
  height:31px!important;
  border-radius:8px!important;
  font-size:10px!important;
  white-space:nowrap;
}
.preview-tool-btn{
  width:31px!important;
  padding:0!important;
  font-size:17px!important;
}
.preview-zoom-level{
  min-width:52px;
  padding:0 8px!important;
}
.preview-fit-btn{
  padding:0 10px!important;
}
.zoom-separator{
  width:1px;
  height:22px;
  background:#dce4ee;
  margin:0 2px;
}
.close-preview{
  width:36px!important;
  height:36px!important;
  border-radius:9px!important;
  font-size:22px!important;
}
.preview-stage{
  position:relative;
  flex:1 1 auto;
  min-height:0;
  overflow:auto!important;
  display:block!important;
  padding:0!important;
  background:#e9eef5!important;
  cursor:grab;
  overscroll-behavior:contain;
}
.preview-stage.is-panning{
  cursor:grabbing;
  user-select:none;
}
.preview-stage::before,
.preview-stage::after{
  display:none!important;
  content:none!important;
}
.preview-viewport{
  min-width:100%;
  min-height:100%;
  width:max-content;
  height:max-content;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:22px;
}
.preview-stage canvas{
  display:block;
  flex:none;
  margin:0!important;
  background:#fff;
  box-shadow:0 10px 30px rgba(15,23,42,.18);
}
.preview-deleted{
  position:sticky!important;
  top:14px!important;
  float:right;
  margin:14px 14px 0 0;
  z-index:12;
}
.preview-actions{
  flex:0 0 auto;
  display:flex!important;
  align-items:center;
  justify-content:center;
  gap:7px!important;
  padding:9px 14px!important;
  border-top:1px solid #e1e7ef;
  background:#fff;
}
.preview-actions-label{
  margin-right:5px;
  color:#8a98ab;
  font-size:8px;
  font-weight:950;
  letter-spacing:.13em;
}
.preview-action-btn{
  min-width:110px;
  height:32px;
  border-radius:8px;
  border:1px solid #dce4ee;
  background:#fff;
  color:#26384f;
  font-size:10px;
  font-weight:900;
}
.preview-action-btn.content:hover{
  border-color:#6d28d9;
  color:#5b21b6;
  background:#faf7ff;
}
.preview-action-btn.page:hover{
  border-color:#173b72;
  color:#173b72;
  background:#f6f9fe;
}
.preview-action-btn.delete{
  color:#c91c31;
  border-color:#f0b9c1;
}
.preview-action-btn.delete:hover{
  color:#fff;
  background:#c91c31;
  border-color:#c91c31;
}

@media(max-width:1050px){
  .editor-view{padding-left:16px;padding-right:16px}
  .editor-toolbar{margin-left:-16px;margin-right:-16px;padding-left:16px;padding-right:16px}
  .editor-toolbar-inner{grid-template-columns:1fr;gap:7px}
  .compact-brand{min-width:0}
  .toolbar-panels{grid-template-columns:1fr 1fr auto}
  .toolbar-panel.edit-panel{justify-self:stretch}
}
@media(max-width:720px){
  .toolbar-panels{grid-template-columns:1fr}
  .toolbar-panel.result-panel{min-width:0}
  .toolbar-group-buttons{flex-wrap:wrap}
  .toolbar-panel .generate-btn{width:100%}
  .source-strip{flex-wrap:nowrap}
  .source-chip{min-width:240px}
  .pages-stream{grid-template-columns:repeat(2,minmax(0,1fr))}
  .preview-head{
    grid-template-columns:minmax(0,1fr) 36px!important;
  }
  .preview-head .preview-zoom-tools{
    grid-column:1 / 3;
    grid-row:2;
    width:100%!important;
    justify-content:flex-start!important;
    overflow-x:auto;
  }
  .close-preview{grid-column:2;grid-row:1}
  .preview-actions-label{display:none}
  .preview-action-btn{min-width:0;flex:1}
}


/* =========================================================
   V9 - Barra superior por paneles iguales
   ========================================================= */
.editor-toolbar{
  margin-bottom:10px;
}
.editor-toolbar-inner.v9-layout{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:10px;
}
.compact-brand-v9{
  min-width:0;
}
.compact-brand-v9 strong{
  font-size:13px;
}
.compact-brand-v9 small{
  font-size:11px;
}
.toolbar-panels-v9{
  display:grid !important;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:10px;
  align-items:stretch;
}
.toolbar-panels-v9 .panel-card{
  min-width:0;
  min-height:92px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:stretch;
  gap:10px;
  padding:10px 10px 12px;
  border:1px solid #dfe6ef;
  border-radius:14px;
  background:#ffffff;
  box-shadow:0 4px 14px rgba(15,23,42,.04);
}
.toolbar-panels-v9 .toolbar-label{
  display:block;
  text-align:center;
  font-size:10px;
  letter-spacing:.16em;
  color:#8795a8;
}
.toolbar-panels-v9 .tool-btn,
.toolbar-panels-v9 .generate-btn{
  width:100%;
  min-height:40px;
  padding:10px 12px;
  border-radius:10px;
  font-size:12px;
  justify-content:center;
}
.toolbar-panels-v9 .generate-btn{
  min-width:0;
}
.toolbar-panels-v9 .result-panel-v9{
  background:linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(255,248,249,1) 100%);
}
@media(max-width:1180px){
  .toolbar-panels-v9{grid-template-columns:repeat(3, minmax(0, 1fr));}
}
@media(max-width:760px){
  .toolbar-panels-v9{grid-template-columns:repeat(2, minmax(0, 1fr));}
}
@media(max-width:520px){
  .toolbar-panels-v9{grid-template-columns:1fr;}
}


/* =========================================================
   V10 - barra compacta en una sola recta + rotaciones juntas
   ========================================================= */
.editor-toolbar-inner.v10-layout{
  display:grid;
  grid-template-columns:220px 1fr;
  gap:12px;
  align-items:stretch;
}
.info-panel-v10{
  min-height:152px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px;
  border:1px solid #dfe6ef;
  border-radius:16px;
  background:#fff;
  box-shadow:0 4px 14px rgba(15,23,42,.04);
}
.brand-inline-v10{display:flex;align-items:center;gap:10px;}
.brand-inline-v10 .brand-mark.small{width:46px;height:46px;border-radius:14px;font-size:24px;}
.brand-inline-v10 strong{display:block;font-size:15px;line-height:1.1;}
.brand-inline-v10 small{display:block;margin-top:4px;font-size:11px;color:#748398;}
.toolbar-panels-v10{display:grid !important;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;align-items:stretch;}
.toolbar-panels-v10 .panel-card{min-height:152px;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:12px;padding:12px;border:1px solid #dfe6ef;border-radius:16px;background:#fff;box-shadow:0 4px 14px rgba(15,23,42,.04);}
.toolbar-panels-v10 .toolbar-label{text-align:center;font-size:11px;letter-spacing:.18em;color:#8290a6;}
.toolbar-panels-v10 .tool-btn,.toolbar-panels-v10 .generate-btn{width:100%;min-height:42px;border-radius:11px;justify-content:center;font-size:13px;}
.rotate-stack-v10{display:flex;flex-direction:column;gap:8px;flex:1;}
.result-panel-v10{background:linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(255,248,249,1) 100%);}
.page-card.file-start::before{content:none !important;display:none !important;}
@media(max-width:1280px){.editor-toolbar-inner.v10-layout{grid-template-columns:1fr;}}
@media(max-width:980px){.toolbar-panels-v10{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:560px){.toolbar-panels-v10{grid-template-columns:1fr;}}




/* ===== CORRECCION LIMPIA VISOR ===== */

/* mantener modal oculto hasta abrir */
.preview-modal.hidden {
    display:none !important;
}

/* centrar cuando se muestra */
#previewModal:not(.hidden) {
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    position:fixed !important;
    inset:0 !important;
    z-index:9999 !important;
}

/* contenedor compacto */
.preview-shell {
    width:auto !important;
    max-width:900px !important;
    max-height:90vh !important;
    margin:auto !important;
}

/* no tocar render */
#previewStage {
    display:flex;
    justify-content:center;
    align-items:center;
}

/* página completa sin forzar recorte */
#previewCanvas {
    display:block;
    margin:auto;
}



/* ===== AJUSTE FINO DEL VISOR (sin tocar render) ===== */

.preview-modal {
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
}

.preview-container,
.preview-content,
.preview-box,
.preview-shell {
    width:auto !important;
    max-width:820px !important;
    margin:auto !important;
}

.preview-body,
.preview-stage {
    padding:6px !important;
}

.preview-stage {
    display:flex !important;
    justify-content:center !important;
    align-items:center !important;
}

.preview-actions {
    padding:6px 10px !important;
}



/* ARCHIVO: lista compacta debajo del boton */
.file-panel-v10{
  min-width:260px;
}
.file-list-title{
  margin:10px 0 6px;
  font-size:10px;
  font-weight:950;
  color:#64748b;
  letter-spacing:.08em;
}
.compact-source-strip{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height:150px;
  overflow-y:auto;
  padding-right:4px;
}
.compact-source-strip::-webkit-scrollbar{width:6px}
.compact-source-strip::-webkit-scrollbar-thumb{
  background:#cbd5e1;
  border-radius:20px;
}
.source-chip{
  width:100%;
  min-height:34px;
  display:flex;
  align-items:center;
  gap:6px;
  padding:6px 7px;
  border:1px solid #dbe4ef;
  border-left:3px solid var(--source);
  border-radius:9px;
  background:#fff;
  box-shadow:0 2px 8px rgba(15,23,42,.04);
}
.source-type{
  flex:0 0 auto;
  min-width:38px;
  padding:3px 4px;
  text-align:center;
  border-radius:6px;
  background:#f1f5f9;
  font-size:9px;
  font-weight:950;
}
.source-name{
  flex:1;
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  font-size:11px;
  font-weight:700;
}
.source-count{
  display:none;
}
.source-icon-btn{
  width:22px;
  height:22px;
  padding:0;
  flex:0 0 auto;
  border:0;
  border-radius:6px;
  background:#f1f5f9;
  font-size:11px;
}
.source-icon-btn.remove-source{
  color:#dc2626;
  font-size:16px;
  background:#fef2f2;
}

.extract-buttons{display:flex;gap:5px;flex-wrap:wrap}
.extract-btn.active{background:#0f766e;color:#fff;border-color:#0f766e}
.extract-badge{position:absolute;right:8px;top:8px;z-index:6;min-width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:#0f766e;color:white;font-size:11px;font-weight:900}
.editor-view.mode-delete .canvas-wrap{cursor:pointer}
.editor-view.mode-delete .canvas-wrap::before{display:none!important}

/* ===== REDISEÑO UI V11 - estilo editor profesional ===== */
.editor-view{padding:18px 28px 38px;background:#f6f8fc}
.editor-toolbar{background:#fff;border:1px solid #e3eaf3;border-radius:22px;padding:12px 14px;box-shadow:0 10px 30px rgba(15,23,42,.06)}
.editor-toolbar-inner.v10-layout{width:100%}
.toolbar-panels-v10{display:flex;gap:8px;align-items:stretch;flex-wrap:wrap;width:100%}
.panel-card{background:#fff;border:1px solid #e5ebf3;border-radius:16px;box-shadow:0 5px 18px rgba(15,23,42,.04)}
.toolbar-panel{padding:10px 12px}
.toolbar-label{display:block;text-align:center;color:#64748b;font-size:11px;font-weight:950;letter-spacing:.04em;margin-bottom:8px}
.info-panel-v10{display:flex;align-items:center;min-width:190px}
.file-panel-v10{flex:2}
.rotate-panel-v10,.extract-panel-v10{flex:1}
.result-panel-v10{display:flex;flex-direction:column;justify-content:center;min-width:190px}
.brand-inline-v10 small{color:#64748b}
.rotate-stack-v10,.extract-buttons{display:flex;gap:6px;flex-wrap:wrap}
.tool-btn{border-radius:12px;background:#fff;min-height:38px}
.generate-btn{border-radius:13px}
.pages-stream{background:#fff;border:1px solid #e3eaf3;border-radius:20px;padding:18px;box-shadow:0 10px 30px rgba(15,23,42,.05)}
.page-card{border-radius:16px!important;border:1px solid #e5ebf3!important;box-shadow:0 8px 22px rgba(15,23,42,.05)!important;overflow:hidden}
.page-card:hover{transform:translateY(-3px);box-shadow:0 14px 28px rgba(15,23,42,.1)!important}
.source-chip{background:#fff;border-radius:14px;padding:10px}
@media(max-width:900px){.editor-view{padding:12px}.toolbar-panels-v10{display:block}.toolbar-panel{margin-bottom:8px}}

/* =========================================================
   V12 · BARRA PROFESIONAL ORDENADA
   Esta capa final reemplaza únicamente la presentación del
   editor y conserva intacta la lógica de carga y edición.
   ========================================================= */
body{overflow-x:hidden}

.editor-view{
  min-height:100vh;
  padding:0;
  background:#f7f9fc;
}

/* Cabecera principal */
.editor-topbar{
  background:#fff;
  border-bottom:1px solid #e7ecf3;
}
.editor-topbar-inner{
  width:min(1540px,100%);
  min-height:88px;
  margin:0 auto;
  padding:16px 28px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
}
.editor-identity{
  min-width:0;
  display:flex;
  align-items:center;
  gap:16px;
}
.editor-logo{
  position:relative;
  width:54px;
  height:54px;
  flex:0 0 54px;
  display:grid;
  place-items:center;
  color:#fff;
  background:linear-gradient(145deg,#ff3445,#e7192b);
  clip-path:polygon(16% 0,78% 0,100% 22%,100% 78%,78% 100%,16% 100%,0 84%,0 16%);
  filter:drop-shadow(0 8px 14px rgba(232,25,43,.19));
}
.editor-logo::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:16px;
  height:16px;
  background:rgba(255,255,255,.32);
  clip-path:polygon(0 0,100% 100%,0 100%);
}
.editor-logo b{font-size:12px;letter-spacing:.03em}
.editor-identity>div{min-width:0;display:flex;flex-direction:column}
.editor-identity strong{
  color:#111827;
  font-size:21px;
  line-height:1.15;
  letter-spacing:-.02em;
}
.editor-identity small{
  margin-top:5px;
  color:#748198;
  font-size:12px;
  font-weight:600;
}
.editor-identity small i{margin:0 5px;color:#a3adbb;font-style:normal}
.editor-primary-actions{display:flex;align-items:center;gap:14px;flex:0 0 auto}
.reset-btn,.editor-primary-actions .generate-btn{
  min-height:50px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  font-size:13px;
  font-weight:850;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.reset-btn{
  min-width:176px;
  padding:0 20px;
  color:#192234;
  background:#fff;
  border:1px solid #dce3ec;
  box-shadow:0 3px 10px rgba(15,23,42,.03);
}
.reset-btn:hover{border-color:#b8c4d2;background:#fbfcfe;transform:translateY(-1px)}
.reset-btn svg,.editor-primary-actions .generate-btn svg{
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.editor-primary-actions .generate-btn{
  width:186px;
  min-width:186px;
  margin:0;
  padding:0 18px;
  justify-content:flex-start;
  color:#fff;
  background:linear-gradient(135deg,#f32b3b,#e6192b);
  box-shadow:0 11px 24px rgba(232,25,43,.22);
}
.editor-primary-actions .generate-btn span{flex:1;text-align:left}
.editor-primary-actions .generate-btn b{font-size:17px}

/* Barra de comandos: grupos horizontales sin tarjetas altas */
.editor-toolbar{
  display:block;
  margin:0;
  padding:0;
  background:#fff;
  border:0;
  border-bottom:1px solid #e5eaf1;
  border-radius:0;
  box-shadow:0 7px 22px rgba(15,23,42,.035);
}
.commandbar{
  width:min(1540px,100%);
  min-height:150px;
  margin:0 auto;
  padding:13px 20px 15px;
  display:flex;
  align-items:stretch;
  justify-content:flex-start;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:thin;
  scrollbar-color:#cbd5e1 transparent;
}
.commandbar::-webkit-scrollbar{height:6px}
.commandbar::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:10px}
.command-group{
  flex:0 0 auto;
  min-height:120px;
  padding:0 17px;
  display:flex;
  flex-direction:column;
  align-items:center;
  border-right:1px solid #e8edf3;
}
.command-group:first-child{padding-left:8px}
.command-group:last-child{border-right:0}
.command-group>.toolbar-label{
  display:block;
  min-height:22px;
  margin:0 0 7px;
  color:#697990;
  text-align:center;
  font-size:10px;
  line-height:1.2;
  font-weight:950;
  letter-spacing:.08em;
}
.command-buttons{
  display:flex;
  align-items:stretch;
  justify-content:center;
  gap:5px;
}
.tool-tile{
  position:relative;
  width:78px;
  min-width:78px;
  min-height:88px;
  padding:9px 7px 8px;
  border:1px solid transparent;
  border-radius:12px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  color:#172033;
  background:transparent;
  font-size:11px;
  line-height:1.25;
  font-weight:750;
  text-align:center;
  transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease;
}
.tool-tile:hover{
  background:#f5f8fc;
  border-color:#e2e8f0;
  transform:translateY(-1px);
}
.tool-tile:focus-visible,.reset-btn:focus-visible,.generate-btn:focus-visible{
  outline:3px solid rgba(37,99,235,.24);
  outline-offset:2px;
}
.tool-icon-svg{
  width:26px;
  height:26px;
  flex:0 0 26px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.add-file-tile{
  width:86px;
  min-width:86px;
  color:#155bdd;
  background:#eaf2ff;
  border-color:#e2ecff;
}
.add-file-tile:hover{color:#0e4fcb;background:#deebff;border-color:#d2e2ff}
.add-icon{
  width:25px;
  height:25px;
  border-radius:6px;
  display:grid;
  place-items:center;
  color:#fff;
  background:#1461e9;
  font-size:21px;
  line-height:1;
  box-shadow:0 5px 11px rgba(20,97,233,.22);
}
.delete-command .tool-tile{color:#e1192b}
.letter-icon{
  height:28px;
  display:grid;
  place-items:center;
  color:#0c955c;
  font-size:24px;
  line-height:1;
  font-weight:950;
}
.extract-command .tool-tile{width:70px;min-width:70px}
.download-extract-tile{width:82px!important;min-width:82px!important}
.content-mode-btn.active{
  color:#5b21b6;
  background:#f0eaff;
  border-color:#ddd0ff;
  box-shadow:none;
}
.rotate-mode-btn.active{
  color:#1353a4;
  background:#eaf3ff;
  border-color:#cfe2fb;
  box-shadow:none;
}
.delete-mode-btn.active{
  color:#fff;
  background:#e61c30;
  border-color:#e61c30;
  box-shadow:0 7px 16px rgba(230,28,48,.18);
}
.extract-btn.active{
  color:#fff;
  background:#0f9560;
  border-color:#0f9560;
  box-shadow:0 7px 16px rgba(15,149,96,.16);
}
.extract-btn.active .letter-icon{color:#fff}
.session-command{min-width:210px;justify-content:flex-start}
.session-summary{
  min-height:88px;
  display:flex;
  align-items:center;
  gap:10px;
}
.session-summary>div{min-width:0;display:flex;flex-direction:column}
.session-summary strong{font-size:12px;color:#1e293b}
.session-summary small{
  max-width:150px;
  margin-top:4px;
  color:#728198;
  font-size:9px;
  line-height:1.35;
}

/* Estado del modo activo */
.editor-view>.mode-hint{
  width:min(1484px,calc(100% - 56px));
  min-height:38px;
  margin:14px auto 0;
  padding:10px 14px;
  border:1px solid #e2e8f0;
  border-left:4px solid #94a3b8;
  border-radius:10px;
  background:#fff;
  color:#64748b;
  font-size:11px;
  line-height:1.4;
  box-shadow:0 4px 14px rgba(15,23,42,.025);
}
.editor-view>.mode-hint.content-active{border-left-color:#6d28d9;background:#faf8ff;color:#5b21b6}
.editor-view>.mode-hint.rotate-active{border-left-color:#2563eb;background:#f7fbff;color:#174b8c}
.editor-view>.mode-hint.delete-active{border-left-color:#e11d31;background:#fff8f9;color:#aa1728}
.editor-view>.mode-hint.extract-active{border-left-color:#0f9560;background:#f4fcf8;color:#08764a}
.editor-view.mode-extract .canvas-wrap{cursor:pointer}
.editor-view.mode-extract .canvas-wrap:hover{outline-color:rgba(15,149,96,.38)}

/* Archivos cargados en una fila propia */
.loaded-files{
  width:min(1540px,100%);
  margin:0 auto;
  padding:21px 28px 23px;
}
.section-heading{
  min-height:25px;
  margin-bottom:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}
.section-heading strong,.pages-heading strong{
  color:#526279;
  font-size:11px;
  font-weight:950;
  letter-spacing:.04em;
}
.section-heading small,.pages-heading small{color:#8190a4;font-size:11px}
.loaded-files .source-strip{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(245px,1fr));
  gap:14px;
  margin:0;
}
.loaded-files .source-chip{
  width:auto;
  min-width:0;
  max-width:none;
  min-height:72px;
  margin:0;
  padding:12px 14px;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid #e7ecf3;
  border-left:4px solid var(--source);
  border-radius:12px;
  background:#fff;
  box-shadow:0 7px 18px rgba(15,23,42,.035);
}
.loaded-files .source-type{
  min-width:46px;
  padding:8px 7px;
  border:0;
  border-radius:8px;
  color:var(--source);
  background:color-mix(in srgb,var(--source) 10%,white);
  font-size:10px;
  font-weight:950;
  text-align:center;
}
.source-copy{min-width:0;flex:1;display:flex;flex-direction:column;gap:4px}
.loaded-files .source-name{
  display:block;
  min-width:0;
  color:#172033;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  font-weight:850;
}
.loaded-files .source-count{
  display:block;
  color:#8290a4;
  font-size:10px;
  line-height:1.2;
}
.loaded-files .source-icon-btn{
  width:28px;
  height:28px;
  padding:0;
  border:0;
  border-radius:8px;
  color:#7a8799;
  background:transparent;
  font-size:21px;
  font-weight:500;
}
.loaded-files .source-icon-btn:hover{color:#d61d31;background:#fff0f2}

/* Área de páginas */
.pages-workspace{
  padding:25px max(28px,calc((100% - 1484px)/2)) 44px;
  border-top:1px solid #e6ebf2;
  background:#fbfcfe;
}
.pages-heading{
  width:min(1484px,100%);
  margin:0 auto 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}
.pages-heading>div{display:flex;align-items:baseline;gap:10px;min-width:0}
.included-status{
  flex:0 0 auto;
  padding:8px 12px;
  border:1px solid #e0e7ef;
  border-radius:9px;
  color:#718096;
  background:#fff;
  font-size:11px;
  box-shadow:0 3px 10px rgba(15,23,42,.025);
}
.included-status b{color:#172033}
.pages-workspace .pages-stream{
  width:min(1484px,100%);
  margin:0 auto;
  padding:0;
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(180px,1fr));
  gap:18px;
  align-items:start;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.pages-workspace .page-card{
  position:relative;
  min-width:0;
  padding:10px;
  overflow:visible;
  border:1px solid #e0e6ee!important;
  border-top:1px solid #e0e6ee!important;
  border-radius:13px!important;
  background:#fff;
  box-shadow:0 7px 19px rgba(15,23,42,.045)!important;
}
.pages-workspace .page-card:hover{
  transform:translateY(-3px);
  border-color:color-mix(in srgb,var(--source) 33%,#dce4ed)!important;
  box-shadow:0 13px 25px rgba(15,23,42,.09)!important;
}
.page-card.file-start::before{display:none}
.page-number-badge{
  position:absolute;
  top:10px;
  left:10px;
  z-index:9;
  min-width:28px;
  height:28px;
  padding:0 7px;
  display:grid;
  place-items:center;
  border-radius:7px 7px 7px 2px;
  color:#fff;
  background:var(--source);
  font-size:11px;
  font-weight:950;
  box-shadow:0 5px 11px color-mix(in srgb,var(--source) 26%,transparent);
}
.extract-badge:empty{display:none}
.pages-workspace .canvas-wrap{
  border-color:#e0e6ed;
  border-radius:7px;
  background:#fff;
}
.pages-workspace .page-caption{
  min-height:27px;
  margin-top:7px;
  padding:0 2px;
  color:#172033;
  font-size:10px;
}
.pages-workspace .rotation-label{color:#8794a7;font-size:9px}

/* Ajustes para tablet y móvil: la barra se desplaza dentro de sí misma,
   nunca ensancha toda la página. */
@media(max-width:1000px){
  .editor-topbar-inner{padding-left:20px;padding-right:20px}
  .commandbar{justify-content:flex-start}
  .loaded-files{padding-left:20px;padding-right:20px}
  .editor-view>.mode-hint{width:calc(100% - 40px)}
  .pages-workspace{padding-left:20px;padding-right:20px}
  .pages-workspace .pages-stream{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:14px}
}
@media(max-width:650px){
  .editor-view{padding:0}
  .editor-topbar-inner{min-height:0;padding:13px 14px;align-items:flex-start;gap:12px;flex-wrap:wrap}
  .editor-logo{width:44px;height:44px;flex-basis:44px}
  .editor-identity{gap:10px}
  .editor-identity strong{font-size:17px}
  .editor-identity small{font-size:10px}
  .editor-primary-actions{width:100%;display:grid;grid-template-columns:1fr 1.18fr;gap:8px}
  .reset-btn,.editor-primary-actions .generate-btn{
    width:100%;
    min-width:0;
    min-height:44px;
    margin:0;
    padding:0 11px;
    grid-column:auto;
    font-size:11px;
  }
  .editor-primary-actions .generate-btn{justify-content:center}
  .editor-primary-actions .generate-btn span{flex:0;text-align:center}
  .commandbar{min-height:137px;padding:10px 9px 12px}
  .command-group{min-height:112px;padding:0 9px}
  .command-group:first-child{padding-left:0}
  .tool-tile{width:70px;min-width:70px;min-height:80px;font-size:10px}
  .extract-command .tool-tile{width:64px;min-width:64px}
  .session-command{min-width:190px}
  .editor-view>.mode-hint{width:calc(100% - 24px);margin-top:10px;padding:9px 11px}
  .loaded-files{padding:17px 12px 19px}
  .section-heading small{display:none}
  .loaded-files .source-strip{grid-template-columns:1fr;gap:8px}
  .loaded-files .source-chip{min-height:62px;padding:9px 11px}
  .pages-workspace{padding:20px 12px 32px}
  .pages-heading{align-items:flex-start}
  .pages-heading>div{display:flex;flex-direction:column;gap:3px}
  .pages-heading small{font-size:9px;line-height:1.35}
  .included-status{padding:6px 8px;font-size:9px}
  .pages-workspace .pages-stream{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .pages-workspace .page-card{padding:7px}
  .page-number-badge{top:7px;left:7px;min-width:24px;height:24px;font-size:10px}
  .pages-workspace .page-caption{font-size:9px}
  .pages-workspace .rotation-label{font-size:8px}
}

/* =========================================================
   V13 · ORDEN GLOBAL, EXTRACCIÓN A–F Y CALIDAD/PESO
   ========================================================= */
.drop-icons{flex-wrap:wrap;justify-content:center}
.drop-icons span:nth-child(4){background:#edfdf3;color:#15803d}
.drop-icons span:nth-child(5){background:#fff1f1;color:#dc2626}

.commandbar{min-height:142px;padding-top:10px;padding-bottom:11px}
.command-group{min-height:116px;padding-left:12px;padding-right:12px}
.command-group>.toolbar-label{margin-bottom:5px}
.tool-tile{min-height:82px}
.extract-command{min-width:245px}
.extract-control{
  min-height:84px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:7px;
}
.extract-counter{
  height:31px;
  display:flex;
  align-items:center;
  overflow:hidden;
  border:1px solid #dce4ed;
  border-radius:9px;
  background:#fff;
  box-shadow:0 3px 10px rgba(15,23,42,.025);
}
.extract-counter button{
  width:34px;
  height:31px;
  padding:0;
  border:0;
  color:#172033;
  background:#f7f9fc;
  font-size:17px;
  font-weight:800;
}
.extract-counter button:hover:not(:disabled){color:#0f8f6a;background:#eaf8f2}
.extract-counter button:disabled{opacity:.35;cursor:not-allowed}
.extract-counter>span{
  min-width:68px;
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:4px;
  color:#172033;
}
.extract-counter b{font-size:14px}
.extract-counter small{color:#7b899d;font-size:8px;font-weight:800}
.extract-groups{min-height:38px;display:flex;align-items:center;justify-content:center;gap:5px}
.extract-groups:empty::after{
  content:"Usa + para crear grupos";
  color:#98a4b4;
  font-size:9px;
  white-space:nowrap;
}
.extract-groups .extract-btn{
  position:relative;
  width:34px;
  height:34px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid color-mix(in srgb,var(--extract-color) 28%,#dce4ed);
  border-radius:9px;
  color:var(--extract-color);
  background:color-mix(in srgb,var(--extract-color) 7%,white);
  box-shadow:none;
  font-size:13px;
}
.extract-groups .extract-btn b{font-size:14px;line-height:1}
.extract-groups .extract-btn span{
  position:absolute;
  top:-5px;
  right:-5px;
  min-width:16px;
  height:16px;
  padding:0 4px;
  display:grid;
  place-items:center;
  border:2px solid #fff;
  border-radius:999px;
  color:#fff;
  background:var(--extract-color);
  font-size:8px;
  font-weight:950;
}
.extract-groups .extract-btn.active{
  color:#fff;
  background:var(--extract-color);
  border-color:var(--extract-color);
  box-shadow:0 6px 14px color-mix(in srgb,var(--extract-color) 22%,transparent);
}

.quality-command{min-width:340px}
.quality-panel{min-height:84px;display:flex;flex-direction:column;justify-content:center;gap:6px}
.original-weight{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:#78869a;
  font-size:9px;
  font-weight:800;
}
.original-weight b{color:#172033;font-size:10px}
.quality-options{display:flex;gap:5px}
.quality-option{
  width:96px;
  min-height:52px;
  padding:6px 5px;
  border:1px solid #dfe6ee;
  border-radius:9px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
  color:#5f6f85;
  background:#fff;
  font-size:9px;
  font-weight:850;
}
.quality-option b{color:#172033;font-size:9px}
.quality-option:hover{background:#f7f9fc;border-color:#c7d2df}
.quality-option.active{
  color:#155bdd;
  border-color:#b8d1ff;
  background:#edf4ff;
  box-shadow:0 4px 12px rgba(37,99,235,.08);
}
.quality-option.active b{color:#134fae}
.session-command{min-width:185px}

/* La franja de archivos queda deliberadamente baja. */
.loaded-files{padding-top:11px;padding-bottom:12px}
.section-heading{min-height:17px;margin-bottom:6px}
.loaded-files .source-strip{grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:8px}
.loaded-files .source-chip{min-height:48px;padding:7px 10px;border-radius:10px}
.loaded-files .source-type{min-width:39px;padding:6px 5px;font-size:9px}
.source-copy{gap:2px}
.loaded-files .source-name{font-size:10px}
.loaded-files .source-count{font-size:8px}
.loaded-files .source-icon-btn{width:24px;height:24px;font-size:18px}

/* La letra de extracción ocupa la hoja completa. */
.extract-overlay{
  position:absolute;
  inset:0;
  z-index:6;
  display:none;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:12px;
  color:#fff;
  text-align:center;
  background:color-mix(in srgb,var(--extract-color) 88%,transparent);
  backdrop-filter:saturate(.9);
}
.page-card.has-extraction .extract-overlay{display:flex}
.extract-letter{
  font-size:clamp(54px,5vw,86px);
  line-height:.9;
  font-weight:950;
  text-shadow:0 5px 18px rgba(0,0,0,.16);
}
.extract-overlay strong{font-size:11px;letter-spacing:.09em}
.extract-overlay small{max-width:130px;font-size:8px;line-height:1.3;opacity:.9}
.deleted-overlay{z-index:8}
.page-card.deleted .extract-overlay{display:none}

/* Arrastre y posición de inserción. */
.drag-grip{
  position:absolute;
  top:11px;
  right:12px;
  z-index:10;
  width:27px;
  height:27px;
  display:grid;
  place-items:center;
  border-radius:7px;
  color:#718096;
  background:rgba(255,255,255,.92);
  box-shadow:0 3px 9px rgba(15,23,42,.08);
  font-size:16px;
  cursor:grab;
}
.page-card:active .drag-grip{cursor:grabbing}
.page-card.dragging{opacity:.42}
.page-card.dragging-ghost{transform:scale(.97)}
.page-card.drop-before::after,.page-card.drop-after::after{
  content:"";
  position:absolute;
  top:-4px;
  bottom:-4px;
  z-index:20;
  width:5px;
  border-radius:6px;
  background:#2563eb;
  box-shadow:0 0 0 4px rgba(37,99,235,.13);
}
.page-card.drop-before::after{left:-11px}
.page-card.drop-after::after{right:-11px}
.pages-workspace .page-card{cursor:grab}
.pages-workspace .page-card:active{cursor:grabbing}

/* Hoja temporal utilizada para convertir Excel localmente. */
.excel-capture-page{
  width:1120px;
  min-height:790px;
  padding:34px;
  color:#172033;
  background:#fff;
  font-family:Arial,sans-serif;
}
.excel-capture-page header{
  margin-bottom:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.excel-capture-page header strong{font-size:22px}
.excel-capture-page header small{color:#64748b;font-size:12px}
.excel-capture-page table{width:100%;border-collapse:collapse;table-layout:fixed}
.excel-capture-page th,.excel-capture-page td{
  height:25px;
  padding:4px 6px;
  overflow:hidden;
  border:1px solid #cbd5e1;
  color:#1f2937;
  white-space:nowrap;
  text-overflow:ellipsis;
  font-size:11px;
}
.excel-capture-page th{color:#fff;background:#2563eb;font-weight:800}
.excel-capture-page tr:nth-child(even) td{background:#f8fafc}

@media(max-width:900px){
  .quality-command{min-width:330px}
  .extract-command{min-width:235px}
}
@media(max-width:650px){
  .commandbar{min-height:132px}
  .command-group{min-height:108px}
  .quality-command{min-width:320px}
  .quality-option{width:91px}
  .loaded-files{padding-top:9px;padding-bottom:10px}
  .drag-grip{top:8px;right:8px;width:23px;height:23px;font-size:14px}
  .extract-letter{font-size:48px}
  .extract-overlay strong{font-size:9px}
  .extract-overlay small{display:none}
}

/* =========================================================
   V14 · INTERFAZ COMPACTA, DESCARGAS, IDIOMAS Y FIRMA
   ========================================================= */
body{overflow-x:hidden}
body.modal-open{overflow:hidden}

/* Inicio completo dentro de una pantalla de escritorio. */
.upload-view.view{
  height:calc(100vh - 52px);
  min-height:620px;
  padding:14px 34px 12px;
  overflow:hidden;
}
.home-topbar{
  width:min(1500px,100%);
  min-height:46px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}
.home-topbar .home-brand{width:auto;margin:0}
.home-topbar .brand-mark{width:38px;height:38px;border-radius:10px}
.language-control{
  height:36px;
  display:flex;
  align-items:center;
  gap:7px;
  padding:0 9px;
  border:1px solid #dce4ed;
  border-radius:10px;
  color:#53637a;
  background:#fff;
}
.language-select{
  min-width:96px;
  border:0;
  outline:0;
  color:#26364b;
  background:transparent;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
}
.upload-view .hero{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.upload-view .eyebrow{font-size:10px}
.upload-view .hero h1{margin:6px auto;font-size:clamp(34px,3.25vw,50px)}
.upload-view .hero-copy{margin:0 auto 13px;font-size:15px;line-height:1.35}
.upload-view .primary-btn{align-self:center;padding:12px 22px;font-size:14px;border-radius:11px}
.upload-view .format-note{margin:6px 0 9px;font-size:10px}
.upload-view .drop-zone{flex:0 1 245px;min-height:190px;padding:16px;border-radius:18px}
.upload-view .drop-icons{gap:6px;margin-bottom:10px}
.upload-view .drop-icons span{min-width:43px;height:43px;border-radius:12px;font-size:10px}
.upload-view .drop-icons span:nth-child(3){font-size:16px}
.upload-view .drop-zone h2{font-size:22px;margin-bottom:3px}
.upload-view .drop-zone>p{font-size:13px}
.upload-view .drop-meta{margin-top:13px;font-size:10px}
.upload-view .local-note{margin-top:9px;padding:9px 13px;border-radius:11px}
.upload-view .local-note p{font-size:10px;line-height:1.25}
.upload-view .check{width:25px;height:25px}

/* Pie común. */
.site-footer{
  min-height:52px;
  padding:10px 34px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  border-top:1px solid #e1e7ef;
  color:#607087;
  background:#fff;
  font-size:10px;
}
.site-footer strong{color:#26364b;white-space:nowrap}
.site-footer nav{display:flex;align-items:center;justify-content:flex-end;gap:17px;flex-wrap:wrap}
.site-footer button{padding:0;border:0;color:#607087;background:transparent;font-size:10px}
.site-footer button:hover{color:#e31b2b;text-decoration:underline}

/* Cabecera y herramientas del editor. */
.editor-view.view{min-height:calc(100vh - 52px);padding:0 0 28px;background:#f6f8fc}
.editor-topbar-inner{min-height:74px;padding:9px 34px}
.editor-primary-actions{gap:9px}
.editor-primary-actions .editor-language{height:38px}
.editor-primary-actions .reset-btn,.editor-primary-actions .generate-btn{min-height:42px}
.editor-toolbar{margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;position:relative!important;top:auto!important;background:#fff!important}
.commandbar{
  min-height:112px!important;
  padding:7px 32px 8px!important;
  justify-content:center!important;
  gap:0!important;
  overflow-x:auto;
  background:#fff;
}
.command-group{min-height:96px!important;padding:5px 12px!important}
.command-group>.toolbar-label{margin-bottom:3px!important;font-size:9px!important}
.tool-tile{min-height:69px!important;min-width:70px;padding:5px 8px!important;font-size:10px!important}
.tool-icon-svg{width:22px!important;height:22px!important}
.file-command{min-width:112px!important}
.rotate-command{min-width:270px!important}
.delete-command{min-width:104px!important}
.extract-command{min-width:220px!important}
.extract-control{min-height:69px!important;gap:4px!important}
.extract-counter{height:28px!important}
.extract-counter button{height:28px!important}
.extract-groups{min-height:31px!important}
.extract-empty{color:#98a4b4;font-size:8px;white-space:nowrap}
.extract-groups .extract-btn{width:29px!important;height:29px!important;border-radius:7px!important}
.extract-groups .extract-btn span{min-width:14px!important;height:14px!important;font-size:7px!important}

.quality-command{min-width:214px!important}
.quality-panel{min-height:69px!important;gap:3px!important}
.original-weight{font-size:8px!important;padding:0 3px}
.original-weight b{font-size:9px!important}
.quality-options{width:100%;display:flex!important;flex-direction:column!important;gap:2px!important}
.quality-option{
  position:relative;
  width:100%!important;
  min-height:18px!important;
  height:18px;
  padding:1px 23px 1px 7px!important;
  flex-direction:row!important;
  justify-content:space-between!important;
  gap:6px!important;
  border-radius:6px!important;
  font-size:8px!important;
}
.quality-option b{font-size:8px!important}
.quality-option i{position:absolute;right:7px;display:none;color:#155bdd;font-style:normal;font-weight:950}
.quality-option.active i{display:block}
.signature-command{min-width:112px!important}
.signature-tool{color:#0f766e}
.signature-tool .tool-icon-svg{stroke:#0f766e}

/* Franja de archivos todavía más baja. */
.loaded-files{padding:6px 30px 7px!important}
.section-heading{min-height:10px!important;margin:0 0 3px!important}
.section-heading strong{font-size:9px!important;letter-spacing:.08em}
.loaded-files .source-strip{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))!important;gap:6px!important}
.loaded-files .source-chip{min-height:34px!important;height:34px!important;padding:3px 7px!important;border-radius:8px!important}
.loaded-files .source-type{min-width:32px!important;padding:4px!important;font-size:8px!important}
.loaded-files .source-name{font-size:9px!important}
.loaded-files .source-count{font-size:7px!important}
.loaded-files .source-icon-btn{width:20px!important;height:20px!important;font-size:14px!important}

.pages-workspace{padding:10px 30px 24px!important}
.pages-heading{margin-bottom:8px!important}
.pages-heading-copy{width:100%;display:flex!important;align-items:center!important;gap:10px!important;flex-wrap:wrap}
.pages-heading-copy>strong{font-size:11px!important}
.page-stats{display:flex;align-items:center;gap:5px}
.page-stats span{padding:3px 7px;border:1px solid #dde5ee;border-radius:7px;color:#6b7b91;background:#fff;font-size:8px;font-weight:800;white-space:nowrap}
.page-stats b{color:#172033;font-size:9px}
.page-stats small{font-size:8px!important;color:inherit!important}
.drag-hint{margin-left:2px;font-size:9px!important}

/* Ventanas comunes. */
.app-modal{
  position:fixed;
  inset:0;
  z-index:10050;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(8,15,28,.72);
  backdrop-filter:blur(6px);
}
.modal-card{
  width:min(610px,94vw);
  max-height:90vh;
  overflow:auto;
  padding:20px;
  border-radius:18px;
  background:#fff;
  box-shadow:0 28px 80px rgba(0,0,0,.30);
}
.modal-card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:15px;margin-bottom:8px}
.modal-card h2{margin:2px 0 0;font-size:22px;letter-spacing:-.025em}
.modal-kicker{color:#e31b2b;font-size:9px;font-weight:950;letter-spacing:.16em}
.modal-close{width:34px;height:34px;display:grid;place-items:center;border:0;border-radius:9px;color:#334155;background:#f1f5f9;font-size:22px}
.modal-copy{margin:3px 0 14px;color:#64748b;font-size:12px;line-height:1.45}
.format-selector{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:13px}
.format-choice{min-height:72px;padding:10px;display:flex;align-items:center;gap:11px;border:1px solid #dce4ed;border-radius:12px;color:#53637a;background:#fff;text-align:left}
.format-choice b{width:42px;height:42px;display:grid;place-items:center;border-radius:10px;color:#e31b2b;background:#fff0f2;font-size:13px}
.format-choice span{font-size:11px;font-weight:850}
.format-choice.active{border-color:#9ec1ff;color:#155bdd;background:#edf4ff;box-shadow:0 5px 14px rgba(37,99,235,.08)}
.format-choice.active b{color:#fff;background:#2563eb}
.modal-primary{width:100%;min-height:44px;border:0;border-radius:11px;color:#fff;background:linear-gradient(135deg,#f12c3c,#dc1224);font-size:12px;font-weight:900;box-shadow:0 9px 20px rgba(236,31,49,.18)}
.privacy-reminder{display:block;margin-top:9px;color:#8491a3;text-align:center;font-size:9px}
.download-group-list{display:flex;flex-direction:column;gap:7px}
.download-group-button{width:100%;min-height:56px;padding:7px 12px;display:grid;grid-template-columns:38px 1fr auto;grid-template-rows:1fr 1fr;align-items:center;column-gap:10px;border:1px solid color-mix(in srgb,var(--extract-color) 28%,#dce4ed);border-radius:11px;color:#26364b;background:color-mix(in srgb,var(--extract-color) 5%,white);text-align:left}
.download-group-button>span{grid-row:1/3;width:36px;height:36px;display:grid;place-items:center;border-radius:9px;color:#fff;background:var(--extract-color);font-weight:950}
.download-group-button strong{align-self:end;font-size:11px}.download-group-button small{align-self:start;color:#77869a;font-size:9px}.download-group-button>b{grid-column:3;grid-row:1/3;color:var(--extract-color);font-size:20px}

/* Firma: creación y biblioteca local. */
.signature-card{width:min(720px,95vw)}
.signature-tabs{display:flex;gap:5px;margin:10px 0;padding:4px;border-radius:10px;background:#f1f5f9}
.signature-tabs button{flex:1;min-height:34px;border:0;border-radius:8px;color:#607087;background:transparent;font-size:11px;font-weight:850}
.signature-tabs button.active{color:#155bdd;background:#fff;box-shadow:0 3px 9px rgba(15,23,42,.08)}
.signature-panel{margin:8px 0}
.signature-drop{width:100%;min-height:105px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;border:2px dashed #cbd6e3;border-radius:13px;color:#53637a;background:#f8fafc}
.signature-drop>span{font-size:25px;color:#2563eb}.signature-drop strong{font-size:12px}.signature-drop small{font-size:9px;color:#8a98aa}
.uploaded-signature-preview{min-height:75px;margin-top:8px;padding:8px;display:flex;align-items:center;gap:12px;border:1px solid #dce4ed;border-radius:11px;background:#fff}
.uploaded-signature-preview img{width:130px;height:58px;object-fit:contain;background-image:linear-gradient(45deg,#f1f5f9 25%,transparent 25%),linear-gradient(-45deg,#f1f5f9 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#f1f5f9 75%),linear-gradient(-45deg,transparent 75%,#f1f5f9 75%);background-size:12px 12px;background-position:0 0,0 6px,6px -6px,-6px 0}
.uploaded-signature-preview span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#53637a;font-size:10px}
.signature-panel>p{margin:4px 0 7px;color:#64748b;font-size:11px}
#signatureCanvas{width:100%;height:190px;display:block;border:1px solid #cdd7e3;border-radius:10px;background:linear-gradient(#fff,#fff) padding-box,repeating-linear-gradient(0deg,#fff 0 29px,#edf1f5 30px) border-box;touch-action:none;cursor:crosshair}
.draw-controls{display:flex;justify-content:flex-end;gap:7px;margin-top:6px}.draw-controls button{padding:6px 10px;border:1px solid #dce4ed;border-radius:7px;color:#53637a;background:#fff;font-size:10px;font-weight:800}
.remember-signature{margin:10px 0;display:flex;align-items:center;gap:8px;color:#53637a;font-size:10px}.remember-signature input{accent-color:#2563eb}
.saved-signatures-head{margin:15px 0 7px;display:flex;align-items:baseline;justify-content:space-between;gap:10px}.saved-signatures-head strong{font-size:11px}.saved-signatures-head small{color:#8491a3;font-size:9px}
.saved-signatures-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.saved-signature{position:relative;min-width:0;border:1px solid #dce4ed;border-radius:10px;overflow:hidden;background:#f8fafc}
.saved-signature-use{width:100%;height:78px;padding:6px;border:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;background:transparent}.saved-signature-use img{max-width:100%;height:48px;object-fit:contain}.saved-signature-use span{font-size:8px;font-weight:850;color:#53637a}
.saved-signature-delete{position:absolute;top:4px;right:4px;width:20px;height:20px;border:0;border-radius:6px;color:#c51c30;background:#fff0f2;font-size:15px}
.empty-signatures{grid-column:1/-1;margin:0;padding:13px;border:1px dashed #dce4ed;border-radius:9px;color:#8a98aa;text-align:center;font-size:10px}

/* Firma colocada sobre la página. */
.preview-viewport{position:relative!important}
.signature-layer{position:absolute;z-index:20;pointer-events:none}
.placed-signature{position:absolute;min-width:42px;min-height:18px;border:1px dashed #2563eb;background:rgba(255,255,255,.13);cursor:move;pointer-events:auto;touch-action:none}
.placed-signature img{width:100%;height:100%;display:block;object-fit:fill;pointer-events:none;user-select:none}
.remove-placed-signature{position:absolute;top:-11px;right:-11px;width:22px;height:22px;display:grid;place-items:center;border:2px solid #fff;border-radius:50%;color:#fff;background:#dc2639;font-size:14px;line-height:1;box-shadow:0 3px 8px rgba(0,0,0,.18)}
.signature-resize{position:absolute;right:-6px;bottom:-6px;width:13px;height:13px;border:2px solid #fff;border-radius:3px;background:#2563eb;cursor:nwse-resize}
.preview-action-btn.signature{color:#0f766e;border-color:#99d5c3;background:#eefaf6}

.info-card{width:min(590px,94vw)}
.info-body{color:#53637a;font-size:12px;line-height:1.65}.info-body p{margin:8px 0}

@media(max-height:720px) and (min-width:701px){
  .upload-view.view{height:auto;min-height:calc(100vh - 52px);overflow:visible}
  .upload-view .hero{padding:8px 0}
  .upload-view .drop-zone{min-height:175px;flex-basis:190px}
  .upload-view .local-note{display:none}
}
@media(max-width:900px){
  .upload-view.view{height:auto;min-height:calc(100vh - 52px);overflow:visible;padding:14px 18px 22px}
  .editor-topbar-inner{padding:10px 18px}
  .editor-language{order:3}
  .commandbar{justify-content:flex-start!important;padding-left:14px!important;padding-right:14px!important}
  .loaded-files,.pages-workspace{padding-left:14px!important;padding-right:14px!important}
  .site-footer{align-items:flex-start;flex-direction:column;padding:14px 18px}.site-footer nav{justify-content:flex-start}
}
@media(max-width:650px){
  .home-topbar{align-items:flex-start}.language-select{min-width:78px}
  .upload-view .hero h1{font-size:31px}.upload-view .hero-copy{font-size:14px}.upload-view .drop-zone{min-height:230px}
  .editor-primary-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.editor-language{grid-column:1/3;justify-self:end}.generate-btn{grid-column:auto!important}
  .loaded-files .source-strip{grid-template-columns:1fr!important}
  .pages-heading-copy{align-items:flex-start!important;flex-direction:column}.drag-hint{line-height:1.35}
  .format-selector{grid-template-columns:1fr}.saved-signatures-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .preview-actions-label{display:none}.preview-action-btn{min-width:0!important;flex:1;font-size:9px!important}
}

/* ================================================================
   V15 · Pantalla completa, imágenes insertadas y lectura más clara
   ================================================================ */

/* La columna sigue compacta, pero los nombres y pesos ya no quedan diminutos. */
.quality-command{min-width:228px!important}
.original-weight{padding:0 5px!important;font-size:9.5px!important;line-height:1.2}
.original-weight b{font-size:10.5px!important}
.quality-option{
  min-height:20px!important;
  height:20px!important;
  padding:2px 25px 2px 8px!important;
  font-size:9.5px!important;
  line-height:1.1;
}
.quality-option b{font-size:9.5px!important}
.home-topbar .language-select,.editor-language .language-select{min-width:132px}

/* Herramienta Imagen, junto a Firma. */
.image-command{min-width:112px!important}
.image-tool-stack{min-height:69px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px}
.image-tool{min-height:53px!important;color:#7c3aed}
.image-tool .tool-icon-svg{stroke:#7c3aed;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.view-images-btn{
  min-width:62px;height:17px;padding:0 7px;border:0;border-radius:6px;
  color:#6d28d9;background:#f2ecff;font-size:8px;font-weight:900;line-height:17px;
}
.view-images-btn:hover{background:#e8ddff}.view-images-btn b{margin-left:3px}
.preview-action-btn.image{color:#6d28d9;border-color:#c4b5fd;background:#f5f1ff}

/* La capa editable coincide exactamente con el lienzo de la página. */
.image-layer{position:absolute;z-index:18;pointer-events:none}
.placed-image{
  position:absolute;min-width:42px;min-height:28px;border:1px dashed #7c3aed;
  background:rgba(255,255,255,.12);cursor:move;pointer-events:auto;touch-action:none;
}
.placed-image img{width:100%;height:100%;display:block;object-fit:fill;pointer-events:none;user-select:none}
.remove-placed-image{
  position:absolute;top:-11px;right:-11px;width:22px;height:22px;display:grid;place-items:center;
  border:2px solid #fff;border-radius:50%;color:#fff;background:#dc2639;font-size:14px;line-height:1;
  box-shadow:0 3px 8px rgba(0,0,0,.18)
}
.image-resize{position:absolute;right:-6px;bottom:-6px;width:13px;height:13px;border:2px solid #fff;border-radius:3px;background:#7c3aed;cursor:nwse-resize}

/* Biblioteca de imágenes de la sesión. */
.image-library-card{width:min(760px,95vw)}
.image-upload-btn{
  width:100%;min-height:78px;margin:8px 0 12px;padding:10px;border:2px dashed #c8b5ef;
  border-radius:13px;display:grid;grid-template-columns:38px 1fr;grid-template-rows:1fr 1fr;
  align-items:center;text-align:left;color:#5b21b6;background:#faf8ff;
}
.image-upload-btn>span{grid-row:1/3;width:32px;height:32px;display:grid;place-items:center;border-radius:9px;color:#fff;background:#7c3aed;font-size:22px}
.image-upload-btn strong{align-self:end;font-size:12px}.image-upload-btn small{align-self:start;color:#7c6f91;font-size:9px}
.image-upload-btn:hover{border-color:#7c3aed;background:#f6f1ff}
.image-library-head{margin:5px 0 7px;display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.image-library-head strong{font-size:11px}.image-library-head small{color:#8491a3;font-size:9px}
.image-library-list{max-height:310px;overflow:auto;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:1px}
.image-library-item{position:relative;min-width:0;border:1px solid #dfe4ec;border-radius:11px;overflow:hidden;background:#f8fafc}
.use-page-image{width:100%;min-height:126px;padding:7px;border:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;background:transparent}
.use-page-image img{width:100%;height:82px;object-fit:contain;border-radius:6px;background:#fff}
.use-page-image strong{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#263247;font-size:9px}
.use-page-image small{color:#6d28d9;font-size:8px;font-weight:850}
.delete-page-image{position:absolute;top:5px;right:5px;width:21px;height:21px;border:0;border-radius:6px;color:#c51c30;background:rgba(255,240,242,.94);font-size:15px}
.empty-images{grid-column:1/-1;margin:0;padding:24px;border:1px dashed #dce4ed;border-radius:10px;color:#8491a3;text-align:center;font-size:10px}

/* Pantalla completa real y alternativa para navegadores sin la API nativa. */
.fullscreen-preview-btn{white-space:nowrap}
.fullscreen-preview-btn.active{color:#fff!important;border-color:#173b79!important;background:#173b79!important}
.preview-shell:fullscreen{
  width:100vw!important;height:100vh!important;max-width:none!important;max-height:none!important;
  margin:0!important;border:0!important;border-radius:0!important;background:#fff;
}
.preview-shell:fullscreen .preview-stage{min-height:0;flex:1}
.preview-modal.fullscreen-mode{padding:0!important}
.preview-modal.fullscreen-mode .preview-shell{
  width:100vw!important;height:100vh!important;max-width:none!important;max-height:none!important;
  border-radius:0!important;
}
.preview-modal.fullscreen-mode .preview-stage{min-height:0;flex:1}

html[dir="rtl"] .preview-title-block,html[dir="rtl"] .modal-card{text-align:right}
html[dir="rtl"] .language-select,html[dir="rtl"] .source-chip{direction:rtl}

@media(max-width:900px){
  .quality-command{min-width:215px!important}
  .image-library-list{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:650px){
  .image-library-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .fullscreen-preview-btn span{display:none}
  .preview-head{gap:5px}.preview-zoom-tools{gap:3px}
  .home-topbar .language-select,.editor-language .language-select{min-width:96px}
}

/* V16 · prioridad final sobre estilos heredados de versiones anteriores */
html,body{max-width:100%!important;overflow-x:hidden!important}
body{background:#f6f8fc!important}
main{min-height:calc(100vh - 46px)!important}
.editor-view.view{display:block!important;min-height:calc(100vh - 46px)!important;padding:0!important;background:#f6f8fc!important}
.editor-topbar{position:sticky!important;top:0!important;z-index:160!important;background:rgba(255,255,255,.97)!important;border-bottom:1px solid #dde5ef!important;backdrop-filter:blur(12px)}
.editor-topbar-inner{min-height:68px!important;padding:7px 30px!important}
.editor-toolbar{position:sticky!important;top:68px!important;z-index:150!important;margin:0!important;padding:0!important;border:0!important;border-bottom:1px solid #dfe7f0!important;border-radius:0!important;background:rgba(255,255,255,.98)!important;box-shadow:0 7px 18px rgba(15,23,42,.055)!important}
.commandbar{width:100%!important;min-height:108px!important;padding:6px 22px 7px!important;display:flex!important;justify-content:center!important;align-items:stretch!important;gap:0!important;overflow-x:auto!important;overflow-y:hidden!important}
.command-group{min-height:94px!important;padding:4px 12px 3px!important;border-left:1px solid #e2e8f0!important;gap:3px!important}
.command-group:first-child{border-left:0!important}
.toolbar-label{height:15px!important;margin:0!important;font-size:8.5px!important;line-height:15px!important}
.command-buttons{min-height:68px!important;gap:4px!important}
.tool-tile{position:relative!important;min-width:66px!important;width:auto!important;height:67px!important;padding:5px 7px!important;border:1px solid transparent!important;border-radius:11px!important;font-size:9.5px!important;line-height:1.1!important}
.tool-icon-svg{width:21px!important;height:21px!important;margin-bottom:4px!important}
.file-command{min-width:136px!important}.rotate-command{min-width:244px!important}.delete-command{min-width:88px!important}.extract-command{min-width:216px!important}.prepare-command{min-width:154px!important}.signature-command{min-width:76px!important}.image-command{min-width:83px!important}
.quality-command{min-width:260px!important}
.quality-panel{min-height:68px!important;width:100%!important;display:grid!important;grid-template-columns:1fr 91px!important;grid-template-rows:18px 1fr!important;column-gap:6px!important;row-gap:2px!important}
.original-weight{grid-column:1/2!important;grid-row:1!important;font-size:10px!important;padding:0 3px!important}.original-weight span,.original-weight b{font-size:10px!important}
.quality-options{grid-column:1!important;grid-row:2!important;width:100%!important;display:flex!important;flex-direction:column!important;gap:2px!important}
.quality-option{width:100%!important;min-height:16px!important;height:16px!important;padding:0 19px 0 7px!important;border-radius:7px!important;display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important}
.quality-option span,.quality-option b{font-size:9.5px!important;line-height:1!important}
.exact-weight-btn{grid-column:2!important;grid-row:1/3!important}
.pages-workspace{min-height:calc(100vh - 268px)!important;padding:11px 28px 23px!important}
.pages-workspace .pages-stream{grid-template-columns:repeat(auto-fill,minmax(155px,1fr))!important;gap:11px!important}
.pages-workspace .page-card{padding:7px!important;border-radius:13px!important}
.site-footer{min-height:46px!important;padding:8px 28px!important}
@media(max-width:1250px){.commandbar{justify-content:flex-start!important}}
@media(max-width:760px){.editor-topbar-inner{padding:8px 12px!important}.editor-toolbar{top:114px!important}.commandbar{padding-left:8px!important;padding-right:8px!important}.pages-workspace{padding:10px 11px 20px!important}.pages-workspace .pages-stream{grid-template-columns:repeat(2,minmax(0,1fr))!important}}

/* ================================================================
   V17 · Edición visual, OCR y seguridad
   ================================================================ */
.edit-command{min-width:232px!important}.document-command{min-width:368px!important}.security-command{min-width:160px!important}
.edit-tool{color:#0f766e!important}.highlight-tool{color:#a16207!important}.crop-tool{color:#475569!important}
.ocr-tool{color:#0369a1!important}.protect-tool{color:#0f766e!important}.unlock-tool{color:#7c3aed!important}
.color-dot{display:inline-block;width:9px;height:9px;margin-left:3px;border:1px solid rgba(0,0,0,.16);border-radius:50%;background:#ffe066;vertical-align:-1px}
.secure-badge{position:absolute!important;top:3px!important;right:4px!important;width:16px!important;height:16px!important;display:grid!important;place-items:center!important;border-radius:50%!important;color:#fff!important;background:#16a34a!important;font-size:9px!important}
.tool-tile.active{border-color:#89b1ff!important;background:#edf4ff!important;box-shadow:inset 0 0 0 1px rgba(37,99,235,.08)!important}

.preview-shell{height:min(94vh,940px)!important;max-height:94vh!important}
.preview-stage{min-height:260px!important}
.preview-footer{flex:0 0 auto;border-top:1px solid #dce4ed;background:#fff}
.preview-edit-toolbar{display:flex;align-items:center;gap:4px;padding:6px 8px;overflow-x:auto;border-bottom:1px solid #edf1f5;background:#f8fafc;scrollbar-width:thin}
.preview-edit-toolbar>button{min-width:66px;height:42px;padding:4px 7px;display:flex;align-items:center;justify-content:center;gap:4px;border:1px solid transparent;border-radius:8px;color:#53637a;background:transparent;font-size:14px;font-weight:900;white-space:nowrap}
.preview-edit-toolbar>button span{font-size:8.5px;font-weight:850}.preview-edit-toolbar>button:hover{border-color:#d5dee9;background:#fff}.preview-edit-toolbar>button.active{border-color:#9fc0ff;color:#155bdd;background:#eaf2ff}
.preview-edit-toolbar>button.danger{color:#c51c30}.preview-edit-toolbar>button:disabled{opacity:.35;cursor:not-allowed}
.preview-edit-divider{width:1px;height:28px;flex:0 0 1px;background:#dce4ed}
.highlight-mark{width:18px;height:8px;display:inline-block;border-radius:2px;background:#ffe066;transform:rotate(-4deg)}
.preview-tool-options{min-height:42px;padding:5px 10px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;border-bottom:1px solid #edf1f5;background:#fff}
.tool-option-group{display:flex;align-items:center;gap:5px;color:#607087;font-size:9px;font-weight:850}
.tool-option-group input[type="range"]{width:90px}.tool-option-group input[type="number"]{width:62px;height:28px;padding:4px 6px;border:1px solid #d7e0ea;border-radius:7px}
.color-swatch{width:20px;height:20px;padding:0;border:2px solid #fff;border-radius:50%;background:var(--swatch);box-shadow:0 0 0 1px #cbd5e1}.color-swatch.active{box-shadow:0 0 0 2px #2563eb}
#customEditColor{width:25px;height:23px;padding:1px;border:1px solid #cbd5e1;border-radius:6px;background:#fff}
.apply-mini{border-color:#155bdd!important;color:#fff!important;background:#155bdd!important}.preview-tool-options small{margin-left:auto;color:#8491a3;font-size:9px}
.preview-actions{min-height:48px!important;padding:5px 9px!important;border:0!important}

.annotation-canvas{position:absolute;z-index:16;display:block;pointer-events:none;touch-action:none}
.annotation-canvas.tool-active{pointer-events:auto;cursor:crosshair}.annotation-canvas.tool-select{pointer-events:auto;cursor:default}
.annotation-canvas.tool-text,.annotation-canvas.tool-correct{cursor:text}.annotation-canvas.tool-crop{cursor:crosshair}
.signature-layer{z-index:20!important}.image-layer{z-index:19!important}

.documents-card{width:min(760px,calc(100vw - 28px))!important;padding:16px!important}
.documents-card>header{margin-bottom:5px!important}.documents-card h2{font-size:20px!important}
.documents-summary{margin-bottom:7px!important}.documents-summary>span{padding:5px 8px!important}.documents-summary>button{padding:7px 10px!important}
.documents-list{gap:5px!important;max-height:58vh!important}
.documents-list .source-chip{min-height:42px!important;height:42px!important;padding:4px 8px!important;gap:8px!important}
.documents-list .source-type{min-width:42px!important;height:24px!important;line-height:24px!important}.documents-list .source-name{font-size:10px!important}.documents-list .source-count{margin-top:1px!important;font-size:8px!important}.documents-list .source-icon-btn{width:25px!important;height:25px!important}

.compact-editor-card{width:min(560px,94vw)}.field-stack{display:flex;flex-direction:column;gap:5px;margin:10px 0;color:#53637a;font-size:10px;font-weight:850}
.field-stack input,.field-stack textarea,.field-stack select,.settings-grid input,.settings-grid select{width:100%;min-height:38px;padding:8px 10px;border:1px solid #d5dee9;border-radius:9px;color:#172033;background:#fff;font:inherit;outline:none}
.field-stack textarea{resize:vertical}.field-stack input:focus,.field-stack textarea:focus,.settings-grid input:focus,.settings-grid select:focus{border-color:#7da7f7;box-shadow:0 0 0 3px rgba(37,99,235,.08)}
.settings-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.modal-secondary{width:100%;min-height:40px;margin-top:7px;border:1px solid #d7e0ea;border-radius:10px;color:#53637a;background:#fff;font-size:11px;font-weight:850}
.password-field{display:grid;grid-template-columns:1fr auto}.password-field input{border-radius:9px 0 0 9px}.password-field button{padding:0 12px;border:1px solid #d5dee9;border-left:0;border-radius:0 9px 9px 0;color:#155bdd;background:#f5f8fd;font-size:10px;font-weight:850}
.progress-wrap{margin:12px 0}.progress-wrap>div{height:9px;overflow:hidden;border-radius:8px;background:#e8eef5}.progress-wrap>div>span{display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2563eb,#06b6d4);transition:width .2s}.progress-wrap small{display:block;margin-top:5px;color:#64748b;font-size:9px}
.search-card{width:min(720px,95vw)}.search-input-row{display:grid;grid-template-columns:1fr auto;gap:7px}.search-input-row input{min-height:42px;padding:9px 11px;border:1px solid #d5dee9;border-radius:10px}.search-input-row button{padding:0 18px;border:0;border-radius:10px;color:#fff;background:#155bdd;font-weight:900}
.search-results-list{max-height:50vh;margin-top:8px;overflow:auto;display:flex;flex-direction:column;gap:5px}.search-result{width:100%;padding:8px 10px;display:grid;grid-template-columns:42px 1fr;gap:8px;border:1px solid #e0e7ef;border-radius:9px;color:#27364c;background:#fff;text-align:left}.search-result b{width:36px;height:30px;display:grid;place-items:center;border-radius:7px;color:#155bdd;background:#edf4ff}.search-result span{font-size:10px;line-height:1.4}.search-result mark{background:#ffe066}
.watermark-preview-image{max-width:160px;max-height:72px;object-fit:contain}

@media(max-width:900px){
  .preview-shell{width:98vw!important;height:96vh!important;max-height:96vh!important}
  .preview-edit-toolbar>button{min-width:58px}.preview-edit-toolbar>button span{display:none}
  .preview-tool-options{gap:7px}.preview-tool-options small{width:100%;margin-left:0}
  .settings-grid.three{grid-template-columns:1fr}.document-command{min-width:350px!important}
}

/* ================================================================
   V19 · Franja única compacta y búsqueda directa
   Estas reglas van al final para prevalecer sobre versiones anteriores.
   ================================================================ */
.editor-topbar{position:sticky!important;top:0!important}
.editor-topbar-inner{min-height:68px!important;padding:7px 24px!important;gap:14px!important}
.editor-primary-actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;min-width:0!important}
.live-search-control{
  width:350px;height:44px;min-width:300px;padding:0 5px 0 11px;display:grid;
  grid-template-columns:18px minmax(90px,1fr) auto 27px 27px 27px;align-items:center;gap:4px;
  border:1px solid #cfdbea;border-radius:13px;background:#f8fbff;
  box-shadow:0 4px 14px rgba(30,64,175,.06);transition:.18s ease
}
.live-search-control:focus-within{border-color:#6e9eea;background:#fff;box-shadow:0 0 0 3px rgba(37,99,235,.10),0 7px 18px rgba(30,64,175,.08)}
.live-search-control.has-results{border-color:#eab308;background:#fffdf2}.live-search-control.no-results{border-color:#f0a7ae;background:#fffafb}
.live-search-control>svg{width:17px;height:17px;fill:none;stroke:#2563eb;stroke-width:2;stroke-linecap:round}
.live-search-control input{min-width:0;width:100%;height:38px;padding:0;border:0;outline:0;color:#172033;background:transparent;font-size:11px;font-weight:700}
.live-search-control input::placeholder{color:#8a98aa;font-weight:650}.live-search-control input::-webkit-search-cancel-button{display:none}
.live-search-status{max-width:94px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#64748b;font-size:8px;font-weight:850;text-align:right}
.live-search-control.has-results .live-search-status{color:#a16207}.live-search-control.no-results .live-search-status{color:#be123c}
.live-search-control>button{width:27px;height:27px;padding:0;display:grid;place-items:center;border:1px solid #d8e2ee;border-radius:7px;color:#315278;background:#fff;font-size:13px;font-weight:950}
.live-search-control>button:hover:not(:disabled){color:#fff;border-color:#2563eb;background:#2563eb}.live-search-control>button:disabled{opacity:.35;cursor:not-allowed}
.live-search-control .clear-live-search{visibility:hidden;color:#be123c}.live-search-control .clear-live-search.visible{visibility:visible}

.editor-toolbar{position:sticky!important;top:68px!important;height:112px!important;min-height:112px!important;overflow:hidden!important;background:#fff!important}
.commandbar{
  width:100%!important;max-width:1900px!important;height:112px!important;min-height:112px!important;margin:0 auto!important;padding:5px 8px 6px!important;
  display:grid!important;grid-template-columns:110px 180px 140px minmax(460px,620px) 180px 145px 105px 125px!important;
  justify-content:center!important;align-items:stretch!important;gap:0!important;overflow:hidden!important;flex-wrap:nowrap!important
}
.command-group{
  --accent:#2563eb;min-width:0!important;width:auto!important;height:100px!important;min-height:100px!important;
  padding:3px 7px 5px!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;
  justify-content:flex-start!important;gap:3px!important;border:0!important;border-right:1px solid #dde6f0!important;background:transparent!important;overflow:hidden!important
}
.command-group:last-child{border-right:0!important}.file-command{--accent:#155bdd}.page-command{--accent:#4756c7}.extract-command{--accent:#0f8f6a}.edit-command{--accent:#2563eb}.document-command{--accent:#7c3aed}.optimization-command{--accent:#0e7490}.insert-command{--accent:#a855f7}.security-command{--accent:#0f9f6e}
.command-group>.toolbar-label,.toolbar-label{
  height:13px!important;min-height:13px!important;margin:0!important;display:block!important;
  color:var(--accent)!important;font-size:7.5px!important;font-weight:950!important;line-height:13px!important;letter-spacing:.15em!important;text-align:center!important
}
.command-buttons{width:100%!important;height:76px!important;min-height:76px!important;margin:0!important;display:grid!important;gap:3px!important;align-items:stretch!important;justify-content:stretch!important}
.page-command .command-buttons,.document-command .command-buttons{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,36px)!important}
.edit-command .command-buttons{grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:repeat(2,36px)!important}
.file-command .command-buttons,.insert-command .command-buttons,.security-command .command-buttons{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:76px!important}
.tool-tile{
  --tool:var(--accent);min-width:0!important;width:100%!important;height:36px!important;min-height:36px!important;margin:0!important;padding:2px 3px!important;
  display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:1px!important;
  border:1px solid color-mix(in srgb,var(--tool) 17%,#dbe4ef)!important;border-radius:8px!important;
  color:var(--tool)!important;background:color-mix(in srgb,var(--tool) 6%,white)!important;box-shadow:0 2px 5px rgba(15,23,42,.025)!important;
  font-size:7px!important;line-height:1!important;transition:.16s ease!important
}
.file-command .tool-tile,.insert-command .tool-tile,.security-command .tool-tile{height:76px!important;min-height:76px!important;border-radius:10px!important}
.tool-tile:hover:not(:disabled){transform:translateY(-1px)!important;border-color:color-mix(in srgb,var(--tool) 45%,#cbd5e1)!important;background:color-mix(in srgb,var(--tool) 11%,white)!important;box-shadow:0 6px 13px color-mix(in srgb,var(--tool) 12%,transparent)!important}
.tool-tile:disabled{opacity:.57!important;filter:saturate(.72)!important;cursor:not-allowed!important}.tool-tile.active{color:#fff!important;border-color:var(--tool)!important;background:var(--tool)!important;box-shadow:0 6px 14px color-mix(in srgb,var(--tool) 26%,transparent)!important}
.tool-tile>span:last-child{font-size:6.8px!important;font-weight:900!important;line-height:1.05!important;text-align:center!important}.file-command .tool-tile>span:last-child,.insert-command .tool-tile>span:last-child,.security-command .tool-tile>span:last-child{font-size:7.8px!important}
.tool-glyph{height:16px!important;min-height:16px!important;display:grid!important;place-items:center!important;color:currentColor!important;font-size:16px!important;line-height:1!important}.file-command .tool-glyph,.insert-command .tool-glyph,.security-command .tool-glyph{height:25px!important;font-size:21px!important}
.edit-command .tool-tile:nth-child(1){--tool:#0f8f6a}.edit-command .tool-tile:nth-child(2){--tool:#2563eb}.edit-command .tool-tile:nth-child(3){--tool:#7c3aed}.edit-command .tool-tile:nth-child(4){--tool:#d69e00}.edit-command .tool-tile:nth-child(5){--tool:#0891b2}.edit-command .tool-tile:nth-child(6){--tool:#8b5cf6}.edit-command .tool-tile:nth-child(7){--tool:#475569}.edit-command .tool-tile:nth-child(8){--tool:#dc2639}.edit-command .tool-tile:nth-child(9),.edit-command .tool-tile:nth-child(10){--tool:#315278}
.page-command .tool-tile:nth-child(4){--tool:#dc2639}.document-command .tool-tile:nth-child(2){--tool:#64748b}.document-command .tool-tile:nth-child(3){--tool:#d97706}.document-command .tool-tile:nth-child(4){--tool:#0891b2}.insert-command .tool-tile:first-child{--tool:#0f8f6a}.insert-command .tool-tile:last-child{--tool:#7c3aed}.security-command .tool-tile:last-child{--tool:#7c3aed}
.tool-count{top:2px!important;right:2px!important}.secure-badge{top:2px!important;right:2px!important}

.extract-control{width:100%!important;height:76px!important;min-height:76px!important;display:grid!important;grid-template-columns:55px 1fr!important;gap:4px!important;align-items:center!important}
.extract-counter{width:55px!important;height:30px!important}.extract-counter button{width:18px!important;height:30px!important;font-size:13px!important}.extract-counter>span{min-width:19px!important}.extract-counter b{font-size:10px!important}.extract-counter small{font-size:5.5px!important}
.extract-groups{width:70px!important;height:54px!important;min-height:54px!important;display:grid!important;grid-template-columns:repeat(4,15px)!important;grid-template-rows:repeat(2,23px)!important;gap:3px!important;align-content:center!important;justify-content:center!important}
.extract-groups .extract-btn{width:18px!important;height:21px!important;border-radius:5px!important}.extract-groups .extract-btn b{font-size:9px!important}.extract-groups .extract-btn span{min-width:11px!important;height:11px!important;font-size:5px!important}

.optimization-panel{width:100%!important;height:76px!important;min-height:76px!important;padding:4px!important;display:grid!important;grid-template-columns:1fr!important;grid-template-rows:27px 28px 12px!important;gap:2px!important;border:1px solid #bfe1e8;border-radius:10px;background:#f2fbfc}
.optimization-panel>div{align-items:center!important;text-align:center!important}.optimization-panel>div small{font-size:6.5px!important}.optimization-panel>div b{margin-top:1px!important;color:#0e7490!important;font-size:11px!important}.optimization-panel>button{height:28px!important;border-radius:7px!important;background:linear-gradient(135deg,#0e7490,#155bdd)!important;font-size:8px!important}.optimization-panel>small{font-size:6.5px!important;color:#527080!important}
.image-tool-stack{width:100%!important;height:76px!important;min-height:76px!important;display:grid!important;grid-template-rows:59px 14px!important;gap:2px!important}.image-tool-stack .tool-tile{height:59px!important;min-height:59px!important}.view-images-btn{width:100%!important;min-width:0!important;height:14px!important;min-height:14px!important;padding:0!important;line-height:13px!important}
.pages-workspace{min-height:calc(100vh - 226px)!important}

.page-card.search-match{border-color:#f1c40f!important;box-shadow:0 0 0 2px rgba(250,204,21,.28),0 9px 22px rgba(161,98,7,.11)!important}.page-card.search-active-match{border-color:#f59e0b!important;box-shadow:0 0 0 3px rgba(245,158,11,.42),0 12px 28px rgba(161,98,7,.18)!important}
.search-match-badge{position:absolute;z-index:12;right:7px;bottom:7px;min-width:27px;height:20px;padding:0 6px;display:grid;place-items:center;border:2px solid #fff;border-radius:999px;color:#713f12;background:#fde047;font-size:8px;font-weight:950;box-shadow:0 3px 8px rgba(161,98,7,.22)}
.search-text-overlay{position:absolute;z-index:9;inset:0;pointer-events:none}.search-text-overlay i{position:absolute;display:block;border:1px solid rgba(217,119,6,.72);border-radius:2px;background:rgba(255,214,10,.48);box-shadow:0 0 0 1px rgba(255,255,255,.22);mix-blend-mode:multiply}
#annotationCanvas.annotation-canvas{background:transparent!important;box-shadow:none!important}

@media(max-width:1650px){
  .commandbar{grid-template-columns:100px 160px 125px minmax(390px,1fr) 160px 130px 90px 110px!important}
  .command-group{padding-left:5px!important;padding-right:5px!important}.tool-tile>span:last-child{font-size:6.2px!important}
  .live-search-control{width:310px;min-width:270px}.reset-btn{width:170px!important;min-width:170px!important}.editor-primary-actions .generate-btn{width:160px!important;min-width:160px!important}
}
@media(max-width:1250px){
  .editor-topbar-inner{padding-left:12px!important;padding-right:12px!important}.editor-identity small{display:none}.live-search-control{width:265px;min-width:220px;grid-template-columns:16px 1fr auto 25px 25px 25px}.live-search-status{max-width:65px}.reset-btn span{display:none}.reset-btn{width:44px!important;min-width:44px!important;padding:0!important}.editor-primary-actions .generate-btn{width:128px!important;min-width:128px!important}
  .commandbar{grid-template-columns:86px 145px 110px minmax(340px,1fr) 145px 115px 78px 95px!important}.command-group{padding-left:3px!important;padding-right:3px!important}.tool-tile>span:last-child{font-size:5.8px!important}
}
@media(max-width:980px){
  .editor-topbar{position:relative!important}.editor-topbar-inner{flex-wrap:wrap!important}.editor-primary-actions{width:100%!important}.live-search-control{order:5;flex:1;width:auto;min-width:240px}.editor-toolbar{position:relative!important;top:auto!important}
  .commandbar{grid-template-columns:70px 110px 90px minmax(280px,1fr) 110px 96px 70px 82px!important;padding-left:3px!important;padding-right:3px!important}.toolbar-label{font-size:6px!important}.tool-tile>span:last-child{display:none!important}.tool-glyph{font-size:17px!important}.file-command .tool-glyph,.insert-command .tool-glyph,.security-command .tool-glyph{font-size:20px!important}
}

/* ==================================================================
   V20 · Barra basada en la propuesta visual aprobada
   Una franja, tarjetas proporcionadas y grupos con borde de color.
   ================================================================== */
.editor-topbar{
  position:sticky!important;top:0!important;z-index:170!important;height:90px!important;
  background:rgba(255,255,255,.98)!important;border-bottom:1px solid #e2e8f0!important;
  box-shadow:0 1px 0 rgba(15,23,42,.02)!important
}
.editor-topbar-inner{
  width:100%!important;max-width:none!important;height:90px!important;min-height:90px!important;
  padding:12px 24px!important;display:flex!important;align-items:center!important;gap:22px!important
}
.editor-identity{min-width:315px!important;gap:18px!important}
.editor-logo{
  width:48px!important;height:50px!important;flex:0 0 48px!important;border-radius:9px!important;
  background:linear-gradient(145deg,#ff3345,#ed1f32)!important;
  box-shadow:0 8px 18px rgba(237,31,50,.16)!important
}
.editor-logo::after{display:none!important}
.editor-logo b{font-size:15px!important;letter-spacing:.02em!important}
.editor-identity>div>strong{font-size:20px!important;line-height:1.1!important;color:#172033!important}
.editor-identity small{margin-top:6px!important;font-size:9px!important;color:#738096!important}
.editor-primary-actions{
  flex:1 1 auto!important;min-width:0!important;display:flex!important;align-items:center!important;
  justify-content:flex-end!important;gap:12px!important
}
.live-search-control{
  order:1!important;width:405px!important;min-width:300px!important;height:52px!important;
  padding:0 8px 0 16px!important;grid-template-columns:21px minmax(120px,1fr) auto 31px 31px 31px!important;
  gap:5px!important;border:1px solid #d9e2ed!important;border-radius:11px!important;background:#fff!important;
  box-shadow:0 3px 10px rgba(15,23,42,.035)!important
}
.live-search-control:focus-within{border-color:#8bb1fa!important;box-shadow:0 0 0 3px rgba(37,99,235,.09)!important}
.live-search-control>svg{width:20px!important;height:20px!important;stroke:#536b8d!important}
.live-search-control input{height:48px!important;font-size:11px!important;font-weight:750!important}
.live-search-control input::placeholder{color:#8a98ac!important}
.live-search-status{max-width:92px!important;font-size:7.5px!important;color:#64748b!important}
.live-search-control>button{
  width:31px!important;height:31px!important;border-color:#e1e8f0!important;border-radius:7px!important;
  color:#66809f!important;background:#fbfdff!important;font-size:17px!important
}
.editor-language{order:2!important;width:130px!important;min-width:130px!important;height:52px!important;border-radius:11px!important}
.editor-language>span{font-size:17px!important}.editor-language select{font-size:11px!important;font-weight:850!important}
.reset-btn{order:3!important;width:145px!important;min-width:145px!important;height:52px!important;border-radius:11px!important;padding:0 14px!important;font-size:11px!important}
.editor-primary-actions .generate-btn{
  order:4!important;width:135px!important;min-width:135px!important;height:52px!important;border-radius:11px!important;
  padding:0 14px!important;font-size:11px!important;background:linear-gradient(135deg,#ff4d56,#f23943)!important;
  box-shadow:0 9px 19px rgba(239,35,60,.17)!important
}

.editor-toolbar{
  position:sticky!important;top:90px!important;z-index:155!important;width:100%!important;height:268px!important;
  min-height:268px!important;margin:0!important;overflow:hidden!important;border-bottom:1px solid #e2e8f0!important;
  background:#f8fafc!important
}
.commandbar{
  width:100%!important;max-width:none!important;height:268px!important;min-height:268px!important;margin:0!important;
  padding:18px 8px 3px!important;display:grid!important;
  grid-template-columns:.95fr 1.2fr .95fr 3.05fr 1.32fr .95fr .78fr .9fr!important;
  align-items:stretch!important;justify-content:stretch!important;gap:8px!important;overflow:hidden!important
}
.command-group{
  --accent:#2563eb;position:relative!important;min-width:0!important;width:auto!important;height:247px!important;
  min-height:247px!important;padding:0 10px 10px!important;display:flex!important;flex-direction:column!important;
  align-items:stretch!important;justify-content:flex-start!important;gap:0!important;overflow:visible!important;
  border:1px solid #e1e7ef!important;border-top:2px solid var(--accent)!important;border-radius:8px 8px 0 0!important;
  background:#fff!important;box-shadow:0 3px 10px rgba(15,23,42,.035)!important
}
.command-group::before{display:none!important}
.file-command{--accent:#1681f5!important}.page-command{--accent:#6259e8!important}.extract-command{--accent:#0aa779!important}
.edit-command{--accent:#7544ee!important}.document-command{--accent:#13a8bb!important}.optimization-command{--accent:#1878f3!important}
.insert-command{--accent:#fa1473!important}.security-command{--accent:#3aa34b!important}
.command-group>.toolbar-label,.toolbar-label{
  height:49px!important;min-height:49px!important;margin:0!important;display:flex!important;align-items:center!important;
  justify-content:center!important;color:var(--accent)!important;font-size:10px!important;font-weight:950!important;
  line-height:1!important;letter-spacing:.045em!important;text-align:center!important
}
.command-buttons{
  width:100%!important;height:186px!important;min-height:186px!important;margin:0!important;display:grid!important;
  align-items:stretch!important;justify-content:stretch!important;gap:10px 6px!important
}
.file-command .command-buttons,.insert-command .command-buttons,.security-command .command-buttons{
  grid-template-columns:minmax(0,1fr)!important;grid-template-rows:repeat(2,minmax(0,1fr))!important
}
.page-command .command-buttons,.document-command .command-buttons{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important
}
.edit-command .command-buttons{
  grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;
  gap:10px 7px!important
}
.tool-tile,.file-command .tool-tile,.insert-command .tool-tile,.security-command .tool-tile{
  --tool:var(--accent);position:relative!important;min-width:0!important;width:100%!important;height:auto!important;
  min-height:0!important;margin:0!important;padding:8px 4px!important;display:flex!important;flex-direction:column!important;
  align-items:center!important;justify-content:center!important;gap:8px!important;border:1px solid #e0e6ee!important;
  border-radius:9px!important;color:#25354b!important;background:#fff!important;
  box-shadow:0 2px 7px rgba(15,23,42,.025)!important;transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease!important
}
.tool-tile:hover:not(:disabled){
  transform:translateY(-2px)!important;border-color:color-mix(in srgb,var(--tool) 48%,#d9e2ec)!important;
  background:color-mix(in srgb,var(--tool) 4%,white)!important;box-shadow:0 7px 16px color-mix(in srgb,var(--tool) 11%,transparent)!important
}
.tool-tile:active:not(:disabled){transform:translateY(0)!important}
.tool-tile:disabled{opacity:.66!important;filter:saturate(.86)!important;cursor:not-allowed!important;background:#fff!important}
.tool-tile.active{color:#fff!important;border-color:var(--tool)!important;background:var(--tool)!important;box-shadow:0 7px 17px color-mix(in srgb,var(--tool) 24%,transparent)!important}
.tool-glyph,.file-command .tool-glyph,.insert-command .tool-glyph,.security-command .tool-glyph{
  width:29px!important;height:29px!important;min-height:29px!important;display:grid!important;place-items:center!important;
  color:var(--tool)!important;font-size:26px!important;font-weight:500!important;line-height:1!important
}
.tool-tile.active .tool-glyph{color:#fff!important}
.tool-tile>span:last-child,.file-command .tool-tile>span:last-child,.insert-command .tool-tile>span:last-child,.security-command .tool-tile>span:last-child{
  display:block!important;color:inherit!important;font-size:9px!important;font-weight:850!important;line-height:1.18!important;text-align:center!important
}
.file-command .tool-tile>span:last-child{color:#075bc7!important;font-size:9.5px!important}
.page-command .tool-tile{--tool:#5d5ce2}.page-command .tool-tile:nth-child(4){--tool:#ff3f4f;color:#ef3343!important}
.edit-command .tool-tile:nth-child(1){--tool:#7247ec}.edit-command .tool-tile:nth-child(2){--tool:#6d43e8}.edit-command .tool-tile:nth-child(3){--tool:#7c4ae9}.edit-command .tool-tile:nth-child(4){--tool:#f3a900}.edit-command .tool-tile:nth-child(5){--tool:#1eb4c5}
.edit-command .tool-tile:nth-child(6){--tool:#7455ed}.edit-command .tool-tile:nth-child(7){--tool:#172c45}.edit-command .tool-tile:nth-child(8){--tool:#ff4655}.edit-command .tool-tile:nth-child(9),.edit-command .tool-tile:nth-child(10){--tool:#16314f}
.document-command .tool-tile:nth-child(1){--tool:#7449ec}.document-command .tool-tile:nth-child(2){--tool:#7f8b9b}.document-command .tool-tile:nth-child(3){--tool:#12aabe}.document-command .tool-tile:nth-child(4){--tool:#0aa9c3}
.insert-command .tool-tile{--tool:#f41773;color:#25354b!important}.security-command .tool-tile{--tool:#37a64a;color:#25354b!important}
.tool-count{top:7px!important;right:8px!important;min-width:21px!important;height:21px!important;background:#0d6ce7!important;font-size:9px!important}
.secure-badge{top:-7px!important;right:8px!important;min-width:22px!important;height:22px!important;background:#8ed79b!important}

.extract-control{
  width:100%!important;height:186px!important;min-height:186px!important;padding:5px 0!important;display:flex!important;
  flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:12px!important
}
.extract-counter{
  width:98px!important;height:41px!important;min-height:41px!important;display:grid!important;
  grid-template-columns:44px 27px 27px!important;grid-template-rows:41px!important;align-items:center!important;
  overflow:hidden!important;border:1px solid #dbe4ee!important;border-radius:10px!important;background:#fff!important;
  box-shadow:0 2px 7px rgba(15,23,42,.025)!important
}
.extract-counter>span{grid-column:1!important;grid-row:1!important;min-width:0!important;height:41px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:1px!important}
.extract-counter b{font-size:13px!important;color:#13243a!important}.extract-counter small{font-size:7px!important;color:#6f7e92!important;font-weight:850!important}
.extract-counter button{width:27px!important;height:41px!important;min-height:41px!important;border:0!important;border-left:1px solid #e2e8f0!important;border-radius:0!important;color:#193453!important;background:#fff!important;font-size:18px!important}
.extract-counter button:first-child{grid-column:2!important;grid-row:1!important}.extract-counter button:last-child{grid-column:3!important;grid-row:1!important}
.extract-counter button:hover:not(:disabled){color:#fff!important;background:#0aa779!important}.extract-counter button:disabled{opacity:.35!important}
.extract-groups{
  width:100%!important;height:auto!important;min-height:44px!important;display:grid!important;grid-template-columns:repeat(4,25px)!important;
  grid-auto-rows:25px!important;align-content:center!important;justify-content:center!important;gap:5px!important
}
.extract-empty{grid-column:1/5!important;max-width:none!important;color:#8a97a9!important;font-size:7.5px!important;line-height:1.35!important;white-space:normal!important;text-align:center!important}
.extract-groups .extract-btn{width:25px!important;height:25px!important;border-radius:7px!important}.extract-groups .extract-btn b{font-size:11px!important}.extract-groups .extract-btn span{top:-5px!important;right:-5px!important;min-width:13px!important;height:13px!important;font-size:6px!important}

.optimization-panel{
  width:100%!important;height:186px!important;min-height:186px!important;padding:12px 4px 7px!important;display:grid!important;
  grid-template-columns:1fr!important;grid-template-rows:70px 50px 28px!important;align-items:center!important;gap:8px!important;
  border:1px solid #e0e6ee!important;border-radius:9px!important;background:#fff!important;box-shadow:0 2px 7px rgba(15,23,42,.025)!important
}
.optimization-panel>div{align-items:center!important;justify-content:center!important;text-align:center!important}.optimization-panel>div small{font-size:8px!important;line-height:1.25!important;color:#314258!important}.optimization-panel>div b{margin-top:7px!important;color:#086ce8!important;font-size:17px!important}
.optimization-panel>button{width:92%!important;height:50px!important;justify-self:center!important;border:1.5px solid #4387ff!important;border-radius:9px!important;color:#086ce8!important;background:#fff!important;box-shadow:none!important;font-size:10px!important}
.optimization-panel>button:hover:not(:disabled){color:#fff!important;background:#1878f3!important}.optimization-panel>small{font-size:7.5px!important;color:#26384f!important}
.image-tool-stack{position:relative!important;width:100%!important;height:auto!important;min-height:0!important;display:block!important}
.image-tool-stack .tool-tile{height:100%!important;min-height:0!important}
.view-images-btn{display:none!important}

.pages-workspace{min-height:calc(100vh - 358px)!important;padding-top:11px!important}

@media(max-width:1500px){
  .editor-topbar-inner{padding-left:16px!important;padding-right:16px!important;gap:14px!important}.editor-identity{min-width:300px!important}.live-search-control{width:405px!important;min-width:270px!important}.editor-primary-actions{gap:10px!important}
  .command-group{padding-left:9px!important;padding-right:9px!important}.tool-tile>span:last-child{font-size:8px!important}.file-command .tool-tile>span:last-child{font-size:8.5px!important}
}
@media(max-width:1240px){
  .editor-identity{min-width:250px!important}.editor-identity small{display:none!important}.live-search-control{width:auto!important;min-width:245px!important;flex:1 1 320px!important}.live-search-status{display:none!important}.live-search-control{grid-template-columns:20px minmax(90px,1fr) 29px 29px 29px!important}
  .editor-language{width:112px!important;min-width:112px!important}.reset-btn{width:48px!important;min-width:48px!important;padding:0!important}.reset-btn span{display:none!important}.editor-primary-actions .generate-btn{width:122px!important;min-width:122px!important}
  .commandbar{gap:5px!important;padding-left:5px!important;padding-right:5px!important}.command-group{padding-left:6px!important;padding-right:6px!important}.command-group>.toolbar-label{font-size:8px!important}.tool-tile{gap:5px!important;padding-left:2px!important;padding-right:2px!important}.tool-glyph{font-size:23px!important}.tool-tile>span:last-child{font-size:7px!important}.edit-command .command-buttons{gap:8px 4px!important}
}
@media(max-width:900px){
  .editor-topbar{position:relative!important;height:auto!important}.editor-topbar-inner{height:auto!important;min-height:0!important;flex-wrap:wrap!important}.editor-identity{min-width:0!important}.editor-primary-actions{width:100%!important}.live-search-control{order:1!important;min-width:200px!important}.editor-language{order:2!important}.reset-btn{order:3!important}.editor-primary-actions .generate-btn{order:4!important}
  .editor-toolbar{position:relative!important;top:auto!important;height:218px!important;min-height:218px!important}.commandbar{height:218px!important;min-height:218px!important;padding-top:8px!important;gap:3px!important}.command-group{height:205px!important;min-height:205px!important;padding:0 3px 5px!important}.command-group>.toolbar-label{height:33px!important;min-height:33px!important;font-size:6px!important}.command-buttons,.extract-control,.optimization-panel{height:160px!important;min-height:160px!important;gap:4px!important}.tool-tile>span:last-child{display:none!important}.tool-glyph{font-size:20px!important}.commandbar{grid-template-columns:.85fr 1.1fr .85fr 2.8fr 1.15fr .85fr .7fr .8fr!important}.pages-workspace{min-height:calc(100vh - 218px)!important}
}

/* ==================================================================
   V21 · Altura afinada, herramientas laterales y espacios AdSense
   ================================================================== */
.editor-topbar{height:80px!important}
.editor-topbar-inner{height:80px!important;min-height:80px!important;padding:8px 20px!important}
.editor-logo{width:44px!important;height:46px!important;flex-basis:44px!important}
.editor-identity{gap:15px!important}.editor-identity>div>strong{font-size:19px!important}.editor-identity small{margin-top:4px!important}
.live-search-control{height:46px!important}.live-search-control input{height:42px!important}
.editor-language,.reset-btn,.editor-primary-actions .generate-btn{height:46px!important}
.editor-toolbar{top:80px!important;height:238px!important;min-height:238px!important}
.commandbar{height:238px!important;min-height:238px!important;padding:14px 8px 3px!important}
.command-group{height:221px!important;min-height:221px!important;padding-bottom:8px!important}
.command-group>.toolbar-label,.toolbar-label{height:42px!important;min-height:42px!important}
.command-buttons,.extract-control{height:169px!important;min-height:169px!important}
.optimization-panel{height:169px!important;min-height:169px!important;grid-template-rows:61px 46px 24px!important;padding-top:10px!important}
.optimization-panel>button{height:46px!important}
.extract-control{gap:7px!important}.extract-groups{min-height:39px!important}
.tool-tile{gap:6px!important;padding-top:6px!important;padding-bottom:6px!important}
.tool-glyph,.file-command .tool-glyph,.insert-command .tool-glyph,.security-command .tool-glyph{height:27px!important;min-height:27px!important;font-size:24px!important}
.pages-workspace{min-height:calc(100vh - 318px)!important}

/* Un solo anuncio activo y siempre separado de las acciones. */
.ad-region{position:relative;box-sizing:border-box;color:#7a879a;background:#fff}
.ad-region.ad-inactive{display:none!important}
.ad-label{position:absolute;top:7px;left:50%;transform:translateX(-50%);z-index:1;color:#94a3b8;font-size:8px;font-weight:850;letter-spacing:.12em;text-transform:uppercase}
.adsense-slot{width:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;border:1px dashed #cbd8e8;border-radius:11px;background:linear-gradient(135deg,#fbfdff,#f5f8fc)}
.adsense-slot .adsbygoogle{width:100%;min-height:inherit}
.ad-placeholder{padding:14px;color:#94a3b8;font-size:9px;font-weight:750;text-align:center}
.main-ad-region{width:min(970px,calc(100% - 40px));min-height:126px;margin:34px auto 12px;padding:24px 10px 10px;border:1px solid #e1e8f0;border-radius:14px;box-shadow:0 7px 22px rgba(15,23,42,.035)}
.main-ad-region .adsense-slot{min-height:90px}

/* Vista previa: panel izquierdo de dos columnas, hoja al centro y anuncio a la derecha. */
.preview-shell{
  width:min(1540px,calc(100vw - 44px))!important;height:min(92vh,900px)!important;max-height:92vh!important;
  display:grid!important;grid-template-columns:0 minmax(0,1fr) 330px!important;grid-template-rows:58px minmax(0,1fr)!important;
  grid-template-areas:"head head head" "tools stage ad"!important;transition:grid-template-columns .18s ease!important
}
.preview-shell.tools-open{grid-template-columns:220px minmax(0,1fr) 330px!important}
.preview-head{grid-area:head!important;min-width:0!important}
.preview-stage{grid-area:stage!important;min-width:0!important;min-height:0!important;padding:14px!important}
.preview-tools-panel{
  grid-area:tools!important;position:relative!important;z-index:75!important;left:auto!important;right:auto!important;bottom:auto!important;
  width:100%!important;height:100%!important;max-height:none!important;min-width:0!important;display:flex;flex-direction:column;
  overflow-x:hidden!important;overflow-y:auto!important;border:0!important;border-right:1px solid #dbe4ef!important;border-radius:0!important;
  background:#f8fafc!important;box-shadow:8px 0 22px rgba(15,23,42,.07)!important;backdrop-filter:none!important
}
.preview-tools-panel.hidden{display:none!important}
.floating-tools-head{position:sticky;top:0;z-index:3;min-height:42px!important;padding:6px 8px 6px 12px!important;background:rgba(255,255,255,.97)!important}
.floating-tools-head strong{font-size:10px!important;color:#26364c!important}.floating-tools-head button{width:27px!important;height:27px!important}
.preview-edit-toolbar{
  padding:8px!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:6px!important;overflow:visible!important;border-bottom:0!important;background:transparent!important
}
.preview-edit-toolbar>button,.preview-page-toolbar>button{
  min-width:0!important;width:100%!important;height:54px!important;padding:5px 3px!important;display:flex!important;
  flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;
  border:1px solid #dce5ef!important;border-radius:9px!important;background:#fff!important;box-shadow:0 2px 7px rgba(15,23,42,.03)!important
}
.preview-edit-toolbar>button:hover,.preview-page-toolbar>button:hover{border-color:#9dbcf4!important;background:#f4f8ff!important}
.preview-edit-toolbar>button.active{border-color:#7ea8f7!important;color:#155bdd!important;background:#eaf2ff!important;box-shadow:0 0 0 2px rgba(37,99,235,.08)!important}
.preview-edit-toolbar>button span,.preview-page-toolbar>button span{display:block!important;font-size:7.5px!important;font-weight:850!important}
.preview-panel-section{margin:3px 8px 0;padding-top:9px;border-top:1px solid #dce5ef;color:#64748b;font-size:7.5px;font-weight:950;letter-spacing:.12em;text-align:center}
.preview-page-toolbar{padding:7px 8px 12px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.preview-page-toolbar .signature{color:#0f8c73!important}.preview-page-toolbar .image{color:#6d32dc!important}.preview-page-toolbar .delete{color:#d8273d!important}
.preview-tool-options{margin:0 8px 7px!important;padding:8px!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:8px!important;border:1px solid #dce5ef!important;border-radius:9px!important;background:#fff!important}
.preview-tool-options.hidden{display:none!important}.preview-tool-options small{width:100%!important;margin:0!important;line-height:1.35!important;text-align:left!important}
.tool-option-group{width:100%;flex-wrap:wrap}.tool-option-group input[type="range"]{width:100px}
.shape-gallery{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:5px!important}.shape-gallery button{height:30px!important}
.shape-content-options{grid-template-columns:1fr!important;align-items:stretch!important}.shape-content-options label{justify-content:space-between}.shape-content-options input[type="text"]{grid-column:auto!important;width:100%!important}.shape-content-options button{width:100%!important}
.preview-tools-tab{
  position:absolute;z-index:90;left:10px;top:69px;min-height:34px;padding:0 9px;display:flex;align-items:center;gap:5px;
  border:1px solid #8fb3f5;border-radius:8px;color:#155bdd;background:#fff;font-size:9px;font-weight:900;box-shadow:0 6px 16px rgba(15,23,42,.13)
}
.preview-tools-tab.active{left:230px;color:#fff;border-color:#155bdd;background:#155bdd}.preview-tools-tab:hover{transform:translateY(-1px)}
.preview-ad-region{grid-area:ad!important;width:330px;height:100%;padding:45px 14px 14px;display:flex;align-items:flex-start;justify-content:center;border-left:1px solid #dbe4ef;background:#f7f9fc}
.preview-ad-region .ad-label{top:23px}.preview-ad-region .adsense-slot{width:300px;min-height:250px;flex:0 0 250px;background:#fff}

/* El anuncio de descarga está antes del título, nunca pegado al botón. */
.download-card{width:min(820px,calc(100vw - 34px))!important}
.download-ad-region{min-height:126px;margin:-4px 0 38px;padding:24px 8px 8px;border:1px solid #e1e8f0;border-radius:12px;background:#f8fafc}
.download-ad-region .adsense-slot{min-height:90px;background:#fff}

.preview-shell:fullscreen,.preview-modal.fullscreen-mode .preview-shell{width:100%!important;height:100%!important;max-height:none!important;grid-template-columns:220px minmax(0,1fr)!important;grid-template-areas:"head head" "tools stage"!important}
.preview-shell:fullscreen .preview-ad-region,.preview-modal.fullscreen-mode .preview-ad-region{display:none!important}

@media(max-width:1360px){
  .preview-shell{grid-template-columns:0 minmax(0,1fr)!important;grid-template-areas:"head head" "tools stage"!important}
  .preview-shell.tools-open{grid-template-columns:205px minmax(0,1fr)!important}.preview-ad-region{display:none!important}.preview-tools-tab.active{left:214px}
}
@media(max-width:900px){
  .editor-topbar{height:auto!important}.editor-topbar-inner{height:auto!important;min-height:0!important}.editor-toolbar{top:auto!important;height:208px!important;min-height:208px!important}.commandbar{height:208px!important;min-height:208px!important;padding-top:6px!important}.command-group{height:197px!important;min-height:197px!important}.command-group>.toolbar-label{height:31px!important;min-height:31px!important}.command-buttons,.extract-control,.optimization-panel{height:154px!important;min-height:154px!important}.pages-workspace{min-height:calc(100vh - 208px)!important}
  .preview-modal{padding:7px!important}.preview-shell{width:99vw!important;height:97vh!important;max-height:97vh!important;grid-template-columns:0 minmax(0,1fr)!important}.preview-shell.tools-open{grid-template-columns:188px minmax(0,1fr)!important}.preview-tools-tab.active{left:196px}.preview-edit-toolbar>button,.preview-page-toolbar>button{height:48px!important}.preview-ad-region{display:none!important}
  .main-ad-region{width:calc(100% - 22px);margin-top:24px}.download-ad-region{margin-bottom:28px}
}
@media(max-width:620px){
  .preview-shell,.preview-shell.tools-open{grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"head" "stage"!important}.preview-tools-panel{position:absolute!important;top:58px!important;bottom:0!important;left:0!important;width:min(220px,82vw)!important;height:auto!important}.preview-tools-tab.active{left:min(230px,83vw)}
  .download-ad-region{min-height:104px}.download-ad-region .adsense-slot{min-height:68px}
}

/* ==================================================================
   V22 · Barra principal realmente más baja
   Conserva las ocho categorías en una sola franja y sin scroll lateral.
   ================================================================== */
.editor-toolbar{height:210px!important;min-height:210px!important}
.commandbar{height:210px!important;min-height:210px!important;padding:10px 8px 3px!important}
.command-group{height:197px!important;min-height:197px!important;padding-bottom:6px!important}
.command-group>.toolbar-label,.toolbar-label{height:35px!important;min-height:35px!important;font-size:9px!important}
.command-buttons,.extract-control{height:154px!important;min-height:154px!important}
.optimization-panel{height:154px!important;min-height:154px!important;padding:8px 4px 5px!important;grid-template-rows:52px 42px 22px!important;gap:6px!important}
.optimization-panel>button{height:42px!important}
.tool-tile{gap:4px!important;padding-top:4px!important;padding-bottom:4px!important}
.tool-glyph,.file-command .tool-glyph,.insert-command .tool-glyph,.security-command .tool-glyph{height:24px!important;min-height:24px!important;font-size:22px!important}
.extract-control{padding-top:2px!important;padding-bottom:2px!important;gap:4px!important}
.extract-counter{height:37px!important;min-height:37px!important;grid-template-rows:37px!important}
.extract-counter>span,.extract-counter button{height:37px!important;min-height:37px!important}
.extract-groups{min-height:34px!important;grid-auto-rows:23px!important;gap:4px!important}
.extract-groups .extract-btn{width:23px!important;height:23px!important}
.pages-workspace{min-height:calc(100vh - 290px)!important}

@media(max-width:900px){
  .editor-toolbar{height:190px!important;min-height:190px!important}
  .commandbar{height:190px!important;min-height:190px!important;padding-top:5px!important}
  .command-group{height:182px!important;min-height:182px!important;padding-bottom:4px!important}
  .command-group>.toolbar-label,.toolbar-label{height:29px!important;min-height:29px!important}
  .command-buttons,.extract-control,.optimization-panel{height:145px!important;min-height:145px!important}
  .pages-workspace{min-height:calc(100vh - 190px)!important}
}


/* ==================================================================
   V23 · Ajustes puntuales solicitados
   - Autoformas contenidas sin invadir la sección PÁGINA.
   - Solo PESO más compacto; no altera los demás botones de la barra.
   - Vista previa prioriza la hoja y reduce el protagonismo del anuncio.
   - Panel lateral de apoyo con modal de donación.
   ================================================================== */

/* PESO: únicamente esta sección se compacta. */
.optimization-command .optimization-panel{
  grid-template-rows:50px 20px 32px!important;
  gap:4px!important;
  padding:7px 4px 4px!important;
}
.optimization-command .optimization-panel>div{grid-row:1!important}
.optimization-command #optimizationLevelLabel{grid-row:2!important;align-self:center!important}
.optimization-command #optimizeWeightBtn{
  grid-row:3!important;
  height:32px!important;
  min-height:32px!important;
  padding:0 8px!important;
  font-size:9px!important;
  border-radius:7px!important;
  align-self:end!important;
}

/* Autoformas: área propia con scroll interno y control explícito. */
.preview-tool-options{
  max-height:270px!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
}
#shapeGallery.shape-gallery{
  width:100%!important;
  max-height:70px!important;
  padding:2px 2px 5px!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  scrollbar-width:thin;
  border:1px solid #dce5ef!important;
  border-radius:8px!important;
  background:#f8fafc!important;
}
#shapeGallery.shape-gallery.expanded{max-height:112px!important}
#shapeGallery.shape-gallery.hidden + .shape-more-hint{display:none!important}
.shape-more-hint{
  width:100%;height:27px;padding:0 8px;border:1px solid #cdd9e7;border-radius:7px;
  color:#35619d;background:#f7faff;font-size:8.5px;font-weight:900;cursor:pointer
}
.shape-more-hint:hover{border-color:#8fb3f5;background:#edf4ff;color:#155bdd}
#shapeGallery.shape-gallery button{min-height:29px!important}

/* Visor: la hoja gana todavía más espacio dentro de la vista previa. */
.preview-shell{
  width:min(1740px,calc(100vw - 10px))!important;
  height:min(97vh,1020px)!important;
  max-height:97vh!important;
  grid-template-columns:0 minmax(0,1fr) 220px!important;
}
.preview-shell.tools-open{grid-template-columns:210px minmax(0,1fr) 220px!important}
.preview-stage{padding:4px!important}

/* Panel lateral más discreto para dar más protagonismo al documento. */
.preview-ad-region{
  width:220px!important;
  padding:12px 8px 8px!important;
  gap:10px!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  background:#f8fafc!important;
}
.preview-support-card{
  flex:0 0 auto;padding:10px 8px;border:1px solid #dbe5f0;border-radius:11px;
  background:#fff;box-shadow:0 4px 14px rgba(15,23,42,.04);text-align:center
}
.preview-support-card strong{display:block;color:#20354f;font-size:11.5px;line-height:1.22}
.preview-support-card p{margin:5px 0 8px;color:#748399;font-size:8px;line-height:1.32}
.preview-support-card button{
  width:100%;height:31px;border:0;border-radius:8px;color:#fff;background:#155bdd;
  font-size:9.5px;font-weight:900;cursor:pointer;box-shadow:0 4px 10px rgba(21,91,221,.18)
}
.preview-support-card button:hover{filter:brightness(.96)}
.preview-ad-region .ad-label{position:static!important;transform:none!important;align-self:center;margin-top:0}
.preview-ad-region .adsense-slot{
  width:100%!important;min-height:128px!important;max-height:150px!important;flex:0 0 128px!important;
  border-radius:9px!important;background:#fff!important
}
.preview-ad-region .ad-placeholder{font-size:7.8px!important;padding:7px!important}

/* Modal de donación. */
.donation-card{width:min(480px,calc(100vw - 34px))!important}
.donation-message{
  margin:4px 0 18px;padding:14px;border:1px solid #dbe5f0;border-radius:11px;
  display:flex;flex-direction:column;gap:5px;background:#f7faff;color:#53637a;text-align:center
}
.donation-message strong{color:#20354f;font-size:13px}
.donation-message span{font-size:10px;line-height:1.45}

@media(max-width:1360px){
  .preview-shell{grid-template-columns:0 minmax(0,1fr)!important}
  .preview-shell.tools-open{grid-template-columns:210px minmax(0,1fr)!important}
}
@media(max-width:900px){
  .optimization-command .optimization-panel{grid-template-rows:47px 18px 30px!important}
  .optimization-command #optimizeWeightBtn{height:30px!important;min-height:30px!important}
}


/* V24: botón de apoyo siempre visible en la barra superior. */
.top-donation-btn{
  height:54px;min-width:190px;max-width:220px;padding:0 14px;border:1px solid #ffd1d8;border-radius:13px;
  display:inline-flex;align-items:center;justify-content:center;gap:7px;background:#fff5f6;color:#df3348;
  font:inherit;font-size:10px;font-weight:900;line-height:1.15;cursor:pointer;white-space:nowrap;
  box-shadow:0 4px 12px rgba(223,51,72,.08);transition:transform .15s ease,box-shadow .15s ease,background .15s ease
}
.top-donation-btn span{font-size:15px;line-height:1}
.top-donation-btn b{font:inherit;font-weight:900}
.top-donation-btn:hover{background:#ffecef;box-shadow:0 7px 16px rgba(223,51,72,.14);transform:translateY(-1px)}
.top-donation-btn:focus-visible{outline:2px solid #ff8d9b;outline-offset:2px}

/* El botón del panel lateral usa exactamente el título solicitado. */
.preview-support-card button{height:auto!important;min-height:34px!important;padding:7px 8px!important;line-height:1.2!important}

@media(max-width:1500px){
  .top-donation-btn{min-width:166px;max-width:180px;padding:0 10px;font-size:9px}
}
@media(max-width:1180px){
  .top-donation-btn{min-width:150px;max-width:165px;white-space:normal;text-align:center}
}


/* V26: vista previa casi a pantalla completa, manteniendo apoyo y publicidad a la derecha. */
.preview-modal{
  padding:2px!important;
}
.preview-shell{
  width:calc(100vw - 4px)!important;
  height:calc(100vh - 6px)!important;
  max-width:none!important;
  max-height:none!important;
  border-radius:18px!important;
  grid-template-columns:0 minmax(0,1fr) 206px!important;
}
.preview-shell.tools-open{
  grid-template-columns:198px minmax(0,1fr) 206px!important;
}
.preview-head{
  min-height:52px!important;
}
.preview-stage{
  padding:2px!important;
}
.preview-viewport{
  padding:6px!important;
}
.preview-tools-panel{
  width:198px!important;
}
.preview-tools-tab.active{
  left:208px!important;
}
.preview-ad-region{
  width:206px!important;
  padding:10px 7px 7px!important;
}
.preview-support-card{
  padding:9px 7px!important;
}
.preview-ad-region .adsense-slot{
  min-height:122px!important;
  max-height:142px!important;
  flex:0 0 122px!important;
}
@media(max-width:1360px){
  .preview-modal{padding:4px!important}
  .preview-shell{width:calc(100vw - 8px)!important;height:calc(100vh - 8px)!important;grid-template-columns:0 minmax(0,1fr)!important}
  .preview-shell.tools-open{grid-template-columns:194px minmax(0,1fr)!important}
  .preview-tools-tab.active{left:202px!important}
}
@media(max-width:900px){
  .preview-modal{padding:4px!important}
  .preview-shell{width:calc(100vw - 8px)!important;height:calc(100vh - 8px)!important}
  .preview-shell.tools-open{grid-template-columns:184px minmax(0,1fr)!important}
  .preview-tools-tab.active{left:192px!important}
}


/* V27: visor más amplio + panel derecho compacto y siempre visible en escritorio. */
.preview-modal{
  padding:0!important;
}
.preview-shell{
  width:calc(100vw - 2px)!important;
  height:calc(100vh - 2px)!important;
  max-width:none!important;
  max-height:none!important;
  border-radius:14px!important;
  grid-template-columns:0 minmax(0,1fr) 188px!important;
  grid-template-rows:46px minmax(0,1fr)!important;
}
.preview-shell.tools-open{
  grid-template-columns:190px minmax(0,1fr) 188px!important;
}
.preview-head{
  height:46px!important;
  min-height:46px!important;
  padding-top:3px!important;
  padding-bottom:3px!important;
}
.preview-stage{
  padding:0!important;
}
.preview-viewport{
  padding:2px!important;
}
.preview-tools-panel{
  width:190px!important;
}
.preview-tools-tab{
  top:55px!important;
}
.preview-tools-tab.active{
  left:199px!important;
}

/* Panel derecho más fino y ordenado. */
.preview-ad-region{
  display:flex!important;
  width:188px!important;
  padding:8px 6px 6px!important;
  gap:8px!important;
  background:#f7f9fc!important;
  border-left:1px solid #e0e7f0!important;
}
.preview-support-card{
  padding:8px 6px!important;
  border-radius:10px!important;
  box-shadow:0 3px 10px rgba(15,23,42,.035)!important;
}
.preview-support-card strong{
  font-size:10.5px!important;
  line-height:1.18!important;
}
.preview-support-card p{
  margin:4px 0 7px!important;
  font-size:7.5px!important;
  line-height:1.28!important;
}
.preview-support-card button{
  min-height:31px!important;
  padding:6px 6px!important;
  border-radius:7px!important;
  font-size:8.7px!important;
  line-height:1.15!important;
}
.preview-ad-region .ad-label{
  margin:0!important;
  font-size:7px!important;
  letter-spacing:.11em!important;
}
.preview-ad-region .adsense-slot{
  width:100%!important;
  min-height:112px!important;
  max-height:132px!important;
  flex:0 0 112px!important;
  border-radius:8px!important;
}
.preview-ad-region .ad-placeholder{
  font-size:7.2px!important;
  padding:6px!important;
}

/* Mantener donación + publicidad visibles también en escritorios medianos. */
@media (min-width:1101px) and (max-width:1360px){
  .preview-shell{
    grid-template-columns:0 minmax(0,1fr) 176px!important;
  }
  .preview-shell.tools-open{
    grid-template-columns:184px minmax(0,1fr) 176px!important;
  }
  .preview-tools-panel{width:184px!important}
  .preview-tools-tab.active{left:193px!important}
  .preview-ad-region{
    display:flex!important;
    width:176px!important;
    padding:7px 5px 5px!important;
  }
  .preview-support-card strong{font-size:10px!important}
  .preview-support-card p{font-size:7.2px!important}
  .preview-support-card button{font-size:8.2px!important}
}

/* En tablet/móvil se prioriza la edición; no cambia el comportamiento previo. */
@media(max-width:1100px){
  .preview-shell,
  .preview-shell.tools-open{
    grid-template-areas:"head head" "tools stage"!important;
  }
  .preview-ad-region{display:none!important}
}


/* V28: mantener DONACIÓN + PUBLICIDAD visibles también en Pantalla completa. */
@media (min-width:1101px){
  .preview-shell:fullscreen,
  .preview-modal.fullscreen-mode .preview-shell{
    width:100%!important;
    height:100%!important;
    max-width:none!important;
    max-height:none!important;
    grid-template-columns:0 minmax(0,1fr) 188px!important;
    grid-template-rows:46px minmax(0,1fr)!important;
    grid-template-areas:"head head head" "tools stage ad"!important;
  }
  .preview-shell:fullscreen.tools-open,
  .preview-modal.fullscreen-mode .preview-shell.tools-open{
    grid-template-columns:190px minmax(0,1fr) 188px!important;
  }
  .preview-shell:fullscreen .preview-ad-region,
  .preview-modal.fullscreen-mode .preview-ad-region{
    display:flex!important;
    grid-area:ad!important;
    width:188px!important;
    height:100%!important;
    padding:8px 6px 6px!important;
    gap:8px!important;
    flex-direction:column!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
  }
  .preview-shell:fullscreen .preview-stage,
  .preview-modal.fullscreen-mode .preview-stage{
    grid-area:stage!important;
    min-width:0!important;
    min-height:0!important;
    padding:0!important;
  }
  .preview-shell:fullscreen .preview-tools-panel,
  .preview-modal.fullscreen-mode .preview-tools-panel{
    grid-area:tools!important;
  }
}

/* Escritorios medianos: conserva también el panel derecho en fullscreen. */
@media (min-width:1101px) and (max-width:1360px){
  .preview-shell:fullscreen,
  .preview-modal.fullscreen-mode .preview-shell{
    grid-template-columns:0 minmax(0,1fr) 176px!important;
  }
  .preview-shell:fullscreen.tools-open,
  .preview-modal.fullscreen-mode .preview-shell.tools-open{
    grid-template-columns:184px minmax(0,1fr) 176px!important;
  }
  .preview-shell:fullscreen .preview-ad-region,
  .preview-modal.fullscreen-mode .preview-ad-region{
    display:flex!important;
    width:176px!important;
    padding:7px 5px 5px!important;
  }
}

/* ==================================================================
   V29 · Buscador claro por coincidencias dentro de todos los archivos
   ================================================================== */
.live-search-control{
  order:1!important;
  width:500px!important;
  min-width:430px!important;
  height:54px!important;
  padding:5px 7px 5px 13px!important;
  display:grid!important;
  grid-template-columns:22px minmax(185px,1fr) 78px 30px 30px 30px!important;
  align-items:center!important;
  gap:5px!important;
  border:1px solid #cfdbea!important;
  border-radius:13px!important;
  background:#fff!important;
  box-shadow:0 3px 10px rgba(15,23,42,.035)!important;
}
.live-search-control:focus-within{
  border-color:#6f9df5!important;
  box-shadow:0 0 0 3px rgba(37,99,235,.10),0 6px 15px rgba(30,64,175,.07)!important;
}
.live-search-control.has-results{
  border-color:#8bb1fa!important;
  background:#fff!important;
}
.live-search-control.no-results{
  border-color:#f1a6ae!important;
  background:#fffafb!important;
}
.live-search-control.is-searching{
  border-color:#b9c9dc!important;
}
.live-search-control>svg{
  width:20px!important;
  height:20px!important;
  stroke:#315b92!important;
}
.live-search-field{
  min-width:0!important;
  height:42px!important;
  display:flex!important;
  flex-direction:column!important;
  justify-content:center!important;
  gap:1px!important;
  cursor:text!important;
}
.live-search-field>span{
  display:block!important;
  color:#687a91!important;
  font-size:7px!important;
  font-weight:950!important;
  letter-spacing:.08em!important;
  line-height:1!important;
  white-space:nowrap!important;
}
.live-search-control .live-search-field input{
  width:100%!important;
  height:27px!important;
  min-width:0!important;
  padding:0!important;
  border:0!important;
  outline:0!important;
  color:#172033!important;
  background:transparent!important;
  font-size:12px!important;
  font-weight:750!important;
  line-height:27px!important;
}
.live-search-control .live-search-field input::placeholder{
  color:#8a98aa!important;
  font-weight:650!important;
}
.live-search-status{
  max-width:none!important;
  min-width:72px!important;
  height:27px!important;
  padding:0 7px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  border:1px solid #e1e8f0!important;
  border-radius:7px!important;
  color:#536b86!important;
  background:#f7f9fc!important;
  font-size:8.5px!important;
  font-weight:900!important;
  text-align:center!important;
}
.live-search-control.has-results .live-search-status{
  border-color:#c7d9fb!important;
  color:#2459a7!important;
  background:#f2f6ff!important;
}
.live-search-control.no-results .live-search-status{
  border-color:#f4c6cb!important;
  color:#b4233b!important;
  background:#fff2f4!important;
}
.live-search-control.is-searching .live-search-status{
  color:#66778e!important;
  background:#f7f9fc!important;
}
.live-search-control>button{
  width:30px!important;
  height:30px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  border:1px solid #dbe4ef!important;
  border-radius:7px!important;
  color:#315b92!important;
  background:#fff!important;
  font-size:15px!important;
  font-weight:950!important;
  line-height:1!important;
  cursor:pointer!important;
}
.live-search-control>button:hover:not(:disabled){
  color:#fff!important;
  border-color:#2563eb!important;
  background:#2563eb!important;
}
.live-search-control>button:disabled{
  opacity:.32!important;
  cursor:not-allowed!important;
}
.live-search-control .clear-live-search{
  visibility:hidden!important;
  color:#b4233b!important;
}
.live-search-control .clear-live-search.visible{
  visibility:visible!important;
}

@media(max-width:1500px){
  .live-search-control{
    width:450px!important;
    min-width:370px!important;
    grid-template-columns:20px minmax(150px,1fr) 70px 29px 29px 29px!important;
  }
  .live-search-status{min-width:64px!important;font-size:8px!important}
}
@media(max-width:1240px){
  .live-search-control{
    width:auto!important;
    min-width:300px!important;
    flex:1 1 360px!important;
    grid-template-columns:19px minmax(115px,1fr) 62px 28px 28px 28px!important;
  }
  .live-search-field>span{font-size:6.5px!important}
  .live-search-status{display:flex!important;min-width:56px!important;padding:0 5px!important;font-size:7.5px!important}
}
@media(max-width:900px){
  .live-search-control{
    min-width:250px!important;
    grid-template-columns:18px minmax(100px,1fr) 56px 27px 27px 27px!important;
  }
  .live-search-status{min-width:50px!important;font-size:7px!important}
}


/* V30: resaltado más visible y escritura directa sobre la hoja. */
.inline-text-editor{
  position:absolute;
  z-index:32;
  display:flex;
  flex-direction:column;
  gap:5px;
  pointer-events:auto;
}
.inline-text-editor.hidden{display:none!important}
.inline-text-editor textarea{
  display:block;
  min-width:150px;
  min-height:44px;
  padding:8px 10px;
  border:2px solid #2563eb;
  border-radius:8px;
  background:rgba(255,255,255,.96);
  color:#111827;
  resize:none;
  outline:none;
  box-shadow:0 8px 18px rgba(15,23,42,.14);
  line-height:1.25;
}
.inline-text-editor textarea::placeholder{color:#64748b}
.inline-text-editor-hint{
  align-self:flex-start;
  padding:4px 7px;
  border-radius:999px;
  background:rgba(15,23,42,.82);
  color:#fff;
  font-size:10px;
  line-height:1.2;
  box-shadow:0 6px 16px rgba(15,23,42,.14);
}

/* V31: corrección directa sobre palabras detectadas. */
.inline-text-editor.correction-mode textarea{
  border-color:#0f6fe8;
  background:rgba(255,255,255,.985);
  box-shadow:0 0 0 2px rgba(37,99,235,.10),0 8px 18px rgba(15,23,42,.14);
}
.inline-text-editor.correction-mode .inline-text-editor-hint{
  background:rgba(15,92,190,.92);
}

/* V32: edición estructurada de archivos Office. */
.preview-page-toolbar .office{color:#155bdd!important;background:#f4f8ff!important;border-color:#b9cff8!important}
.office-editor-modal{padding:8px!important;z-index:10150!important}
.office-editor-card{
  width:min(1500px,calc(100vw - 16px));height:min(96vh,1040px);max-height:96vh;
  display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;overflow:hidden;
  border-radius:18px;background:#f5f7fb;box-shadow:0 30px 90px rgba(0,0,0,.35)
}
.office-editor-head{padding:14px 16px 10px;display:flex;align-items:flex-start;justify-content:space-between;gap:16px;border-bottom:1px solid #dce5ef;background:#fff}
.office-editor-head h2{margin:2px 0 2px;color:#172033;font-size:21px;letter-spacing:-.02em}
.office-editor-head small{color:#718096;font-size:10px}
.office-editor-toolbar{min-height:50px;padding:7px 12px;display:flex;align-items:center;gap:6px;flex-wrap:wrap;border-bottom:1px solid #dce5ef;background:#fff}
.office-editor-toolbar>button{width:34px;height:34px;border:1px solid #d7e1ed;border-radius:8px;color:#26364b;background:#fff;font-size:14px;font-weight:800;cursor:pointer}
.office-editor-toolbar>button:hover{border-color:#8fb3f5;background:#edf4ff;color:#155bdd}
.office-editor-toolbar label{height:34px;padding:0 7px;display:flex;align-items:center;gap:5px;border:1px solid #d7e1ed;border-radius:8px;color:#64748b;background:#fff;font-size:9px;font-weight:850}
.office-editor-toolbar input[type="number"]{width:54px;border:0;outline:0;font:inherit;color:#172033}
.office-editor-toolbar input[type="color"]{width:28px;height:24px;padding:0;border:0;background:transparent;cursor:pointer}
.office-toolbar-sep{width:1px;height:26px;margin:0 3px;background:#dce5ef}
.office-editor-nav{min-height:42px;padding:6px 12px;display:flex;align-items:center;gap:8px;border-bottom:1px solid #dce5ef;background:#f9fbfd;color:#64748b;font-size:10px;font-weight:800}
.office-editor-nav select{min-width:170px;height:30px;padding:0 8px;border:1px solid #d3deea;border-radius:8px;background:#fff;color:#26364b;font-size:10px;font-weight:800}
.office-editor-nav #officeEditorStatus{margin-left:auto;font-weight:650;text-align:right}
.office-native-viewport{min-width:0;min-height:0;overflow:auto;padding:18px;background:#e8edf4}
.office-native-stage{min-width:100%;min-height:100%;position:relative}
.office-editor-actions{padding:9px 12px;display:flex;justify-content:flex-end;gap:8px;border-top:1px solid #dce5ef;background:#fff}
.office-editor-actions .modal-secondary,.office-editor-actions .modal-primary{width:auto!important;min-width:150px!important;min-height:38px!important;margin:0!important}

/* Word conserva el HTML generado por docx-preview y lo vuelve contenteditable. */
.office-word-stage{display:flex;flex-direction:column;align-items:center;gap:18px;padding:4px 10px 28px}
.office-word-stage .docx-wrapper{width:max-content;max-width:none!important;margin:0 auto!important;background:transparent!important;padding:0!important}
.office-word-stage section.docx,.office-word-stage .office-word-editable{outline:none!important;caret-color:#155bdd}
.office-word-stage .office-word-editable:focus{box-shadow:0 0 0 3px rgba(21,91,221,.16),0 15px 35px rgba(15,23,42,.13)!important}
.office-word-stage [contenteditable="true"]{cursor:text}

/* Excel: cuadrícula editable con encabezados fijos. */
.office-excel-stage{width:max-content;min-width:100%;padding-bottom:30px}
.office-excel-grid{border-collapse:separate;border-spacing:0;background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.10);font-family:Arial,sans-serif;font-size:12px}
.office-excel-grid th,.office-excel-grid td{min-width:110px;height:30px;padding:5px 7px;border-right:1px solid #d9e2ec;border-bottom:1px solid #d9e2ec;white-space:pre-wrap;vertical-align:middle}
.office-excel-grid thead th{position:sticky;top:0;z-index:4;min-width:110px;color:#405269;background:#eef3f8;text-align:center;font-weight:900}
.office-excel-grid tbody>tr>th{position:sticky;left:0;z-index:3;min-width:42px;width:42px;color:#607087;background:#f3f6f9;text-align:center;font-weight:800}
.office-excel-grid .office-excel-corner{left:0;z-index:6;min-width:42px;width:42px}
.office-excel-grid td{outline:none;color:#111827;background:#fff;cursor:text}
.office-excel-grid td:focus,.office-excel-grid td.selected{position:relative;z-index:2;box-shadow:inset 0 0 0 2px #2563eb;background-clip:padding-box}

/* PowerPoint: diapositiva original con cuadros de texto editables encima. */
.office-ppt-stage{display:flex;justify-content:center;align-items:flex-start;padding:12px 10px 30px}
.office-ppt-surface{position:relative;width:min(1180px,90vw);background:#fff;box-shadow:0 16px 42px rgba(15,23,42,.18);overflow:hidden}
.office-ppt-surface>img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;user-select:none;pointer-events:none}
.office-ppt-textbox{position:absolute;z-index:2;min-width:24px;min-height:20px;padding:3px 5px;overflow:hidden;outline:1px dashed rgba(37,99,235,.45);background:rgba(255,255,255,.86);line-height:1.12;cursor:text;box-sizing:border-box}
.office-ppt-textbox:hover{outline:2px solid rgba(37,99,235,.55);background:rgba(255,255,255,.92)}
.office-ppt-textbox:focus,.office-ppt-textbox.selected{outline:2px solid #2563eb;background:rgba(255,255,255,.96);box-shadow:0 3px 10px rgba(37,99,235,.16)}

@media(max-width:900px){
  .office-editor-card{width:calc(100vw - 8px);height:calc(100vh - 8px);max-height:none;border-radius:12px}
  .office-editor-toolbar{gap:4px}.office-toolbar-sep{display:none}
  .office-editor-nav{align-items:flex-start;flex-wrap:wrap}.office-editor-nav #officeEditorStatus{width:100%;margin-left:0;text-align:left}
  .office-native-viewport{padding:8px}
}

/* V33: estado de edición inteligente para PDF. */
.preview-pdf-status{
  margin:7px 8px 1px;
  padding:8px 9px;
  border:1px solid #d7e2ef;
  border-radius:9px;
  display:flex;
  flex-direction:column;
  gap:2px;
  background:#fff;
  line-height:1.25;
}
.preview-pdf-status.hidden{display:none!important}
.preview-pdf-status b{font-size:8.5px;color:#24364f}
.preview-pdf-status span{font-size:7.3px;color:#718096}
.preview-pdf-status.native{border-color:#b8e7ca;background:#f2fbf5}
.preview-pdf-status.native b{color:#18794e}
.preview-pdf-status.ocr{border-color:#b9d5ff;background:#f2f7ff}
.preview-pdf-status.ocr b{color:#155bdd}
.preview-pdf-status.scan{border-color:#f5d59a;background:#fffaf0}
.preview-pdf-status.scan b{color:#a65d00}
.preview-page-toolbar .office.pdf{color:#155bdd!important;background:#f2f7ff!important;border-color:#b9d5ff!important}


/* V34: resaltador amarillo por defecto + cursor tipo marcador. */
.annotation-canvas.tool-highlight{
  cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48ZyB0cmFuc2Zvcm09InJvdGF0ZSgtNDIgMTYgMTYpIj48cmVjdCB4PSIxMCIgeT0iMyIgd2lkdGg9IjEyIiBoZWlnaHQ9IjIwIiByeD0iMyIgZmlsbD0iI2ZmZDQwMCIgc3Ryb2tlPSIjMjczNjRiIiBzdHJva2Utd2lkdGg9IjEuNSIvPjxyZWN0IHg9IjEwIiB5PSI0IiB3aWR0aD0iMTIiIGhlaWdodD0iNSIgcng9IjIiIGZpbGw9IiNmZmY0YTMiLz48cGF0aCBkPSJNMTAgMjJoMTJsLTIuNSA3aC03eiIgZmlsbD0iIzRiNTU2MyIgc3Ryb2tlPSIjMjczNjRiIiBzdHJva2Utd2lkdGg9IjEuMiIvPjxwYXRoIGQ9Ik0xMyAyN2g2bC0uNyAyaC00LjZ6IiBmaWxsPSIjZmZkNDAwIi8+PC9nPjwvc3ZnPg==") 6 27, crosshair!important;
}

/* Word: edición de contenido claramente diferenciada de las capas visuales. */
.office-word-stage .office-word-editable,
.office-word-stage .office-word-editable *{
  user-select:text!important;
  -webkit-user-select:text!important;
}
.office-word-stage .office-word-editable-block{
  cursor:text!important;
  caret-color:#155bdd!important;
  outline:1px solid transparent;
  outline-offset:2px;
  transition:outline-color .12s ease, background .12s ease;
}
.office-word-stage .office-word-editable-block:hover{
  outline-color:rgba(21,91,221,.20);
  background:rgba(234,242,255,.18);
}
.office-word-stage .office-word-editable-block:focus{
  outline:2px solid rgba(21,91,221,.50)!important;
  background:rgba(234,242,255,.24);
}
#officeEditorStatus b{color:#155bdd;font-size:9px;letter-spacing:.04em}


/* V36: distinguir claramente contenido Office editable vs. solo visual. */
.office-edit-legend{
  min-height:35px;padding:6px 12px;display:flex;align-items:center;gap:7px;flex-wrap:wrap;
  border-bottom:1px solid #dce5ef;background:#f8fafc;color:#526176;font-size:9px
}
.office-legend-chip{height:23px;padding:0 8px;display:inline-flex;align-items:center;gap:5px;border:1px solid #d8e2ed;border-radius:999px;background:#fff;font-weight:900;white-space:nowrap}
.office-legend-chip i{width:8px;height:8px;border-radius:50%;display:block}
.office-legend-chip.editable{color:#155bdd;border-color:#b9cff8;background:#f4f8ff}.office-legend-chip.editable i{background:#2563eb}
.office-legend-chip.visual{color:#66758a;background:#f5f6f8}.office-legend-chip.visual i{background:#94a3b8}
.office-edit-summary{margin-left:auto;font-weight:750;color:#5a687c;text-align:right}

.office-word-stage .office-word-editable-block{position:relative}
.office-word-stage .office-word-editable-block:hover::after,
.office-word-stage .office-word-editable-block:focus::after{
  content:"EDITABLE";position:absolute;right:2px;top:-15px;z-index:8;padding:2px 5px;border-radius:4px;
  color:#fff;background:#2563eb;font:800 7px/1.2 Arial,sans-serif;letter-spacing:.04em;pointer-events:none
}
.office-word-stage .office-visual-only{
  position:relative!important;outline:2px dashed rgba(100,116,139,.48)!important;outline-offset:2px!important;
  filter:saturate(.92);cursor:not-allowed!important
}
.office-word-stage .office-visual-only:hover{outline-color:#64748b!important}

.office-excel-grid td.office-excel-editable-cell:hover{box-shadow:inset 0 0 0 1px rgba(37,99,235,.55);background-color:#f8fbff}
.office-excel-grid td.formula-cell{position:relative;padding-left:24px!important;background-image:linear-gradient(90deg,rgba(245,158,11,.11),transparent 45%)}
.office-excel-grid td.formula-cell::before{content:"fx";position:absolute;left:5px;top:7px;color:#b66a00;font-size:9px;font-weight:950;font-style:italic}
.office-excel-grid td.formula-cell:focus,.office-excel-grid td.formula-cell.selected{background-color:#fffaf0}

.office-ppt-surface{isolation:isolate}
.office-ppt-visual-layer{z-index:0!important;filter:saturate(.96)}
.office-ppt-visual-badge{
  position:absolute;z-index:1;right:10px;top:10px;padding:5px 8px;border:1px solid rgba(100,116,139,.45);border-radius:7px;
  color:#566579;background:rgba(248,250,252,.92);font:800 9px/1.2 Arial,sans-serif;pointer-events:none;box-shadow:0 3px 9px rgba(15,23,42,.08)
}
.office-ppt-textbox{z-index:3!important}
.office-ppt-textbox:hover::after,.office-ppt-textbox:focus::after,.office-ppt-textbox.selected::after{
  content:"EDITABLE";position:absolute;right:2px;top:-15px;padding:2px 5px;border-radius:4px;color:#fff;background:#2563eb;
  font:800 7px/1.2 Arial,sans-serif;letter-spacing:.04em;pointer-events:none
}
@media(max-width:900px){.office-edit-summary{width:100%;margin-left:0;text-align:left}}

/* V37: barra de herramientas de la vista previa más ancha y cómoda. */
@media (min-width:1101px){
  .preview-shell{
    grid-template-columns:0 minmax(0,1fr) 188px!important;
  }
  .preview-shell.tools-open{
    grid-template-columns:262px minmax(0,1fr) 188px!important;
  }
  .preview-tools-panel{
    width:262px!important;
  }
  .preview-tools-tab.active{
    left:271px!important;
  }
  .preview-edit-toolbar{
    gap:7px!important;
    padding:8px 10px!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
  }
  .preview-edit-toolbar>button,
  .preview-page-toolbar>button{
    min-height:50px!important;
    padding:6px 8px!important;
  }
  .preview-edit-toolbar>button span,
  .preview-page-toolbar>button span{
    font-size:8.2px!important;
    line-height:1.15!important;
  }
  .preview-page-toolbar{
    padding:8px 10px 12px!important;
    gap:7px!important;
  }
  .preview-tool-options{
    margin:0 10px 8px!important;
    padding:10px!important;
    gap:10px!important;
  }
  .tool-option-group{
    gap:7px!important;
    font-size:9.5px!important;
  }
  .tool-option-group input[type="range"]{
    width:126px!important;
  }
  .tool-option-group input[type="number"]{
    width:76px!important;
    height:30px!important;
  }
  .color-swatch{
    width:24px!important;
    height:24px!important;
  }
  #customEditColor{
    width:28px!important;
    height:28px!important;
  }
  #shapeGallery.shape-gallery{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:6px!important;
  }
  #shapeGallery.shape-gallery button{
    min-height:33px!important;
    font-size:18px!important;
  }
  .shape-content-options{
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
  }
  .shape-content-options input[type="text"]{
    grid-column:1 / -1!important;
    height:32px!important;
    font-size:9.5px!important;
  }
  .shape-content-options button{
    min-height:31px!important;
    font-size:8.6px!important;
  }
  .preview-pdf-status{
    margin:8px 10px 2px!important;
    padding:9px 10px!important;
  }
  .preview-pdf-status b{font-size:8.9px!important}
  .preview-pdf-status span{font-size:7.6px!important}

  .preview-shell:fullscreen.tools-open,
  .preview-modal.fullscreen-mode .preview-shell.tools-open{
    grid-template-columns:262px minmax(0,1fr) 188px!important;
  }
  .preview-shell:fullscreen .preview-tools-panel,
  .preview-modal.fullscreen-mode .preview-tools-panel{
    width:262px!important;
  }
}

@media (min-width:1101px) and (max-width:1360px){
  .preview-shell.tools-open{
    grid-template-columns:242px minmax(0,1fr) 176px!important;
  }
  .preview-tools-panel{
    width:242px!important;
  }
  .preview-tools-tab.active{
    left:251px!important;
  }
  .preview-shell:fullscreen.tools-open,
  .preview-modal.fullscreen-mode .preview-shell.tools-open{
    grid-template-columns:242px minmax(0,1fr) 176px!important;
  }
  .preview-shell:fullscreen .preview-tools-panel,
  .preview-modal.fullscreen-mode .preview-tools-panel{
    width:242px!important;
  }
}

/* V38: barra lateral más elegante + acciones compactas. */
@media (min-width:1101px){
  .preview-tools-panel{
    background:linear-gradient(180deg,#fbfcfe 0%,#f6f8fb 100%)!important;
    border-right:1px solid #d8e2ee!important;
    box-shadow:8px 0 24px rgba(15,23,42,.07)!important;
  }
  .floating-tools-head{
    min-height:44px!important;
    padding:7px 9px 7px 12px!important;
    border-bottom:1px solid #e3e9f1!important;
    background:rgba(255,255,255,.96)!important;
    backdrop-filter:blur(8px);
  }
  .floating-tools-head strong{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    font-size:10.5px!important;
    letter-spacing:.01em!important;
  }
  .floating-tools-head strong::before{
    content:"✦";
    width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;
    border-radius:6px;color:#155bdd;background:#edf4ff;font-size:10px
  }

  .preview-edit-toolbar{
    padding:9px 10px 7px!important;
    gap:6px!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    border-bottom:0!important;
    background:transparent!important;
  }
  .preview-edit-toolbar>button{
    min-width:0!important;
    min-height:47px!important;
    height:47px!important;
    padding:5px 3px!important;
    gap:2px!important;
    border:1px solid #dbe4ee!important;
    border-radius:9px!important;
    color:#46566c!important;
    background:#fff!important;
    box-shadow:0 2px 6px rgba(15,23,42,.035)!important;
    font-size:15px!important;
    transition:transform .12s ease,border-color .12s ease,background .12s ease,box-shadow .12s ease!important;
  }
  .preview-edit-toolbar>button:hover:not(:disabled){
    transform:translateY(-1px);
    border-color:#a9c4f6!important;
    color:#155bdd!important;
    background:#f7faff!important;
    box-shadow:0 5px 12px rgba(37,99,235,.08)!important;
  }
  .preview-edit-toolbar>button.active{
    border-color:#78a7fb!important;
    color:#155bdd!important;
    background:#eaf2ff!important;
    box-shadow:0 0 0 2px rgba(37,99,235,.08)!important;
  }
  .preview-edit-toolbar>button span{
    display:block!important;
    font-size:7.7px!important;
    line-height:1.08!important;
    font-weight:850!important;
  }

  /* Acciones rápidas secundarias: compactas, con tooltip. */
  #previewUndoBtn,#previewRedoBtn,#previewRemoveSelectionBtn{
    height:34px!important;
    min-height:34px!important;
    margin-top:2px!important;
    padding:2px!important;
    font-size:17px!important;
    border-radius:8px!important;
  }
  #previewUndoBtn span,#previewRedoBtn span,#previewRemoveSelectionBtn span{display:none!important}
  #previewUndoBtn{grid-column:1/2!important}
  #previewRedoBtn{grid-column:2/3!important}
  #previewRemoveSelectionBtn{grid-column:3/5!important}
  #previewRemoveSelectionBtn::after{
    content:"Quitar";
    margin-left:4px;
    font-size:8px;
    font-weight:900;
  }

  .preview-tool-options{
    margin:3px 10px 9px!important;
    padding:9px!important;
    gap:8px!important;
    border:1px solid #dce5ef!important;
    border-radius:11px!important;
    background:rgba(255,255,255,.95)!important;
    box-shadow:0 3px 10px rgba(15,23,42,.035)!important;
  }
  .tool-option-group{
    min-height:34px!important;
    padding:5px 6px!important;
    border:1px solid #e3e9f1!important;
    border-radius:8px!important;
    background:#f9fbfd!important;
  }
  .tool-option-group>span:first-child{
    min-width:42px!important;
    color:#53637a!important;
    font-size:8.5px!important;
    font-weight:900!important;
  }
  #colorOptions{
    display:grid!important;
    grid-template-columns:auto repeat(6,1fr)!important;
    align-items:center!important;
    column-gap:6px!important;
    row-gap:5px!important;
  }
  #colorOptions>span{grid-column:1/2!important}
  .color-swatch{
    width:25px!important;height:25px!important;
    justify-self:center!important;
    border:2px solid #fff!important;
    box-shadow:0 0 0 1px #c7d2df,0 2px 5px rgba(15,23,42,.08)!important;
    transition:transform .12s ease,box-shadow .12s ease!important;
  }
  .color-swatch:hover{transform:scale(1.08)}
  .color-swatch.active{box-shadow:0 0 0 2px #2563eb,0 3px 7px rgba(37,99,235,.18)!important}
  #customEditColor{
    width:26px!important;height:26px!important;
    justify-self:center!important;
    border:1px solid #c8d4e1!important;border-radius:50%!important;
    padding:2px!important;background:#fff!important;
  }

  .shape-more-hint{
    height:29px!important;
    border-style:dashed!important;
    background:#f8fbff!important;
  }
  #shapeGallery.shape-gallery{
    padding:4px!important;
    border:1px solid #e1e8f0!important;
    border-radius:9px!important;
    background:#f9fbfd!important;
  }
  #shapeGallery.shape-gallery button{
    border-radius:8px!important;
    background:#fff!important;
    box-shadow:0 1px 4px rgba(15,23,42,.03)!important;
  }

  .preview-panel-section{
    margin:5px 10px 0!important;
    padding-top:10px!important;
    color:#718096!important;
    font-size:7.7px!important;
    letter-spacing:.16em!important;
  }
  .preview-page-toolbar{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px!important;
    padding:8px 10px 12px!important;
  }
  .preview-page-toolbar>button{
    min-height:46px!important;
    height:46px!important;
    padding:4px 3px!important;
    border-radius:9px!important;
    background:#fff!important;
  }
  .preview-page-toolbar>button span{font-size:7.6px!important}
  .preview-page-toolbar .office{
    grid-column:1 / -1!important;
    min-height:38px!important;
    height:38px!important;
    flex-direction:row!important;
    gap:6px!important;
  }

  .preview-tool-options small{
    padding:6px 7px!important;
    border-radius:7px!important;
    color:#718096!important;
    background:#f6f8fb!important;
    font-size:8px!important;
  }
}


/* V39: cursores precisos de resaltador/lápiz + aplicar recorte junto a Recortar. */
.annotation-canvas.tool-highlight{
  cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48cGF0aCBkPSJNMjcgMkwzMSA2TDEzIDI0TDkgMjBaIiBmaWxsPSIjZmZkNDAwIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS40IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZD0iTTkgMjBMMTMgMjRMNCAzMFoiIGZpbGw9IiNmZmU3NmEiIHN0cm9rZT0iIzI2MzY0YiIgc3Ryb2tlLXdpZHRoPSIxLjIiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNMjcgMkwzMSA2TDI5IDhMMjUgNFoiIGZpbGw9IiNmZmY0YTMiLz48Y2lyY2xlIGN4PSI0IiBjeT0iMzAiIHI9IjEuMiIgZmlsbD0iIzExMTgyNyIvPjwvc3ZnPg==") 4 30, crosshair!important;
}
.annotation-canvas.tool-draw{
  cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48cGF0aCBkPSJNMjcgMkwzMSA2TDExIDI2TDcgMjJaIiBmaWxsPSIjZjRjNTQyIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS4zIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZD0iTTcgMjJMMTEgMjZMNCAzMFoiIGZpbGw9IiNlNmI3N2EiIHN0cm9rZT0iIzI2MzY0YiIgc3Ryb2tlLXdpZHRoPSIxLjEiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNNCAzMEw2LjMgMjYuOEw3LjIgMjcuN1oiIGZpbGw9IiMxZjI5MzciLz48cGF0aCBkPSJNMjcgMkwzMSA2TDI5IDhMMjUgNFoiIGZpbGw9IiNlZjZiNzMiIHN0cm9rZT0iIzI2MzY0YiIgc3Ryb2tlLXdpZHRoPSIuOCIvPjxjaXJjbGUgY3g9IjQiIGN5PSIzMCIgcj0iMSIgZmlsbD0iIzExMTgyNyIvPjwvc3ZnPg==") 4 30, crosshair!important;
}

@media (min-width:1101px){
  /* Distribución estable: Recortar y Aplicar quedan realmente juntos. */
  #previewSelectTool{grid-column:1;grid-row:1}
  #previewTextTool{grid-column:2;grid-row:1}
  #previewCorrectTool{grid-column:3;grid-row:1}
  #previewHighlightTool{grid-column:4;grid-row:1}
  #previewDrawTool{grid-column:1;grid-row:2}
  #previewShapesTool{grid-column:2;grid-row:2}
  #previewCropTool{grid-column:3;grid-row:2}
  #previewApplyCropQuickBtn{grid-column:4;grid-row:2}
  #previewRedactTool{grid-column:1;grid-row:3}
  #previewUndoBtn{grid-column:2;grid-row:3!important}
  #previewRedoBtn{grid-column:3;grid-row:3!important}
  #previewRemoveSelectionBtn{grid-column:4;grid-row:3!important}

  #previewApplyCropQuickBtn{
    min-width:0!important;
    min-height:47px!important;
    height:47px!important;
    padding:5px 3px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
    border:1px solid #b9d7c4!important;
    border-radius:9px!important;
    color:#16803c!important;
    background:#f1fbf4!important;
    font-size:16px!important;
    font-weight:950!important;
    box-shadow:0 2px 6px rgba(22,128,60,.05)!important;
    cursor:pointer!important;
  }
  #previewApplyCropQuickBtn span{display:block!important;font-size:7.7px!important;line-height:1.08!important;font-weight:900!important}
  #previewApplyCropQuickBtn:not(:disabled):hover{
    transform:translateY(-1px);
    border-color:#69bb83!important;
    background:#e8f8ed!important;
    box-shadow:0 5px 12px rgba(22,128,60,.10)!important;
  }
  #previewApplyCropQuickBtn:disabled{
    opacity:.38!important;
    cursor:not-allowed!important;
    filter:saturate(.55)!important;
    transform:none!important;
  }
  #previewApplyCropQuickBtn.crop-mode:not(:disabled){
    border-color:#3ba661!important;
    color:#0d7532!important;
    background:#e8f8ed!important;
    box-shadow:0 0 0 2px rgba(22,128,60,.08)!important;
  }

  /* El aplicar antiguo queda fuera del camino; Cancelar/Restaurar siguen en opciones. */
  #cropActions #applyCropBtn{display:none!important}
  #cropActions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
  }
  #cropActions.hidden{display:none!important}
  #cropActions button{min-height:32px!important;font-size:8.8px!important}
}

@media(max-width:1100px){
  #previewApplyCropQuickBtn{display:none!important}
}

/* V40: más control visual al corregir/agregar texto. */
.inline-text-editor{
  min-width:260px;
  max-width:min(420px,78vw);
}
.inline-text-editor-toolbar{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
  padding:8px;
  border:1px solid #d8e2ee;
  border-radius:10px;
  background:rgba(255,255,255,.98);
  box-shadow:0 8px 18px rgba(15,23,42,.10);
}
.inline-text-editor-toolbar label{
  display:flex;
  flex-direction:column;
  gap:3px;
  color:#526176;
  font-size:9px;
  font-weight:850;
}
.inline-text-editor-toolbar label span{line-height:1.1}
.inline-text-editor-toolbar select,
.inline-text-editor-toolbar input[type="number"],
.inline-text-editor-toolbar input[type="color"]{
  width:100%;
  height:30px;
  padding:4px 6px;
  border:1px solid #d7e0ea;
  border-radius:8px;
  background:#fff;
  color:#172033;
  font:inherit;
  box-sizing:border-box;
}
.inline-text-editor-toolbar input[type="color"]{padding:2px}
.inline-text-editor-toolbar .inline-toggle{
  grid-column:1 / 3;
  flex-direction:row;
  align-items:center;
  gap:6px;
  padding-top:16px;
}
.inline-text-editor-toolbar .inline-toggle input{margin:0}
.inline-style-buttons{
  grid-column:3 / 5;
  display:flex;
  align-items:flex-end;
  gap:6px;
}
.inline-style-btn{
  flex:1;
  height:30px;
  border:1px solid #d7e0ea;
  border-radius:8px;
  color:#334155;
  background:#fff;
  font-size:13px;
  font-weight:900;
}
.inline-style-btn.active{
  color:#155bdd;
  border-color:#8fb3f5;
  background:#edf4ff;
  box-shadow:0 0 0 1px rgba(37,99,235,.08) inset;
}
.inline-text-editor textarea{
  min-height:52px;
}
.inline-text-editor.correction-mode .inline-text-editor-toolbar{
  border-color:#cfe0fb;
  background:rgba(248,251,255,.99);
}
@media(max-width:900px){
  .inline-text-editor{min-width:240px;max-width:min(420px,90vw)}
  .inline-text-editor-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}
  .inline-text-editor-toolbar .inline-toggle,
  .inline-style-buttons{grid-column:auto}
}

/* V41: re-edición de correcciones, plantillas rápidas y Word más visible. */
.preview-edit-toolbar .edit-selected{
  color:#155bdd!important;
  border-color:#b9cff8!important;
  background:#f2f7ff!important;
}
.preview-edit-toolbar .edit-selected:hover{
  color:#fff!important;
  border-color:#155bdd!important;
  background:#155bdd!important;
}

.inline-format-presets{
  grid-column:1 / -1;
  display:grid;
  grid-template-columns:auto repeat(3,minmax(0,1fr));
  align-items:center;
  gap:5px;
  padding-top:2px;
}
.inline-format-presets>span{
  color:#64748b;
  font-size:8.5px;
  font-weight:900;
}
.inline-format-presets button{
  min-height:27px;
  padding:4px 6px;
  border:1px solid #d7e0ea;
  border-radius:7px;
  color:#405269;
  background:#fff;
  font-size:8px;
  font-weight:850;
  white-space:nowrap;
}
.inline-format-presets button:hover{
  border-color:#8fb3f5;
  background:#edf4ff;
  color:#155bdd;
}
.inline-format-presets button[data-inline-preset="teacher"]{
  color:#a81919;
  background:#fff4f4;
  border-color:#f5c7c7;
}
.inline-format-presets button[data-inline-preset="note"]{
  color:#745b00;
  background:#fffbea;
  border-color:#f1df8b;
}
.inline-format-presets button[data-inline-preset="gray"]{
  color:#475569;
  background:#f4f6f8;
  border-color:#d9e0e8;
}

/* “Editar texto Word” es la entrada principal a la edición real del DOCX. */
.preview-page-toolbar .office.word{
  grid-column:1 / -1!important;
  min-height:66px!important;
  padding:9px 10px!important;
  flex-direction:row!important;
  gap:9px!important;
  color:#fff!important;
  border:1px solid #0f4fc5!important;
  background:linear-gradient(135deg,#1768e8,#0f55ca)!important;
  box-shadow:0 8px 18px rgba(21,91,221,.24)!important;
}
.preview-page-toolbar .office.word:hover{
  transform:translateY(-1px);
  background:linear-gradient(135deg,#0f5fdc,#0c49b7)!important;
  box-shadow:0 10px 22px rgba(21,91,221,.30)!important;
}
.preview-page-toolbar .office.word>span{
  font-size:10.5px!important;
  font-weight:950!important;
  line-height:1.12!important;
  text-align:left!important;
}
.preview-page-toolbar .office.word small{
  display:block;
  margin-top:3px;
  color:rgba(255,255,255,.82);
  font-size:7.4px;
  font-weight:750;
  line-height:1.15;
}

@media(max-width:900px){
  .inline-format-presets{grid-template-columns:1fr 1fr}
  .inline-format-presets>span{grid-column:1 / -1}
  .preview-page-toolbar .office.word{min-height:58px!important}
}

/* V42: editor dedicado para PDF, similar al modo Word pero conservando posiciones fijas. */
.office-pdf-stage{
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:14px 10px 34px;
}
.office-pdf-surface{
  position:relative;
  width:min(1120px,88vw);
  background:#fff;
  box-shadow:0 16px 42px rgba(15,23,42,.18);
  overflow:visible;
  isolation:isolate;
}
.office-pdf-visual-layer{
  position:absolute;
  inset:0;
  z-index:0;
  width:100%;
  height:100%;
  object-fit:fill;
  user-select:none;
  pointer-events:none;
}
.office-pdf-textbox{
  position:absolute;
  z-index:3;
  box-sizing:border-box;
  min-width:20px;
  padding:1px 2px;
  outline:1px dashed rgba(37,99,235,.38);
  outline-offset:1px;
  color:transparent;
  background:transparent;
  font-family:Arial,sans-serif;
  font-size:var(--pdf-font-size,14px);
  line-height:1.05;
  white-space:pre-wrap;
  overflow:visible;
  cursor:text;
  caret-color:#155bdd;
  transition:outline-color .12s ease,background .12s ease,color .12s ease,box-shadow .12s ease;
}
.office-pdf-textbox:hover,
.office-pdf-textbox:focus,
.office-pdf-textbox.selected,
.office-pdf-textbox.changed{
  color:var(--pdf-text-color,#111827);
  background:var(--pdf-bg-color,#fff);
  outline:2px solid rgba(37,99,235,.72);
  box-shadow:0 2px 8px rgba(37,99,235,.14);
}
.office-pdf-textbox.changed:not(:focus):not(:hover){
  outline-color:rgba(21,91,221,.46);
}
.office-pdf-textbox:hover::after,
.office-pdf-textbox:focus::after,
.office-pdf-textbox.selected::after{
  content:"EDITABLE PDF";
  position:absolute;
  right:0;
  top:-17px;
  padding:2px 5px;
  border-radius:4px;
  color:#fff;
  background:#2563eb;
  font:800 7px/1.2 Arial,sans-serif;
  letter-spacing:.03em;
  pointer-events:none;
  white-space:nowrap;
}
.office-pdf-empty{
  width:min(760px,90%);
  margin:60px auto;
  padding:26px;
  display:flex;
  flex-direction:column;
  gap:8px;
  border:1px solid #f0d49f;
  border-radius:14px;
  background:#fffaf0;
  color:#6f5733;
  text-align:center;
}
.office-pdf-empty b{font-size:15px;color:#a65d00}
.office-pdf-empty span{font-size:11px;line-height:1.45}

/* El modo PDF se identifica claramente como editor del contenido, no como capa de texto nueva. */
.office-editor-card:has(.office-pdf-stage) .office-editor-head{
  border-bottom-color:#cfe0fb;
}
.office-editor-card:has(.office-pdf-stage) #officeEditorTitle{
  color:#155bdd;
}

@media(max-width:1100px){
  .office-pdf-surface{width:min(100%,920px)}
}

/* V43: entrada uniforme y más elegante a los editores de contenido por formato. */
.preview-page-toolbar .office.word,
.preview-page-toolbar .office.pdf,
.preview-page-toolbar .office.excel,
.preview-page-toolbar .office.powerpoint{
  --entry-accent:#2563eb;
  --entry-soft:#f3f7ff;
  --entry-border:#c7d9fb;
  grid-column:1 / -1!important;
  width:100%!important;
  height:auto!important;
  min-height:62px!important;
  padding:8px 9px!important;
  display:grid!important;
  grid-template-columns:40px minmax(0,1fr) 18px!important;
  align-items:center!important;
  gap:9px!important;
  border:1px solid var(--entry-border)!important;
  border-left:4px solid var(--entry-accent)!important;
  border-radius:12px!important;
  color:#24364f!important;
  background:linear-gradient(135deg,#fff,var(--entry-soft))!important;
  box-shadow:0 4px 12px rgba(15,23,42,.055)!important;
  transform:none!important;
  text-align:left!important;
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease,background .16s ease!important;
}
.preview-page-toolbar .office.word{--entry-accent:#2563eb;--entry-soft:#f2f7ff;--entry-border:#c9daf9}
.preview-page-toolbar .office.pdf{--entry-accent:#e33b4b;--entry-soft:#fff5f6;--entry-border:#f3cbd0}
.preview-page-toolbar .office.excel{--entry-accent:#15945d;--entry-soft:#f1fbf6;--entry-border:#bfe6d1}
.preview-page-toolbar .office.powerpoint{--entry-accent:#e66a2c;--entry-soft:#fff6f0;--entry-border:#f1cfbd}
.preview-page-toolbar .office.word:hover,
.preview-page-toolbar .office.pdf:hover,
.preview-page-toolbar .office.excel:hover,
.preview-page-toolbar .office.powerpoint:hover{
  border-color:color-mix(in srgb,var(--entry-accent) 48%,white)!important;
  background:linear-gradient(135deg,#fff,color-mix(in srgb,var(--entry-accent) 8%,white))!important;
  box-shadow:0 7px 17px color-mix(in srgb,var(--entry-accent) 13%,transparent)!important;
  transform:translateY(-1px)!important;
}
.office-entry-badge{
  width:38px;height:38px;display:grid;place-items:center;border-radius:10px;
  color:#fff;background:var(--entry-accent);font-size:9px;font-weight:950;letter-spacing:-.02em;
  box-shadow:0 4px 10px color-mix(in srgb,var(--entry-accent) 22%,transparent)
}
.preview-page-toolbar .office>span{
  display:block!important;min-width:0!important;color:#23344c!important;
  font-size:10px!important;font-weight:950!important;line-height:1.15!important;text-align:left!important
}
.preview-page-toolbar .office>span small{
  display:block!important;margin-top:3px!important;color:#718096!important;
  font-size:7.5px!important;font-weight:700!important;line-height:1.2!important;text-align:left!important
}
.office-entry-arrow{
  display:grid;place-items:center;color:var(--entry-accent);font-style:normal;font-size:22px;font-weight:500;line-height:1
}

/* El editor dedicado conserva el mismo lenguaje visual para Word, PDF, Excel y PowerPoint. */
.office-editor-head .modal-kicker{color:#e31b2b!important;letter-spacing:.13em!important}
.office-editor-head h2{font-size:22px!important}
.office-editor-head small{max-width:920px;line-height:1.35}

@media(max-width:900px){
  .preview-page-toolbar .office.word,
  .preview-page-toolbar .office.pdf,
  .preview-page-toolbar .office.excel,
  .preview-page-toolbar .office.powerpoint{
    min-height:58px!important;grid-template-columns:34px minmax(0,1fr) 15px!important;padding:7px!important
  }
  .office-entry-badge{width:32px;height:32px;border-radius:8px;font-size:8px}
  .preview-page-toolbar .office>span{font-size:9px!important}
  .preview-page-toolbar .office>span small{font-size:7px!important}
}


/* V44: cerrar vista previa con color según el tipo de archivo. */
.close-preview,
#closeOfficeEditorBtn.modal-close{
  border:1px solid #dbe5f0!important;
  box-shadow:0 3px 10px rgba(15,23,42,.06);
  transition:background .18s ease,color .18s ease,border-color .18s ease,transform .18s ease,box-shadow .18s ease;
}
.close-preview:hover,
#closeOfficeEditorBtn.modal-close:hover{
  transform:translateY(-1px);
}

#previewShell[data-filetype="pdf"] .close-preview,
#closePreviewBtn[data-filetype="pdf"],
#closeOfficeEditorBtn[data-filetype="pdf"]{
  background:#fff1f3!important;
  color:#d62839!important;
  border-color:#f2c6cc!important;
}
#previewShell[data-filetype="pdf"] .close-preview:hover,
#closePreviewBtn[data-filetype="pdf"]:hover,
#closeOfficeEditorBtn[data-filetype="pdf"]:hover{
  background:#ffe4e8!important;
  box-shadow:0 6px 16px rgba(214,40,57,.16)!important;
}

#previewShell[data-filetype="word"] .close-preview,
#closePreviewBtn[data-filetype="word"],
#closeOfficeEditorBtn[data-filetype="word"]{
  background:#eef4ff!important;
  color:#155bdd!important;
  border-color:#cfe0ff!important;
}
#previewShell[data-filetype="word"] .close-preview:hover,
#closePreviewBtn[data-filetype="word"]:hover,
#closeOfficeEditorBtn[data-filetype="word"]:hover{
  background:#e0ecff!important;
  box-shadow:0 6px 16px rgba(21,91,221,.16)!important;
}

#previewShell[data-filetype="excel"] .close-preview,
#closePreviewBtn[data-filetype="excel"],
#closeOfficeEditorBtn[data-filetype="excel"]{
  background:#eefbf4!important;
  color:#0f8d57!important;
  border-color:#c4e9d4!important;
}
#previewShell[data-filetype="excel"] .close-preview:hover,
#closePreviewBtn[data-filetype="excel"]:hover,
#closeOfficeEditorBtn[data-filetype="excel"]:hover{
  background:#def6e9!important;
  box-shadow:0 6px 16px rgba(15,141,87,.16)!important;
}

#previewShell[data-filetype="powerpoint"] .close-preview,
#closePreviewBtn[data-filetype="powerpoint"],
#closeOfficeEditorBtn[data-filetype="powerpoint"]{
  background:#fff4ec!important;
  color:#db6429!important;
  border-color:#f4d2bf!important;
}
#previewShell[data-filetype="powerpoint"] .close-preview:hover,
#closePreviewBtn[data-filetype="powerpoint"]:hover,
#closeOfficeEditorBtn[data-filetype="powerpoint"]:hover{
  background:#ffeadc!important;
  box-shadow:0 6px 16px rgba(219,100,41,.16)!important;
}

#previewShell[data-filetype="image"] .close-preview,
#closePreviewBtn[data-filetype="image"],
#closeOfficeEditorBtn[data-filetype="image"]{
  background:#f5f3ff!important;
  color:#7c3aed!important;
  border-color:#ddd2fe!important;
}
#previewShell[data-filetype="image"] .close-preview:hover,
#closePreviewBtn[data-filetype="image"]:hover,
#closeOfficeEditorBtn[data-filetype="image"]:hover{
  background:#ede9fe!important;
  box-shadow:0 6px 16px rgba(124,58,237,.16)!important;
}

/* V45: contexto de archivo, atajos y cambios pendientes. */
.preview-title-line{
  min-width:0;
  display:flex;
  align-items:center;
  gap:8px;
}
.preview-title-line>strong{min-width:0}
.preview-filetype-badge{
  flex:0 0 auto;
  min-width:38px;
  height:22px;
  padding:0 7px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #dbe5f0;
  border-radius:7px;
  background:#f5f7fa;
  color:#526176;
  font-size:8px;
  font-weight:950;
  letter-spacing:.04em;
  box-shadow:0 2px 7px rgba(15,23,42,.04);
}
.preview-filetype-badge.pdf{color:#c92f3e;background:#fff1f3;border-color:#f2c6cc}
.preview-filetype-badge.word{color:#155bdd;background:#eef4ff;border-color:#cfe0ff}
.preview-filetype-badge.excel{color:#0f8d57;background:#eefbf4;border-color:#c4e9d4}
.preview-filetype-badge.powerpoint{color:#d85f25;background:#fff4ec;border-color:#f4d2bf}
.preview-filetype-badge.image{color:#6d32dc;background:#f5f3ff;border-color:#ddd2fe}

.preview-shortcuts{
  margin:6px 10px 8px;
  padding:7px 8px;
  display:flex;
  align-items:center;
  gap:5px 7px;
  flex-wrap:wrap;
  border:1px solid #e0e7f0;
  border-radius:9px;
  background:#f8fafc;
  color:#69788c;
  font-size:7.2px;
  line-height:1.2;
}
.preview-shortcuts>b{
  width:100%;
  color:#34465e;
  font-size:7.8px;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.preview-shortcuts>span{white-space:nowrap}
.preview-shortcuts kbd{
  min-width:17px;
  padding:2px 4px;
  display:inline-block;
  border:1px solid #ccd7e4;
  border-bottom-width:2px;
  border-radius:4px;
  color:#3c4d64;
  background:#fff;
  font:800 6.8px/1 Arial,sans-serif;
  text-align:center;
  box-shadow:0 1px 1px rgba(15,23,42,.04);
}

.office-unsaved-badge{
  margin-right:auto;
  min-height:30px;
  padding:0 10px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid #f2d08e;
  border-radius:8px;
  color:#9b5a00;
  background:#fff8e8;
  font-size:9px;
  font-weight:900;
  animation:officeUnsavedPulse 1.8s ease-in-out infinite;
}
.office-unsaved-badge.hidden{display:none!important}
.office-editor-actions .modal-primary.has-unsaved{
  box-shadow:0 0 0 3px rgba(236,31,49,.10),0 9px 20px rgba(236,31,49,.18)!important;
}
@keyframes officeUnsavedPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(245,158,11,0)}
  50%{box-shadow:0 0 0 3px rgba(245,158,11,.08)}
}

/* Doble clic como acceso rápido al editor de contenido. */
.annotation-canvas.tool-select{
  cursor:default;
}
#previewShell[data-filetype="pdf"] .annotation-canvas.tool-select,
#previewShell[data-filetype="word"] .annotation-canvas.tool-select,
#previewShell[data-filetype="excel"] .annotation-canvas.tool-select,
#previewShell[data-filetype="powerpoint"] .annotation-canvas.tool-select{
  cursor:default;
}

@media(max-width:900px){
  .preview-filetype-badge{height:20px;min-width:34px;padding:0 5px;font-size:7px}
  .preview-shortcuts{display:none}
  .office-unsaved-badge{width:100%;margin:0 0 5px;justify-content:center}
}
.office-save-shortcut{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:4px;
  color:#718096;
  font-size:8px;
  font-weight:800;
  white-space:nowrap;
}
.office-save-shortcut kbd{
  padding:3px 5px;
  border:1px solid #d4deea;
  border-bottom-width:2px;
  border-radius:5px;
  color:#42536b;
  background:#fff;
  font:850 7px/1 Arial,sans-serif;
}
.office-unsaved-badge:not(.hidden) + .office-save-shortcut{margin-left:4px}
@media(max-width:900px){.office-save-shortcut{display:none}}

/* V46: editor de contenido compacto, con proporción visual similar a la vista previa. */
.office-editor-modal{
  padding:2px!important;
  align-items:stretch!important;
  justify-content:stretch!important;
}
.office-editor-card{
  width:calc(100vw - 4px)!important;
  height:calc(100vh - 4px)!important;
  max-width:none!important;
  max-height:none!important;
  border-radius:12px!important;
  grid-template-rows:52px 40px 34px 29px minmax(0,1fr) 48px!important;
  background:#eef2f7!important;
}
.office-editor-head{
  min-height:52px!important;
  padding:5px 12px!important;
  align-items:center!important;
  gap:10px!important;
}
.office-editor-head>div{
  min-width:0!important;
  display:grid!important;
  grid-template-columns:auto minmax(0,auto) minmax(120px,1fr)!important;
  grid-template-rows:auto!important;
  align-items:center!important;
  column-gap:9px!important;
}
.office-editor-head .modal-kicker{
  margin:0!important;
  font-size:7px!important;
  line-height:1!important;
  white-space:nowrap!important;
}
.office-editor-head h2{
  margin:0!important;
  font-size:16px!important;
  line-height:1.05!important;
  white-space:nowrap!important;
}
.office-editor-head small{
  min-width:0!important;
  margin:0!important;
  font-size:8px!important;
  line-height:1.15!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
#closeOfficeEditorBtn.modal-close{
  width:34px!important;
  height:34px!important;
  flex:0 0 34px!important;
  font-size:20px!important;
}
.office-editor-toolbar{
  min-height:40px!important;
  padding:4px 10px!important;
  gap:5px!important;
  flex-wrap:nowrap!important;
  overflow-x:auto!important;
}
.office-editor-toolbar>button{
  width:30px!important;
  height:30px!important;
  min-width:30px!important;
  border-radius:7px!important;
  font-size:12px!important;
}
.office-editor-toolbar label{
  height:30px!important;
  padding:0 6px!important;
  border-radius:7px!important;
  font-size:8px!important;
}
.office-editor-toolbar input[type="number"]{width:44px!important}
.office-editor-toolbar input[type="color"]{width:24px!important;height:21px!important}
.office-toolbar-sep{height:22px!important;margin:0 2px!important}
.office-editor-nav{
  min-height:34px!important;
  padding:3px 10px!important;
  gap:6px!important;
  font-size:8.5px!important;
}
.office-editor-nav select{
  min-width:145px!important;
  height:27px!important;
  padding:0 7px!important;
  border-radius:7px!important;
  font-size:9px!important;
}
.office-editor-nav #officeEditorStatus{
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.office-edit-legend{
  min-height:29px!important;
  padding:3px 10px!important;
  gap:5px!important;
  flex-wrap:nowrap!important;
  overflow:hidden!important;
  font-size:8px!important;
}
.office-legend-chip{
  height:20px!important;
  padding:0 7px!important;
  font-size:7.5px!important;
}
.office-legend-chip i{width:6px!important;height:6px!important}
.office-edit-summary{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.office-native-viewport{
  padding:2px!important;
  background:#e8edf4!important;
  scroll-padding:4px!important;
}
.office-native-stage{
  min-height:100%!important;
}
.office-word-stage{
  gap:8px!important;
  padding:1px 2px 12px!important;
}
.office-word-stage .docx-wrapper{
  margin:0 auto!important;
  padding:0!important;
}
.office-word-stage .office-word-editable-block{
  outline-width:1px!important;
  outline-offset:1px!important;
}
.office-word-stage .office-word-editable-block:hover{
  outline-color:rgba(21,91,221,.18)!important;
  background:rgba(234,242,255,.08)!important;
}
.office-word-stage .office-word-editable-block:focus{
  outline:1px solid rgba(21,91,221,.45)!important;
  outline-offset:1px!important;
  background:rgba(234,242,255,.10)!important;
  box-shadow:none!important;
}
.office-word-stage .office-word-editable-block:hover::after,
.office-word-stage .office-word-editable-block:focus::after{
  top:-12px!important;
  padding:1px 4px!important;
  font-size:6px!important;
  opacity:.88!important;
}
.office-word-stage .office-word-editable:focus{
  box-shadow:none!important;
}
.office-pdf-stage{
  padding:2px 2px 14px!important;
}
.office-pdf-surface{
  width:min(1500px,100%)!important;
  box-shadow:0 8px 24px rgba(15,23,42,.13)!important;
}
.office-pdf-textbox{
  outline-color:rgba(37,99,235,.24)!important;
}
.office-pdf-textbox:hover,
.office-pdf-textbox:focus,
.office-pdf-textbox.selected,
.office-pdf-textbox.changed{
  outline-width:1px!important;
  box-shadow:0 1px 5px rgba(37,99,235,.10)!important;
}
.office-ppt-stage{
  padding:2px 2px 14px!important;
}
.office-ppt-surface{
  width:min(1500px,100%)!important;
  box-shadow:0 8px 24px rgba(15,23,42,.13)!important;
}
.office-excel-stage{padding:0 0 14px!important}
.office-editor-actions{
  min-height:48px!important;
  padding:5px 10px!important;
  gap:7px!important;
  align-items:center!important;
}
.office-editor-actions .modal-secondary,
.office-editor-actions .modal-primary{
  min-width:128px!important;
  min-height:34px!important;
  height:34px!important;
  border-radius:9px!important;
  font-size:10px!important;
}
.office-unsaved-badge,
.office-save-shortcut{font-size:8px!important}

@media(max-width:900px){
  .office-editor-modal{padding:0!important}
  .office-editor-card{
    width:100vw!important;height:100vh!important;border-radius:0!important;
    grid-template-rows:48px 38px auto auto minmax(0,1fr) 46px!important;
  }
  .office-editor-head{min-height:48px!important;padding:4px 8px!important}
  .office-editor-head>div{grid-template-columns:auto minmax(0,1fr)!important}
  .office-editor-head small{display:none!important}
  .office-editor-toolbar{padding:4px 6px!important}
  .office-editor-nav{padding:3px 7px!important;flex-wrap:nowrap!important}
  .office-editor-nav #officeEditorStatus{display:none!important}
  .office-edit-legend{padding:3px 7px!important}
  .office-edit-summary{display:none!important}
  .office-native-viewport{padding:1px!important}
  .office-editor-actions .modal-secondary,.office-editor-actions .modal-primary{min-width:105px!important}
}

/* V47: autoguardado, navegación, validación, OCR y objetos. */
.session-save-status{
  flex:0 0 auto;min-width:112px;height:30px;padding:0 10px;display:flex;align-items:center;gap:6px;
  border:1px solid #dce5ef;border-radius:999px;background:#fff;color:#607087;font-size:8.5px;font-weight:850;white-space:nowrap
}
.session-save-status i{width:7px;height:7px;border-radius:50%;background:#16a34a;box-shadow:0 0 0 3px rgba(22,163,74,.09)}
.session-save-status.dirty{color:#a45a00;background:#fffaf0;border-color:#f2d29d}.session-save-status.dirty i{background:#f59e0b;box-shadow:0 0 0 3px rgba(245,158,11,.11)}
.session-save-status.saving{color:#155bdd;background:#f3f7ff;border-color:#cbdcff}.session-save-status.saving i{background:#2563eb;animation:sessionPulse .8s infinite alternate}
.session-save-status.error{color:#b42333;background:#fff4f5;border-color:#f0c8ce}.session-save-status.error i{background:#dc2639}
@keyframes sessionPulse{to{opacity:.3;transform:scale(.78)}}

.session-recovery-banner{
  width:min(1180px,calc(100% - 32px));margin:12px auto 0;padding:10px 12px;display:flex;align-items:center;gap:9px;
  border:1px solid #bcd1fb;border-radius:12px;background:linear-gradient(135deg,#f5f9ff,#fff);box-shadow:0 6px 18px rgba(37,99,235,.07)
}
.session-recovery-banner.hidden{display:none!important}.session-recovery-banner>div{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px}.session-recovery-banner b{color:#174b8c;font-size:10px}.session-recovery-banner span{color:#718096;font-size:8.5px}
.session-recovery-banner button{height:32px;padding:0 12px;border:1px solid #2563eb;border-radius:8px;background:#2563eb;color:#fff;font-size:8.5px;font-weight:900}.session-recovery-banner button.secondary{border-color:#d7e1ec;background:#fff;color:#526176}

.preview-page-nav{height:31px;display:flex;align-items:center;gap:3px;padding:2px;border:1px solid #dbe4ee;border-radius:9px;background:#f8fafc}
.preview-page-nav>button{width:28px;height:27px;border:0;border-radius:7px;background:transparent;color:#334155;font-size:15px;font-weight:900}.preview-page-nav>button:hover:not(:disabled),.preview-page-nav>button.active{background:#eaf2ff;color:#155bdd}.preview-page-nav>button:disabled{opacity:.32}
.preview-page-nav label{height:27px;padding:0 5px;display:flex;align-items:center;gap:3px;border-radius:7px;background:#fff;color:#6b7b91;font-size:8px;font-weight:850}
.preview-page-nav input{width:34px;border:0;outline:0;background:transparent;color:#172033;text-align:right;font-size:9px;font-weight:900;-moz-appearance:textfield}.preview-page-nav input::-webkit-inner-spin-button{display:none}

.preview-thumb-rail{position:absolute;z-index:40;left:8px;top:8px;bottom:8px;width:94px;padding:6px;overflow:auto;display:flex;flex-direction:column;gap:7px;border:1px solid #d7e1ed;border-radius:11px;background:rgba(248,250,252,.96);box-shadow:0 10px 30px rgba(15,23,42,.18);backdrop-filter:blur(5px)}
.preview-thumb-rail.hidden{display:none!important}.preview-thumb-item{position:relative;width:100%;padding:4px;border:1px solid #d9e2ec;border-radius:8px;background:#fff}.preview-thumb-item:hover{border-color:#9ebcf3}.preview-thumb-item.active{border-color:#2563eb;box-shadow:0 0 0 2px rgba(37,99,235,.12)}.preview-thumb-item canvas{display:block;width:100%;aspect-ratio:210/297;background:#fff;border-radius:4px}.preview-thumb-item span{position:absolute;right:6px;bottom:6px;min-width:18px;height:18px;padding:0 4px;display:grid;place-items:center;border-radius:999px;background:#172033;color:#fff;font-size:7px;font-weight:900}

.ocr-region-actions button{width:100%;min-height:31px;border:1px solid #f1bd73;border-radius:8px;background:#fff8ed;color:#a45800;font-size:8.5px;font-weight:900}.ocr-region-actions button:hover{background:#ffefd7}
.annotation-canvas.tool-ocr-region{cursor:crosshair!important}

.preview-edit-toolbar .selection-action{color:#53637a!important}.preview-edit-toolbar .selection-action:hover{color:#155bdd!important}

.placed-item-controls{position:absolute;left:50%;top:-31px;z-index:10;display:none;align-items:center;gap:2px;transform:translateX(-50%);padding:3px;border:1px solid #d7e1ec;border-radius:8px;background:rgba(255,255,255,.96);box-shadow:0 5px 14px rgba(15,23,42,.16)}
.placed-signature:hover .placed-item-controls,.placed-image:hover .placed-item-controls{display:flex}.placed-item-controls button{width:23px;height:23px;border:0;border-radius:5px;background:#f4f7fb;color:#405269;font-size:11px;font-weight:900}.placed-item-controls button:hover{background:#eaf2ff;color:#155bdd}

.document-validation-box{margin:0 0 10px;padding:9px 10px;border:1px solid #dce5ef;border-radius:10px;background:#f8fafc;color:#53637a}.document-validation-box>b{display:block;margin-bottom:4px;font-size:10px}.document-validation-box>span{font-size:8.5px}.document-validation-box.ready{border-color:#bce2ca;background:#f2fbf5}.document-validation-box.ready>b{color:#18794e}.document-validation-box.warning{border-color:#f1d29c;background:#fffaf0}.document-validation-box.warning>b{color:#a45a00}.document-validation-box.error{border-color:#efc4ca;background:#fff5f6}.document-validation-box.error>b{color:#bd2637}.document-validation-box ul{margin:5px 0 0;padding-left:17px;display:grid;gap:3px;font-size:8.2px}.document-validation-box li.warning{color:#9a5a08}.document-validation-box li.error{color:#b42333}.document-validation-box li.info{color:#64748b}

@media(max-width:1320px){.session-save-status{display:none}.preview-page-nav label{display:none}}
@media(max-width:900px){.preview-page-nav{display:none}.preview-thumb-rail{width:82px}.session-recovery-banner{flex-wrap:wrap}.session-recovery-banner>div{width:100%;flex-basis:100%}}


/* V48: acceso directo al editor de contenido y cambio rápido a herramientas visuales */
.office-toolbar-mode-btn{
  min-width:170px;
  padding:0 12px!important;
  font-weight:800;
  color:#1e3a8a!important;
  background:#eff6ff!important;
  border:1px solid #c9dafd!important;
  border-radius:12px!important;
}
.office-toolbar-mode-btn:hover{
  background:#dbeafe!important;
  border-color:#93c5fd!important;
}

/* V49: experiencia unificada Contenido / Visual */
.workspace-mode-switch{
  height:32px;padding:3px;display:flex;align-items:center;gap:3px;border:1px solid #d7e2ef;border-radius:10px;background:#f4f7fb;box-shadow:inset 0 1px 2px rgba(15,23,42,.04)
}
.workspace-mode-switch.hidden{display:none!important}
.workspace-mode-switch button{
  height:24px;padding:0 10px;border:0;border-radius:7px;color:#617087;background:transparent;font-size:8.5px;font-weight:900;white-space:nowrap
}
.workspace-mode-switch button.active{
  color:#fff;background:#155bdd;box-shadow:0 3px 8px rgba(21,91,221,.18)
}
.workspace-mode-switch button:disabled{opacity:1;cursor:default}

.office-visual-quick-tools{
  min-width:0;display:flex;align-items:center;gap:4px;overflow-x:auto;padding:2px 0;scrollbar-width:thin
}
.office-visual-quick-tools>button{
  min-width:auto!important;width:auto!important;height:32px!important;padding:0 9px!important;border:1px solid #d7e1ed!important;border-radius:9px!important;color:#4b5d73!important;background:#fff!important;font-size:8.5px!important;font-weight:850!important;white-space:nowrap!important
}
.office-visual-quick-tools>button:hover{
  color:#155bdd!important;border-color:#9ebcf2!important;background:#f4f8ff!important
}
.office-visual-quick-tools .office-toolbar-mode-btn{
  color:#fff!important;background:#155bdd!important;border-color:#155bdd!important;box-shadow:0 4px 10px rgba(21,91,221,.16)
}
.office-editor-toolbar{overflow-x:auto;flex-wrap:nowrap!important;scrollbar-width:thin}
.office-editor-toolbar>label,.office-editor-toolbar>.office-toolbar-sep,.office-editor-toolbar>button{flex:0 0 auto}
.office-visual-quick-tools{flex:1 1 auto}

/* Los dos espacios usan el mismo lenguaje visual para que el cambio de modo sea continuo. */
.office-editor-modal,.preview-modal{background:rgba(15,23,42,.74)!important}
.office-editor-card,.preview-shell{border:1px solid rgba(203,213,225,.88)!important;box-shadow:0 24px 70px rgba(15,23,42,.28)!important}

@media(max-width:1200px){
  .workspace-mode-switch button{padding:0 7px;font-size:8px}
  .office-visual-quick-tools>button{padding:0 7px!important;font-size:8px!important}
}
.office-mode-current{
  height:30px;padding:0 10px;display:inline-flex;align-items:center;border-radius:9px;color:#fff;background:#155bdd;font-size:8.5px;font-weight:950;white-space:nowrap;box-shadow:0 4px 10px rgba(21,91,221,.16)
}


/* V50: clic de apertura confiable; arrastre solo desde el grip. */
.page-card{cursor:pointer!important}
.page-card .drag-grip{cursor:grab!important;pointer-events:auto!important}
.page-card .drag-grip:active{cursor:grabbing!important}
.page-card .canvas-wrap{cursor:pointer!important}
.page-card:hover{box-shadow:0 10px 26px rgba(37,99,235,.13)!important;border-color:#8fb3f5!important}

/* V52: clic corto abre; pulsación sostenida permite reordenar desde toda la tarjeta. */
.page-card{cursor:pointer!important}
.page-card.hold-drag-active,
.page-card.hold-drag-active .canvas-wrap,
.page-card.hold-drag-active .drag-grip{cursor:grabbing!important;user-select:none!important}
.page-card.hold-drag-active{opacity:.78!important;transform:scale(.985);box-shadow:0 12px 30px rgba(15,23,42,.16)!important}
.page-card .drag-grip{cursor:pointer!important;opacity:.72!important}

/* V53: todas las herramientas visuales funcionan dentro del editor de contenido. */
.office-visual-quick-tools>button.active,
.office-visual-quick-tools .office-toolbar-mode-btn.active{
  color:#fff!important;
  background:#155bdd!important;
  border-color:#155bdd!important;
  box-shadow:0 4px 10px rgba(21,91,221,.18)!important;
}

/* V57-final: reglas finales del editor Word. Se dejan al final para que
   ninguna versión anterior de la barra pueda volver a convertir la leyenda
   en una fila flexible que empuje la hoja fuera de la ventana. */
.office-editor-card{
  display:grid!important;
  grid-template-rows:52px 50px 40px 34px 29px minmax(0,1fr) 48px!important;
}
.office-editor-card>.office-editor-head{grid-row:1!important;min-height:0!important}
.office-editor-card>#officeEditorToolbar{grid-row:2!important;min-height:0!important}
.office-editor-card>#officeVisualOptions{grid-row:3!important;min-height:0!important}
.office-editor-card>.office-editor-nav{grid-row:4!important;min-height:0!important}
.office-editor-card>#officeEditLegend{grid-row:5!important;min-height:0!important;height:29px!important}
.office-editor-card>#officeNativeViewport{grid-row:6!important;min-height:0!important}
.office-editor-card>.office-editor-actions{grid-row:7!important;min-height:0!important}

.office-visual-quick-tools{
  display:flex!important;
  align-items:stretch!important;
  gap:5px!important;
  min-width:0!important;
  flex:1 1 auto!important;
  overflow-x:auto!important;
  padding:2px 1px!important;
}
.office-visual-quick-tools>button{
  display:flex!important;
  flex:0 0 62px!important;
  width:62px!important;
  min-width:62px!important;
  height:44px!important;
  min-height:44px!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  gap:3px!important;
  padding:4px!important;
  border:1px solid #d9e3ee!important;
  border-radius:9px!important;
  background:linear-gradient(180deg,#fff,#f8fafc)!important;
  box-shadow:0 2px 6px rgba(15,23,42,.045)!important;
  font-size:8px!important;
  line-height:1!important;
  white-space:nowrap!important;
}
.office-visual-quick-tools>button:hover:not(:disabled){
  transform:translateY(-1px)!important;
  border-color:#9ebcf2!important;
  background:linear-gradient(180deg,#fff,#f1f6ff)!important;
  box-shadow:0 6px 12px rgba(37,99,235,.10)!important;
}
.office-visual-quick-tools>button.active{
  color:#fff!important;
  border-color:#155bdd!important;
  background:linear-gradient(145deg,#2b78e9,#155bdd)!important;
  box-shadow:0 6px 13px rgba(21,91,221,.20)!important;
}
.office-visual-quick-tools .office-tool-glyph{
  display:grid!important;
  width:22px!important;
  height:21px!important;
  place-items:center!important;
  color:currentColor!important;
  font:500 19px/1 Arial,sans-serif!important;
  font-style:normal!important;
}
.office-visual-quick-tools>button>span:not(.office-tool-glyph){
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  color:inherit!important;
  font-size:7.5px!important;
  font-weight:900!important;
  line-height:1.05!important;
  text-align:center!important;
}

/* El panel contextual flota bajo la barra: nunca cambia la altura del lienzo. */
.office-editor-card>#officeVisualOptions:not(.hidden){
  position:absolute!important;
  z-index:70!important;
  top:102px!important;
  left:0!important;
  right:0!important;
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  border-top:1px solid #dce5ef!important;
  border-bottom:1px solid #dce5ef!important;
  box-shadow:0 6px 14px rgba(15,23,42,.08)!important;
}
.office-editor-card>#officeVisualOptions.hidden{display:none!important}

@media(max-width:900px){
  .office-editor-card{grid-template-rows:48px 48px 38px 34px 29px minmax(0,1fr) 46px!important}
  .office-visual-quick-tools>button{flex-basis:57px!important;width:57px!important;min-width:57px!important;height:42px!important;min-height:42px!important}
  .office-editor-card>#officeVisualOptions:not(.hidden){top:96px!important;height:38px!important;min-height:38px!important;max-height:38px!important}
}

/* V57: reglas finales del editor Word. Se dejan al final para que ninguna
   versión anterior de la barra pueda volver a convertir la leyenda en una
   fila flexible que empuje la hoja fuera de la ventana. */
.office-editor-card{
  display:grid!important;
  grid-template-rows:52px 50px 40px 34px 29px minmax(0,1fr) 48px!important;
}
.office-editor-card>.office-editor-head{grid-row:1!important;min-height:0!important}
.office-editor-card>#officeEditorToolbar{grid-row:2!important;min-height:0!important}
.office-editor-card>#officeVisualOptions{grid-row:3!important;min-height:0!important}
.office-editor-card>.office-editor-nav{grid-row:4!important;min-height:0!important}
.office-editor-card>#officeEditLegend{grid-row:5!important;min-height:0!important;height:29px!important}
.office-editor-card>#officeNativeViewport{grid-row:6!important;min-height:0!important}
.office-editor-card>.office-editor-actions{grid-row:7!important;min-height:0!important}

.office-visual-quick-tools{
  display:flex!important;
  align-items:stretch!important;
  gap:5px!important;
  min-width:0!important;
  flex:1 1 auto!important;
  overflow-x:auto!important;
  padding:2px 1px!important;
}
.office-visual-quick-tools>button{
  display:flex!important;
  flex:0 0 62px!important;
  width:62px!important;
  min-width:62px!important;
  height:44px!important;
  min-height:44px!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  gap:3px!important;
  padding:4px!important;
  border:1px solid #d9e3ee!important;
  border-radius:9px!important;
  background:linear-gradient(180deg,#fff,#f8fafc)!important;
  box-shadow:0 2px 6px rgba(15,23,42,.045)!important;
  font-size:8px!important;
  line-height:1!important;
  white-space:nowrap!important;
}
.office-visual-quick-tools>button:hover:not(:disabled){
  transform:translateY(-1px)!important;
  border-color:#9ebcf2!important;
  background:linear-gradient(180deg,#fff,#f1f6ff)!important;
  box-shadow:0 6px 12px rgba(37,99,235,.10)!important;
}
.office-visual-quick-tools>button.active{
  color:#fff!important;
  border-color:#155bdd!important;
  background:linear-gradient(145deg,#2b78e9,#155bdd)!important;
  box-shadow:0 6px 13px rgba(21,91,221,.20)!important;
}
.office-visual-quick-tools .office-tool-glyph{
  display:grid!important;
  width:22px!important;
  height:21px!important;
  place-items:center!important;
  color:currentColor!important;
  font:500 19px/1 Arial,sans-serif!important;
  font-style:normal!important;
}
.office-visual-quick-tools>button>span:not(.office-tool-glyph){
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  color:inherit!important;
  font-size:7.5px!important;
  font-weight:900!important;
  line-height:1.05!important;
  text-align:center!important;
}

/* El panel contextual flota bajo la barra: nunca cambia la altura del lienzo. */
.office-editor-card>#officeVisualOptions:not(.hidden){
  position:absolute!important;
  z-index:70!important;
  top:102px!important;
  left:0!important;
  right:0!important;
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  border-top:1px solid #dce5ef!important;
  border-bottom:1px solid #dce5ef!important;
  box-shadow:0 6px 14px rgba(15,23,42,.08)!important;
}
.office-editor-card>#officeVisualOptions.hidden{display:none!important}

@media(max-width:900px){
  .office-editor-card{grid-template-rows:48px 48px 38px 34px 29px minmax(0,1fr) 46px!important}
  .office-visual-quick-tools>button{flex-basis:57px!important;width:57px!important;min-width:57px!important;height:42px!important;min-height:42px!important}
  .office-editor-card>#officeVisualOptions:not(.hidden){top:96px!important;height:38px!important;min-height:38px!important;max-height:38px!important}
}

/* V55 · el panel contextual flota y nunca vuelve a empujar la hoja */
.office-editor-card{position:relative!important}
#officeVisualOptions:not(.hidden){
  position:absolute!important;
  z-index:70!important;
  top:92px!important;
  left:0!important;
  right:0!important;
  min-height:38px!important;
  max-height:52px!important;
  overflow:visible!important;
  border-top:1px solid #dce5ef!important;
  border-bottom:1px solid #dce5ef!important;
  box-shadow:0 6px 14px rgba(15,23,42,.08)!important;
}
#officeVisualOptions.hidden{display:none!important}

/* Compatibilidad con copias antiguas del HTML: si una herramienta aún no
   trae su span de icono, el icono se dibuja automáticamente. */
.office-visual-quick-tools>button:not(:has(.office-tool-glyph))::before{
  display:block!important;
  margin-bottom:3px!important;
  font:500 18px/1 Arial,sans-serif!important;
  color:currentColor!important;
}
.office-visual-quick-tools>button[data-office-visual-tool="content"]:not(:has(.office-tool-glyph))::before{content:"✦"}
.office-visual-quick-tools>button[data-office-visual-tool="select"]:not(:has(.office-tool-glyph))::before{content:"↖"}
.office-visual-quick-tools>button[data-office-visual-tool="highlight"]:not(:has(.office-tool-glyph))::before{content:"▰"}
.office-visual-quick-tools>button[data-office-visual-tool="draw"]:not(:has(.office-tool-glyph))::before{content:"⌁"}
.office-visual-quick-tools>button[data-office-visual-tool="text"]:not(:has(.office-tool-glyph))::before{content:"T"}
.office-visual-quick-tools>button[data-office-visual-tool="correct"]:not(:has(.office-tool-glyph))::before{content:"T̶"}
.office-visual-quick-tools>button[data-office-visual-tool="shape"]:not(:has(.office-tool-glyph))::before{content:"◇"}
.office-visual-quick-tools>button[data-office-visual-tool="redact"]:not(:has(.office-tool-glyph))::before{content:"▮"}
.office-visual-quick-tools>button[data-office-visual-tool="crop"]:not(:has(.office-tool-glyph))::before{content:"⌗"}
.office-visual-quick-tools>button[data-office-visual-tool="signature"]:not(:has(.office-tool-glyph))::before{content:"✎"}
.office-visual-quick-tools>button[data-office-visual-tool="image"]:not(:has(.office-tool-glyph))::before{content:"▧"}
.office-visual-quick-tools>button[data-office-action="undo"]:not(:has(.office-tool-glyph))::before{content:"↶"}
.office-visual-quick-tools>button[data-office-action="redo"]:not(:has(.office-tool-glyph))::before{content:"↷"}
.office-visual-quick-tools>button[data-office-action="remove"]:not(:has(.office-tool-glyph))::before{content:"⌫"}

/* V54: herramientas internas visuales y cuadrícula estable del editor Word.
   El bloque de opciones es una fila propia: al abrir Texto/Resaltar/etc.
   solo crece esa fila y la hoja conserva siempre el espacio flexible. */
.office-editor-card{
  grid-template-rows:52px minmax(40px,auto) auto auto auto minmax(0,1fr) 48px!important;
}
.office-editor-card>.office-editor-head{grid-row:1!important}
.office-editor-card>#officeEditorToolbar{grid-row:2!important}
.office-editor-card>#officeVisualOptions{grid-row:3!important}
.office-editor-card>.office-editor-nav{grid-row:4!important}
.office-editor-card>#officeEditLegend{grid-row:5!important}
.office-editor-card>#officeNativeViewport{grid-row:6!important}
.office-editor-card>.office-editor-actions{grid-row:7!important}

/* La franja de herramientas se lee como una mini barra profesional, no como
   una línea de texto. Cada acción mantiene su ancho y su estado activo. */
.office-visual-quick-tools{
  min-width:0!important;
  flex:1 1 auto!important;
  display:flex!important;
  align-items:stretch!important;
  gap:5px!important;
  overflow-x:auto!important;
  padding:2px 1px!important;
  scrollbar-width:thin;
}
.office-visual-quick-tools>button{
  position:relative!important;
  flex:0 0 62px!important;
  width:62px!important;
  min-width:62px!important;
  height:44px!important;
  min-height:44px!important;
  padding:4px 4px 3px!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  gap:3px!important;
  border:1px solid #d9e3ee!important;
  border-radius:9px!important;
  color:#41536b!important;
  background:linear-gradient(180deg,#fff,#f8fafc)!important;
  box-shadow:0 2px 6px rgba(15,23,42,.045)!important;
  font-size:8px!important;
  font-weight:850!important;
  line-height:1!important;
  white-space:nowrap!important;
  transition:transform .14s ease,border-color .14s ease,background .14s ease,box-shadow .14s ease,color .14s ease!important;
}
.office-visual-quick-tools>button:hover:not(:disabled){
  transform:translateY(-1px)!important;
  color:#155bdd!important;
  border-color:#9ebcf2!important;
  background:linear-gradient(180deg,#fff,#f1f6ff)!important;
  box-shadow:0 6px 12px rgba(37,99,235,.10)!important;
}
.office-visual-quick-tools>button.active{
  color:#fff!important;
  border-color:#155bdd!important;
  background:linear-gradient(145deg,#2b78e9,#155bdd)!important;
  box-shadow:0 6px 13px rgba(21,91,221,.20)!important;
}
.office-visual-quick-tools>button:disabled{opacity:.45!important;cursor:not-allowed!important}
.office-visual-quick-tools .office-tool-glyph{
  width:22px!important;
  height:21px!important;
  display:grid!important;
  place-items:center!important;
  color:currentColor!important;
  font:500 19px/1 Arial,sans-serif!important;
  font-style:normal!important;
}
.office-visual-quick-tools>button>span:not(.office-tool-glyph){
  display:block!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  color:inherit!important;
  font-size:7.5px!important;
  font-weight:900!important;
  line-height:1.05!important;
  text-align:center!important;
}
.office-visual-quick-tools>button[data-office-visual-tool="highlight"]{color:#a16207!important}
.office-visual-quick-tools>button[data-office-visual-tool="draw"]{color:#0e7490!important}
.office-visual-quick-tools>button[data-office-visual-tool="text"]{color:#2563eb!important}
.office-visual-quick-tools>button[data-office-visual-tool="correct"]{color:#7c3aed!important}
.office-visual-quick-tools>button[data-office-visual-tool="shape"]{color:#8b5cf6!important}
.office-visual-quick-tools>button[data-office-visual-tool="redact"]{color:#dc2639!important}
.office-visual-quick-tools>button[data-office-visual-tool="crop"]{color:#475569!important}
.office-visual-quick-tools>button[data-office-visual-tool="signature"]{color:#0f8f6a!important}
.office-visual-quick-tools>button[data-office-visual-tool="image"]{color:#7c3aed!important}
.office-visual-quick-tools>button[data-office-action="undo"],
.office-visual-quick-tools>button[data-office-action="redo"]{color:#315278!important}
.office-visual-quick-tools>button[data-office-action="remove"]{color:#c51c30!important}
.office-visual-quick-tools>button.active .office-tool-glyph,
.office-visual-quick-tools>button.active>span:not(.office-tool-glyph){color:#fff!important}

/* Opciones contextuales: aparecen bajo la barra sin alterar el cálculo de la
   zona de la hoja ni generar una franja vacía. */
.office-visual-options{
  min-height:38px!important;
  box-sizing:border-box!important;
  align-self:stretch!important;
  overflow:visible!important;
}
.office-visual-options.hidden{display:none!important}
.office-native-viewport{min-height:0!important;overflow:auto!important}

@media(max-width:900px){
  .office-editor-card{grid-template-rows:48px minmax(38px,auto) auto auto auto minmax(0,1fr) 46px!important}
  .office-visual-quick-tools>button{flex-basis:57px!important;width:57px!important;min-width:57px!important;height:42px!important;min-height:42px!important}
  .office-visual-quick-tools>button>span:not(.office-tool-glyph){font-size:7px!important}
}
.office-visual-options{
  min-height:38px;
  padding:5px 12px;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  border-bottom:1px solid #dce5ef;
  background:#fbfcfe;
}
.office-visual-options.hidden{display:none!important}
.office-visual-options label{
  min-height:30px;
  padding:3px 7px;
  display:flex;
  align-items:center;
  gap:5px;
  border:1px solid #d8e2ed;
  border-radius:8px;
  color:#5b6a80;
  background:#fff;
  font-size:8.5px;
  font-weight:850;
}
.office-visual-options input[type="color"]{width:28px;height:24px;padding:1px;border:0;background:transparent}
.office-visual-options input[type="range"]{width:90px}
.office-visual-options select{height:24px;border:0;outline:0;background:#fff;color:#334155;font-size:9px;font-weight:800}
.office-visual-options small{margin-left:auto;color:#718096;font-size:8.3px;font-weight:700}
.office-crop-apply{
  height:30px;padding:0 10px;border:1px solid #86c69d;border-radius:8px;color:#087a43;background:#eefbf4;font-size:8.5px;font-weight:900
}
.office-crop-apply:hover{background:#def6e9}

.office-visual-overlay{
  position:absolute;
  z-index:30;
  display:block;
  pointer-events:none;
  touch-action:none;
}
.office-visual-overlay.tool-active{pointer-events:auto}
.office-visual-overlay.tool-select{cursor:default}
.office-visual-overlay.tool-highlight{cursor:crosshair}
.office-visual-overlay.tool-draw{cursor:crosshair}
.office-visual-overlay.tool-text,.office-visual-overlay.tool-correct{cursor:text}
.office-visual-overlay.tool-shape,.office-visual-overlay.tool-redact,.office-visual-overlay.tool-crop{cursor:crosshair}
.office-visual-overlay.tool-highlight{
  cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48ZyB0cmFuc2Zvcm09InJvdGF0ZSgtNDIgMTYgMTYpIj48cmVjdCB4PSIxMCIgeT0iMyIgd2lkdGg9IjEyIiBoZWlnaHQ9IjIwIiByeD0iMyIgZmlsbD0iI2ZmZDQwMCIgc3Ryb2tlPSIjMjczNjRiIiBzdHJva2Utd2lkdGg9IjEuNSIvPjxyZWN0IHg9IjEwIiB5PSI0IiB3aWR0aD0iMTIiIGhlaWdodD0iNSIgcng9IjIiIGZpbGw9IiNmZmY0YTMiLz48cGF0aCBkPSJNMTAgMjJoMTJsLTIuNSA3aC03eiIgZmlsbD0iIzRiNTU2MyIgc3Ryb2tlPSIjMjczNjRiIiBzdHJva2Utd2lkdGg9IjEuMiIvPjxwYXRoIGQ9Ik0xMyAyN2g2bC0uNyAyaC00LjZ6IiBmaWxsPSIjZmZkNDAwIi8+PC9nPjwvc3ZnPg==") 6 27, crosshair!important;
}
.office-visual-overlay.tool-draw{
  cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48ZyB0cmFuc2Zvcm09InJvdGF0ZSgtNDUgMTYgMTYpIj48cGF0aCBkPSJNMTEgMmgxMHYyMkgxMXoiIGZpbGw9IiNmNmMwNzEiIHN0cm9rZT0iIzMzNDE1NSIgc3Ryb2tlLXdpZHRoPSIxLjQiLz48cGF0aCBkPSJNMTEgMmgxMHY1SDF6IiBmaWxsPSIjZjhhZmIyIi8+PHBhdGggZD0iTTExIDI0aDEwbC01IDZ6IiBmaWxsPSIjZWJkNWI3IiBzdHJva2U9IiMzMzQxNTUiIHN0cm9rZS13aWR0aD0iMS4yIi8+PHBhdGggZD0iTTE0LjcgMjguMmg2LjZMMTYgMzB6IiBmaWxsPSIjMTExODI3Ii8+PC9nPjwvc3ZnPg==") 16 30, crosshair!important;
}
.office-visual-inline-editor{
  position:absolute;
  z-index:45;
  min-width:180px;
  max-width:360px;
  padding:6px;
  border:2px solid #2563eb;
  border-radius:9px;
  background:rgba(255,255,255,.98);
  box-shadow:0 10px 26px rgba(15,23,42,.18);
}
.office-visual-inline-editor textarea{
  width:100%;min-height:42px;padding:7px 8px;border:0;outline:0;resize:none;background:transparent;color:#111827;line-height:1.2
}
.office-visual-inline-editor small{display:block;margin-top:3px;color:#64748b;font-size:7.5px;font-weight:750}
.office-word-stage section.docx,
.office-word-stage .docx-wrapper,
.office-ppt-surface,
.office-pdf-surface,
.office-excel-stage{position:relative!important}
.office-native-stage.office-visual-tool-active [contenteditable="true"]{caret-color:transparent}
.office-native-stage.office-visual-tool-active .office-word-editable-block,
.office-native-stage.office-visual-tool-active .office-ppt-textbox,
.office-native-stage.office-visual-tool-active .office-pdf-textbox,
.office-native-stage.office-visual-tool-active .office-excel-grid td{cursor:inherit!important}

@media(max-width:1100px){
  .office-visual-options{gap:5px;padding:5px 8px}
  .office-visual-options small{width:100%;margin-left:0}
}

/* V53 override: "Contenido" ya no queda forzado en azul cuando otra herramienta está activa. */
.office-visual-quick-tools .office-toolbar-mode-btn{
  color:#4b5d73!important;
  background:#fff!important;
  border-color:#d7e1ed!important;
  box-shadow:none!important;
}
.office-visual-quick-tools .office-toolbar-mode-btn.active{
  color:#fff!important;
  background:#155bdd!important;
  border-color:#155bdd!important;
  box-shadow:0 4px 10px rgba(21,91,221,.18)!important;
}

/* V57-final: última capa de layout e iconos del editor Word. */
.office-editor-card{display:grid!important;grid-template-rows:52px 50px 40px 34px 29px minmax(0,1fr) 48px!important}
.office-editor-card>.office-editor-head{grid-row:1!important;min-height:0!important}
.office-editor-card>#officeEditorToolbar{grid-row:2!important;min-height:0!important}
.office-editor-card>#officeVisualOptions{grid-row:3!important;min-height:0!important}
.office-editor-card>.office-editor-nav{grid-row:4!important;min-height:0!important}
.office-editor-card>#officeEditLegend{grid-row:5!important;min-height:0!important;height:29px!important}
.office-editor-card>#officeNativeViewport{grid-row:6!important;min-height:0!important}
.office-editor-card>.office-editor-actions{grid-row:7!important;min-height:0!important}
.office-visual-quick-tools{display:flex!important;align-items:stretch!important;gap:5px!important;min-width:0!important;flex:1 1 auto!important;overflow-x:auto!important;padding:2px 1px!important}
.office-visual-quick-tools>button{display:flex!important;flex:0 0 62px!important;width:62px!important;min-width:62px!important;height:44px!important;min-height:44px!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;padding:4px!important;border:1px solid #d9e3ee!important;border-radius:9px!important;background:linear-gradient(180deg,#fff,#f8fafc)!important;box-shadow:0 2px 6px rgba(15,23,42,.045)!important;font-size:8px!important;line-height:1!important;white-space:nowrap!important}
.office-visual-quick-tools>button:hover:not(:disabled){transform:translateY(-1px)!important;border-color:#9ebcf2!important;background:linear-gradient(180deg,#fff,#f1f6ff)!important;box-shadow:0 6px 12px rgba(37,99,235,.10)!important}
.office-visual-quick-tools>button.active{color:#fff!important;border-color:#155bdd!important;background:linear-gradient(145deg,#2b78e9,#155bdd)!important;box-shadow:0 6px 13px rgba(21,91,221,.20)!important}
.office-visual-quick-tools .office-tool-glyph{display:grid!important;width:22px!important;height:21px!important;place-items:center!important;color:currentColor!important;font:500 19px/1 Arial,sans-serif!important;font-style:normal!important}
.office-visual-quick-tools>button>span:not(.office-tool-glyph){display:block!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;color:inherit!important;font-size:7.5px!important;font-weight:900!important;line-height:1.05!important;text-align:center!important}
.office-editor-card>#officeVisualOptions:not(.hidden){position:absolute!important;z-index:70!important;top:102px!important;left:0!important;right:0!important;height:40px!important;min-height:40px!important;max-height:40px!important;overflow:hidden!important;box-sizing:border-box!important;border-top:1px solid #dce5ef!important;border-bottom:1px solid #dce5ef!important;box-shadow:0 6px 14px rgba(15,23,42,.08)!important}
.office-editor-card>#officeVisualOptions.hidden{display:none!important}
@media(max-width:900px){.office-editor-card{grid-template-rows:48px 48px 38px 34px 29px minmax(0,1fr) 46px!important}.office-visual-quick-tools>button{flex-basis:57px!important;width:57px!important;min-width:57px!important;height:42px!important;min-height:42px!important}.office-editor-card>#officeVisualOptions:not(.hidden){top:96px!important;height:38px!important;min-height:38px!important;max-height:38px!important}}

/* V58: modales de Firma e Imagen por encima del editor de contenido Office.
   En V57 el editor Office usa z-index 10150 y los modales comunes 10050,
   por eso el clic sí abría el modal pero quedaba oculto detrás. */
#signatureModal,
#imageModal{
  z-index:10350!important;
}


/* V59 · Auditoría de interacción del editor Office */
/* El indicador de proceso y los avisos deben quedar por encima de cualquier modal. */
.busy-overlay{z-index:10550!important}
.toast{z-index:10600!important}

/* Las opciones de cada herramienta son un popover anclado justo debajo del botón activo.
   Ya no reservan una franja completa lejos de la herramienta. */
.office-editor-card{position:relative!important;grid-template-rows:52px 50px 34px 29px minmax(0,1fr) 48px!important}
.office-editor-card>.office-editor-head{grid-row:1!important}
.office-editor-card>#officeEditorToolbar{grid-row:2!important}
.office-editor-card>.office-editor-nav{grid-row:3!important}
.office-editor-card>#officeEditLegend{grid-row:4!important}
.office-editor-card>#officeNativeViewport{grid-row:5!important}
.office-editor-card>.office-editor-actions{grid-row:6!important}
.office-editor-card>#officeVisualOptions{grid-row:auto!important}
.office-editor-card>#officeVisualOptions:not(.hidden){
  position:absolute!important;
  z-index:104!important;
  top:var(--office-options-top,102px)!important;
  left:var(--office-options-left,12px)!important;
  right:auto!important;
  width:var(--office-options-width,300px)!important;
  height:auto!important;
  min-height:36px!important;
  max-height:none!important;
  overflow:visible!important;
  padding:5px 7px!important;
  flex-wrap:wrap!important;
  border:1px solid #cfdbea!important;
  border-radius:10px!important;
  background:#fff!important;
  box-shadow:0 10px 25px rgba(15,23,42,.16)!important;
}
.office-editor-card>#officeVisualOptions:not(.hidden)::before{
  content:"";position:absolute;top:-6px;left:50%;width:10px;height:10px;
  transform:translateX(-50%) rotate(45deg);background:#fff;border-left:1px solid #cfdbea;border-top:1px solid #cfdbea;
}
.office-visual-options label.hidden,.office-visual-options button.hidden{display:none!important}
.office-visual-options small{flex:1 1 100%!important;margin-left:0!important;line-height:1.25!important}
@media(max-width:900px){
  .office-editor-card{grid-template-rows:48px 48px 34px 29px minmax(0,1fr) 46px!important}
  .office-editor-card>#officeVisualOptions:not(.hidden){max-width:calc(100% - 16px)!important;min-height:34px!important}
}

/* V60 · editor Office compacto + zoom manual */
/* El encabezado informativo ya no ocupa espacio: la primera fila es la barra de herramientas. */
.office-editor-head-accessible{display:none!important}
.office-editor-card{
  grid-template-rows:60px 34px 29px minmax(0,1fr) 50px!important;
}
.office-editor-card>.office-editor-head{display:none!important;grid-row:auto!important}
.office-editor-card>#officeEditorToolbar{grid-row:1!important;min-height:0!important}
.office-editor-card>.office-editor-nav{grid-row:2!important;min-height:0!important}
.office-editor-card>#officeEditLegend{grid-row:3!important;min-height:0!important}
.office-editor-card>#officeNativeViewport{grid-row:4!important;min-height:0!important}
.office-editor-card>.office-editor-actions{grid-row:5!important;min-height:0!important}
.office-editor-card>#officeVisualOptions{grid-row:auto!important}

/* Barra superior: solo herramientas y cierre, sin título ni texto descriptivo. */
.office-editor-toolbar{
  position:relative!important;
  min-height:60px!important;
  padding:6px 8px!important;
  flex-wrap:nowrap!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  gap:6px!important;
}
.office-editor-close-tool{
  position:sticky!important;
  right:0!important;
  z-index:130!important;
  flex:0 0 40px!important;
  width:40px!important;
  min-width:40px!important;
  height:40px!important;
  margin-left:4px!important;
  border:1px solid #cfe0fb!important;
  border-radius:12px!important;
  background:#f4f8ff!important;
  color:#1260e7!important;
  box-shadow:-8px 0 12px rgba(255,255,255,.95)!important;
  font-size:25px!important;
  line-height:1!important;
}
.office-editor-close-tool:hover{background:#eaf2ff!important;border-color:#9ebcf2!important;color:#0b4dcc!important}

/* Botón lupa dentro de las herramientas. No cambia la herramienta activa de edición. */
.office-visual-quick-tools>button[data-office-action="zoom-toggle"]{color:#0b6b8f!important}
.office-visual-quick-tools>button[data-office-action="zoom-toggle"].active{
  color:#fff!important;
  border-color:#0b6b8f!important;
  background:linear-gradient(145deg,#1597c5,#0b6b8f)!important;
  box-shadow:0 6px 13px rgba(11,107,143,.22)!important;
}
.office-visual-quick-tools>button[data-office-action="zoom-toggle"].active .office-tool-glyph,
.office-visual-quick-tools>button[data-office-action="zoom-toggle"].active>span:not(.office-tool-glyph){color:#fff!important}

/* El popover contextual se posiciona por JS justo debajo del botón activo. */
.office-editor-card>#officeVisualOptions:not(.hidden){
  top:var(--office-options-top,62px)!important;
}

/* Zoom inferior derecho: -  deslizador  +  porcentaje. */
.office-editor-actions{align-items:center!important;gap:8px!important;padding:6px 10px!important}
.office-footer-zoom{
  margin-left:auto;
  height:36px;
  padding:3px 6px;
  display:flex;
  align-items:center;
  gap:5px;
  border:1px solid #d7e1ed;
  border-radius:10px;
  background:#f8fafc;
  box-shadow:0 1px 3px rgba(15,23,42,.05);
}
.office-footer-zoom>button{
  width:28px;
  height:28px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid #d5dfeb;
  border-radius:7px;
  background:#fff;
  color:#26364b;
  font-size:17px;
  font-weight:900;
  cursor:pointer;
}
.office-footer-zoom>button:hover:not(:disabled){border-color:#8fb3f5;background:#edf4ff;color:#155bdd}
.office-footer-zoom>button:disabled{opacity:.38;cursor:not-allowed}
.office-footer-zoom input[type="range"]{width:115px;accent-color:#2563eb;cursor:pointer}
.office-footer-zoom .office-zoom-level{
  width:48px;
  min-width:48px;
  font-size:9px;
  letter-spacing:-.02em;
}
.office-native-stage{transform-origin:top left!important}

@media(max-width:900px){
  .office-editor-card{grid-template-rows:56px 34px 29px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{min-height:56px!important;padding:4px 6px!important}
  .office-editor-close-tool{height:38px!important;width:38px!important;min-width:38px!important;flex-basis:38px!important}
  .office-footer-zoom input[type="range"]{width:76px}
  .office-footer-zoom .office-zoom-level{display:none}
  .office-save-shortcut{display:none!important}
}
@media(max-width:650px){
  .office-editor-actions{gap:5px!important;padding:5px 6px!important}
  .office-footer-zoom{padding:2px 4px;gap:3px}
  .office-footer-zoom input[type="range"]{width:58px}
  .office-editor-actions .modal-secondary,.office-editor-actions .modal-primary{min-width:92px!important;padding-left:8px!important;padding-right:8px!important}
}


/* V61: texto en la posición exacta + resaltado sin borde de selección persistente. */
.office-visual-inline-editor{overflow:visible!important}
.office-visual-inline-editor::before{content:"";position:absolute;left:10px;top:10px;width:2px;height:20px;border-radius:999px;background:#2563eb;opacity:.95;animation:officeTextCaretBlink .95s steps(1,end) infinite;pointer-events:none}
.office-visual-inline-editor.correction-mode::before{background:#0f6fe8}
.office-visual-inline-editor textarea{position:relative;z-index:1;padding-left:10px!important}
.office-visual-inline-editor small{position:relative;z-index:1}
@keyframes officeTextCaretBlink{0%,49%{opacity:.95}50%,100%{opacity:.18}}
.office-visual-overlay.tool-highlight{cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48cmVjdCB4PSI0IiB5PSIxMCIgd2lkdGg9IjIwIiBoZWlnaHQ9IjEyIiByeD0iMi41IiBmaWxsPSIjZmZkNDAwIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS4yIi8+PHJlY3QgeD0iNiIgeT0iMTIiIHdpZHRoPSIxNiIgaGVpZ2h0PSI0IiByeD0iMS41IiBmaWxsPSIjZmZmNGEzIi8+PHBhdGggZD0iTTI0IDEwbDQgMnY4bC00IDJ6IiBmaWxsPSIjNGI1NTYzIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS4xIi8+PHBhdGggZD0iTTQgMjJoMjB2NCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZWFiMzA4IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjwvc3ZnPg==") 4 24, crosshair!important;}
.annotation-canvas.tool-highlight{cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48cmVjdCB4PSI0IiB5PSIxMCIgd2lkdGg9IjIwIiBoZWlnaHQ9IjEyIiByeD0iMi41IiBmaWxsPSIjZmZkNDAwIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS4yIi8+PHJlY3QgeD0iNiIgeT0iMTIiIHdpZHRoPSIxNiIgaGVpZ2h0PSI0IiByeD0iMS41IiBmaWxsPSIjZmZmNGEzIi8+PHBhdGggZD0iTTI0IDEwbDQgMnY4bC00IDJ6IiBmaWxsPSIjNGI1NTYzIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS4xIi8+PHBhdGggZD0iTTQgMjJoMjB2NCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZWFiMzA4IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjwvc3ZnPg==") 4 24, crosshair!important;}


/* V62 · Autoformas visuales, paletas de color y herramientas más legibles */
.office-editor-card{grid-template-rows:70px 34px 29px minmax(0,1fr) 50px!important}
.office-editor-toolbar{min-height:70px!important;padding:7px 8px!important;gap:7px!important}
.office-editor-toolbar>button{width:38px!important;height:38px!important;min-width:38px!important;border-radius:9px!important;font-size:15px!important}
.office-editor-toolbar>label,
.office-toolbar-color-control{height:38px!important;min-height:38px!important;padding:0 8px!important;display:flex!important;align-items:center!important;gap:6px!important;border:1px solid #d7e1ed!important;border-radius:9px!important;background:#fff!important;color:#53647a!important;font-size:10px!important;font-weight:850!important;box-sizing:border-box!important;flex:0 0 auto!important}
.office-editor-toolbar input[type="number"]{width:48px!important;font-size:10px!important}
.office-toolbar-color-control>span{white-space:nowrap}
.office-native-color-input{display:none!important}
.office-color-picker-btn{height:28px;min-width:54px;padding:3px 7px;display:flex;align-items:center;gap:6px;border:1px solid #d7e1ed;border-radius:7px;background:#fff;color:#334155;font-size:9px;font-weight:900;cursor:pointer}
.office-color-picker-btn:hover{border-color:#8fb3f5;background:#f4f8ff}
.office-color-preview{width:21px;height:18px;border:1px solid rgba(15,23,42,.35);border-radius:3px;background:var(--office-color,#111827);box-shadow:inset 0 0 0 1px rgba(255,255,255,.25)}
.office-color-picker-btn b{font-size:8.5px}

.office-visual-quick-tools{gap:7px!important;padding:2px 2px!important}
.office-visual-quick-tools>button{flex:0 0 72px!important;width:72px!important;min-width:72px!important;height:52px!important;min-height:52px!important;padding:5px!important;border-radius:10px!important;gap:4px!important}
.office-visual-quick-tools .office-tool-glyph{width:25px!important;height:23px!important;font-size:21px!important}
.office-visual-quick-tools>button>span:not(.office-tool-glyph){font-size:9px!important;line-height:1.08!important;overflow:visible!important;text-overflow:clip!important}
.office-editor-close-tool{height:44px!important;width:44px!important;min-width:44px!important;flex-basis:44px!important;font-size:26px!important}

/* Popover de paleta: evita el selector nativo grande del navegador. */
.office-color-palette-popover{position:absolute;z-index:180;box-sizing:border-box;padding:9px;border:1px solid #cbd7e5;border-radius:12px;background:#fff;box-shadow:0 16px 38px rgba(15,23,42,.22)}
.office-color-palette-popover.hidden{display:none!important}
.office-palette-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;color:#27374d;font-size:11px}
.office-palette-head>button{width:26px;height:26px;border:1px solid #d7e1ed;border-radius:7px;background:#fff;color:#64748b;font-size:17px;cursor:pointer}
.office-palette-grid{display:grid;grid-template-columns:repeat(10,1fr);gap:6px}
.office-palette-swatch{width:24px;height:24px;padding:2px;border:1px solid #ccd6e2;border-radius:6px;background:#fff;cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.06)}
.office-palette-swatch>span{display:block;width:100%;height:100%;border-radius:4px;background:var(--palette-color);border:1px solid rgba(15,23,42,.12)}
.office-palette-swatch:hover,.office-palette-swatch.active{border-color:#2563eb;box-shadow:0 0 0 2px rgba(37,99,235,.14)}

/* Opciones contextuales de formas. */
.office-option-color{min-height:34px;padding:3px 7px;display:flex;align-items:center;gap:6px;border:1px solid #d8e2ed;border-radius:8px;background:#fff;color:#5b6a80;font-size:9.5px;font-weight:850}
.office-option-color.hidden{display:none!important}
.office-visual-options label{font-size:9.5px!important;min-height:34px!important;padding:4px 8px!important}
.office-visual-options small{font-size:9px!important}
.office-editor-card>#officeVisualOptions:not(.hidden){padding:7px 8px!important;gap:7px!important;max-width:calc(100% - 16px)!important}
.office-shape-gallery{flex:1 1 100%;display:grid;grid-template-columns:repeat(11,minmax(48px,1fr));gap:6px;padding:7px;border:1px solid #d9e3ee;border-radius:10px;background:#f8fafc}
.office-shape-gallery.hidden{display:none!important}
.office-shape-gallery>button{min-width:50px;height:54px;padding:4px 3px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1px solid #d5dfeb;border-radius:9px;background:#fff;color:#334155;cursor:pointer;box-shadow:0 1px 3px rgba(15,23,42,.04)}
.office-shape-gallery>button>span{font-size:23px;line-height:1}
.office-shape-gallery>button>small{font-size:7.5px!important;font-weight:850;color:#607086;line-height:1;text-align:center;white-space:nowrap}
.office-shape-gallery>button:hover{border-color:#8fb3f5;background:#f1f6ff;color:#155bdd}
.office-shape-gallery>button.active{border-color:#2563eb;background:#eaf2ff;color:#155bdd;box-shadow:0 0 0 2px rgba(37,99,235,.12)}
.office-shape-fill-toggle{white-space:nowrap}
.office-shape-fill-toggle input{margin:0}
.office-shape-action{height:34px;padding:0 10px;border:1px solid #bdd1ee;border-radius:8px;background:#f4f8ff;color:#155bdd;font-size:9.5px;font-weight:900;cursor:pointer}
.office-shape-action.subtle{border-color:#d7e1ed;background:#fff;color:#64748b}
.office-shape-action:hover:not(:disabled){background:#eaf2ff}
.office-shape-action:disabled{opacity:.42;cursor:not-allowed}
#officeShapeOpacity{width:86px}
#officeShapeOpacityValue{min-width:30px;text-align:right}

/* En Formas el popover es más ancho y muestra realmente que hay una galería. */
.office-editor-card>#officeVisualOptions:not(.hidden):has(#officeShapeGallery:not(.hidden)){width:min(760px,calc(100% - 16px))!important}

@media(max-width:1100px){
  .office-editor-card{grid-template-rows:66px 34px 29px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{min-height:66px!important}
  .office-visual-quick-tools>button{flex-basis:68px!important;width:68px!important;min-width:68px!important;height:50px!important;min-height:50px!important}
  .office-visual-quick-tools>button>span:not(.office-tool-glyph){font-size:8.5px!important}
  .office-shape-gallery{grid-template-columns:repeat(6,minmax(48px,1fr))}
}
@media(max-width:700px){
  .office-palette-grid{grid-template-columns:repeat(6,1fr)}
  .office-shape-gallery{grid-template-columns:repeat(4,minmax(48px,1fr))}
}


/* V63 · Herramientas fluidas y hover profesional.
   Una herramienta activa conserva su aspecto al pasar el mouse: nunca vuelve
   a blanco mientras sigue activa. Pulsarla otra vez vuelve a Contenido. */
.office-visual-quick-tools>button.active:hover:not(:disabled),
.office-visual-quick-tools>button.active:focus-visible:not(:disabled){
  transform:translateY(-1px)!important;
  color:#fff!important;
  border-color:#155bdd!important;
  background:linear-gradient(145deg,#2b78e9,#155bdd)!important;
  box-shadow:0 7px 15px rgba(21,91,221,.24)!important;
}
.office-visual-quick-tools>button.active:hover:not(:disabled) .office-tool-glyph,
.office-visual-quick-tools>button.active:hover:not(:disabled)>span:not(.office-tool-glyph),
.office-visual-quick-tools>button.active:focus-visible:not(:disabled) .office-tool-glyph,
.office-visual-quick-tools>button.active:focus-visible:not(:disabled)>span:not(.office-tool-glyph){
  color:#fff!important;
}

/* Resaltar usa un estado activo propio, coherente con el color de un marcador. */
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active,
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active:hover:not(:disabled),
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active:focus-visible:not(:disabled){
  color:#3f3000!important;
  border-color:#e5a900!important;
  background:linear-gradient(145deg,#ffd84d,#f4bd18)!important;
  box-shadow:0 7px 15px rgba(229,169,0,.24)!important;
}
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active .office-tool-glyph,
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active>span:not(.office-tool-glyph),
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active:hover .office-tool-glyph,
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active:hover>span:not(.office-tool-glyph){
  color:#3f3000!important;
}

/* El modo Contenido mantiene una señal visual clara cuando las herramientas
   están apagadas, para dejar evidente que el documento vuelve a ser editable. */
.office-visual-quick-tools .office-toolbar-mode-btn.active,
.office-visual-quick-tools .office-toolbar-mode-btn.active:hover:not(:disabled),
.office-visual-quick-tools .office-toolbar-mode-btn.active:focus-visible:not(:disabled){
  color:#fff!important;
  border-color:#155bdd!important;
  background:linear-gradient(145deg,#2b78e9,#155bdd)!important;
  box-shadow:0 6px 13px rgba(21,91,221,.20)!important;
}


/* ==================================================================
   V64 · Dos filas sin scroll + paleta inmediata + texto exacto
   ================================================================== */
/* Se eliminan del editor las filas informativas que ocupaban espacio. */
.office-editor-nav,
#officeEditLegend{display:none!important}

/* La tarjeta usa ese espacio para una barra real de dos alturas. */
.office-editor-card{
  grid-template-rows:118px minmax(0,1fr) 50px!important;
}
.office-editor-card>#officeEditorToolbar{grid-row:1!important}
.office-editor-card>#officeNativeViewport{grid-row:2!important}
.office-editor-card>.office-editor-actions{grid-row:3!important}
.office-editor-toolbar{
  height:118px!important;
  min-height:118px!important;
  max-height:118px!important;
  padding:6px 8px!important;
  overflow:visible!important;
  flex-wrap:nowrap!important;
  align-items:flex-start!important;
  gap:7px!important;
  background:#fff!important;
}
/* Las herramientas visuales quedan siempre a la vista en 2 filas, sin barra horizontal. */
.office-visual-quick-tools{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  height:110px!important;
  min-height:110px!important;
  display:grid!important;
  grid-template-columns:repeat(8,72px)!important;
  grid-template-rows:repeat(2,52px)!important;
  grid-auto-flow:row!important;
  gap:6px!important;
  padding:0!important;
  overflow:visible!important;
  scrollbar-width:none!important;
}
.office-visual-quick-tools::-webkit-scrollbar{display:none!important}
.office-visual-quick-tools>button{
  width:72px!important;min-width:72px!important;max-width:72px!important;
  height:52px!important;min-height:52px!important;
  margin:0!important;
}
.office-editor-close-tool{
  position:relative!important;right:auto!important;top:auto!important;
  flex:0 0 44px!important;margin-left:auto!important;
  box-shadow:none!important;
}
/* El texto/hint contextual ya no ocupa un panel. */
#officeVisualHint{display:none!important}

/* Solo Formas/Dibujar/Recortar usan un panel contextual; es compacto y sin texto sobrante. */
.office-editor-card>#officeVisualOptions:not(.hidden){
  z-index:150!important;
  max-height:min(360px,45vh)!important;
  overflow:auto!important;
}

/* Paleta automática: aparece con un solo clic en Resaltar/Dibujar/Texto/Corregir. */
.office-color-palette-popover.office-tool-auto-palette{
  width:340px!important;
  padding:8px!important;
  border-color:#b9cce8!important;
  box-shadow:0 14px 34px rgba(15,23,42,.20)!important;
}
.office-color-palette-popover.office-tool-auto-palette .office-palette-head{
  margin-bottom:6px!important;
}
.office-color-palette-popover.office-tool-auto-palette .office-palette-grid{
  grid-template-columns:repeat(10,1fr)!important;
  gap:5px!important;
}
.office-color-palette-popover.office-tool-auto-palette .office-palette-swatch{
  width:25px!important;height:25px!important;
}

/* Texto visual: el propio campo nace exactamente donde se hizo clic. */
.office-visual-inline-editor{
  padding:0!important;
  border:0!important;
  border-radius:4px!important;
  background:transparent!important;
  box-shadow:none!important;
  min-width:0!important;
  max-width:none!important;
  transform:none!important;
  overflow:visible!important;
}
.office-visual-inline-editor::before{display:none!important}
.office-visual-inline-editor textarea{
  display:block!important;
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  min-height:28px!important;
  height:28px;
  margin:0!important;
  padding:2px 4px!important;
  border:1.5px dashed #2563eb!important;
  border-radius:4px!important;
  background:rgba(255,255,255,.82)!important;
  box-shadow:0 0 0 2px rgba(37,99,235,.08)!important;
  line-height:1.2!important;
  resize:none!important;
  overflow:hidden!important;
  caret-color:#155bdd!important;
}
.office-visual-inline-editor textarea:focus{
  border-style:solid!important;
  background:rgba(255,255,255,.94)!important;
  box-shadow:0 0 0 2px rgba(37,99,235,.16)!important;
}
.office-visual-inline-editor small{display:none!important}

@media(max-width:1350px){
  .office-editor-toolbar{gap:5px!important}
  .office-editor-toolbar>label,.office-toolbar-color-control{padding-left:5px!important;padding-right:5px!important}
  .office-visual-quick-tools{grid-template-columns:repeat(8,66px)!important}
  .office-visual-quick-tools>button{width:66px!important;min-width:66px!important;max-width:66px!important}
}
@media(max-width:1100px){
  .office-editor-card{grid-template-rows:114px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{height:114px!important;min-height:114px!important;max-height:114px!important;padding:4px 5px!important}
  .office-visual-quick-tools{height:106px!important;min-height:106px!important;grid-template-columns:repeat(7,62px)!important;grid-template-rows:repeat(3,32px)!important;gap:4px!important}
  .office-visual-quick-tools>button{width:62px!important;min-width:62px!important;max-width:62px!important;height:32px!important;min-height:32px!important;flex-direction:row!important;gap:3px!important;padding:2px 4px!important}
  .office-visual-quick-tools .office-tool-glyph{width:17px!important;height:17px!important;font-size:15px!important}
  .office-visual-quick-tools>button>span:not(.office-tool-glyph){font-size:7.5px!important}
}


/* V65 · Resaltador con flecha desplegable y texto más preciso */
.office-visual-quick-tools>button{position:relative!important;padding-right:16px!important}
.office-visual-quick-tools>button.has-color-dropdown .office-tool-drop-icon{position:absolute;right:4px;bottom:3px;font-size:10px;line-height:1;color:#7a8aa3;pointer-events:none}
.office-visual-quick-tools>button.has-color-dropdown.active .office-tool-drop-icon{color:inherit}
.office-visual-quick-tools>button.has-color-dropdown::after{content:"";position:absolute;top:6px;bottom:6px;right:16px;width:1px;background:rgba(148,163,184,.32)}
.office-visual-quick-tools>button[data-office-visual-tool="highlight"].active::after{background:rgba(63,48,0,.18)!important}
.office-visual-inline-editor{z-index:170!important}
.office-visual-inline-editor textarea{padding:1px 3px!important;min-height:24px!important;height:24px!important;line-height:1.15!important}
.office-visual-inline-editor textarea::placeholder{color:#64748b!important;opacity:.95}


/* V66 · precisión de texto, resaltador, autoformas desplegables y redimensionado */
.office-visual-overlay.tool-highlight{cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48Zz48cGF0aCBkPSJNMTEgM2gxNWEzIDMgMCAwIDEgMyAzdjEwSDExeiIgZmlsbD0iI2ZmZDQwMCIgc3Ryb2tlPSIjMjYzNjRiIiBzdHJva2Utd2lkdGg9IjEuMyIvPjxwYXRoIGQ9Ik0xMSAxNmgxOGwtOSA5SDh6IiBmaWxsPSIjZmZlNzZhIiBzdHJva2U9IiMyNjM2NGIiIHN0cm9rZS13aWR0aD0iMS4yIi8+PHBhdGggZD0iTTggMjVoMTJsLTUgNEg3eiIgZmlsbD0iI2ZmZDQwMCIgc3Ryb2tlPSIjMjYzNjRiIiBzdHJva2Utd2lkdGg9IjEiLz48Y2lyY2xlIGN4PSI2IiBjeT0iMjkiIHI9IjIuNCIgZmlsbD0iI2ZmZiIgc3Ryb2tlPSIjMTExODI3IiBzdHJva2Utd2lkdGg9IjEuNCIvPjxwYXRoIGQ9Ik0yIDI5aDhNNiAyNXY3IiBzdHJva2U9IiMxMTE4MjciIHN0cm9rZS13aWR0aD0iMSIvPjwvZz48L3N2Zz4=") 6 29, crosshair!important;}
.office-visual-quick-tools>button[data-office-visual-tool="shape"].has-color-dropdown .office-tool-drop-icon{color:#7c3aed!important}
.office-visual-quick-tools>button[data-office-visual-tool="shape"].active .office-tool-drop-icon{color:inherit!important}
.office-shape-gallery{position:relative!important;flex:1 1 100%!important}
.office-visual-overlay.tool-select{cursor:default!important}
.office-visual-inline-editor textarea{padding:0 2px!important;line-height:1!important;}


/* V67 · Tamaño de fuente preciso con selección persistente y presets */
.office-font-size-control{
  position:relative; height:38px; min-height:38px; padding:0 7px;
  display:flex; align-items:center; gap:6px; flex:0 0 auto;
  border:1px solid #d7e1ed; border-radius:9px; background:#fff;
  color:#53647a; font-size:10px; font-weight:850; box-sizing:border-box;
}
.office-font-size-combo{position:relative;display:flex;align-items:center;height:28px;border:1px solid #d7e1ed;border-radius:7px;background:#fff;overflow:visible}
.office-font-size-combo input[type="number"]{
  width:45px!important;height:26px!important;padding:0 4px!important;border:0!important;outline:0!important;
  background:transparent!important;color:#172033!important;font-size:11px!important;font-weight:900!important;text-align:center!important;
  appearance:textfield;-moz-appearance:textfield;
}
.office-font-size-combo input[type="number"]::-webkit-inner-spin-button,
.office-font-size-combo input[type="number"]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.office-font-size-combo>button{
  width:25px;height:26px;padding:0;border:0;border-left:1px solid #d7e1ed;border-radius:0 6px 6px 0;
  background:#f8fafc;color:#526176;font-size:11px;font-weight:900;cursor:pointer;
}
.office-font-size-combo>button:hover{background:#edf4ff;color:#155bdd}
.office-font-size-menu{
  position:absolute;z-index:260;top:34px;right:0;width:178px;padding:7px;
  display:grid;grid-template-columns:repeat(4,1fr);gap:5px;
  border:1px solid #cbd7e5;border-radius:10px;background:#fff;box-shadow:0 14px 34px rgba(15,23,42,.20);
}
.office-font-size-menu.hidden{display:none!important}
.office-font-size-menu button{
  height:30px;padding:0;border:1px solid #d8e2ed;border-radius:7px;background:#fff;color:#334155;
  font-size:10px;font-weight:900;cursor:pointer;
}
.office-font-size-menu button:hover,.office-font-size-menu button.active{border-color:#2563eb;background:#eaf2ff;color:#155bdd;box-shadow:0 0 0 1px rgba(37,99,235,.08)}


/* V68 · Coherencia multiformato: preview/imágenes con los mismos patrones de interacción */
.preview-edit-toolbar>button.has-preview-dropdown{position:relative!important;padding-right:15px!important}
.preview-edit-toolbar>button.has-preview-dropdown .preview-tool-drop-icon{position:absolute;right:4px;bottom:4px;font-style:normal;font-size:9px;line-height:1;color:#718198;pointer-events:none}
.preview-edit-toolbar>button.has-preview-dropdown.active .preview-tool-drop-icon{color:inherit}
.preview-edit-toolbar>button.has-preview-dropdown::after{content:"";position:absolute;right:15px;top:7px;bottom:7px;width:1px;background:rgba(148,163,184,.35)}
.preview-color-grid{display:grid!important;grid-template-columns:auto repeat(10,24px)!important;align-items:center!important;gap:5px!important;max-width:330px!important}
.preview-color-grid>span{grid-row:1 / span 3;align-self:start;padding-top:6px}
.preview-color-grid .color-swatch{width:24px!important;height:24px!important;min-width:24px!important;min-height:24px!important;margin:0!important}
.preview-color-grid #customEditColor{width:24px!important;height:24px!important;min-width:24px!important;padding:1px!important}


/* V69 · Fuente fiable en selección, edición por doble clic y publicidad lateral */
.office-editor-card{
  grid-template-columns:minmax(0,1fr) 230px!important;
  grid-template-rows:118px minmax(0,1fr) 50px!important;
}
.office-editor-card>#officeEditorToolbar{grid-column:1 / -1!important;grid-row:1!important}
.office-editor-card>#officeNativeViewport{grid-column:1!important;grid-row:2!important}
.office-editor-card>.office-editor-ad-region{grid-column:2!important;grid-row:2!important}
.office-editor-card>.office-editor-actions{grid-column:1 / -1!important;grid-row:3!important}
.office-editor-ad-region{
  position:relative!important;display:flex;flex-direction:column;min-width:0;min-height:0;
  padding:34px 10px 10px!important;border-left:1px solid #dbe4ef;background:#f8fafc;box-sizing:border-box;
}
.office-editor-ad-region.ad-inactive{display:none!important}
.office-ad-heading{
  position:absolute;top:10px;left:0;right:0;text-align:center;color:#7b8799;
  font-size:9px;font-weight:900;letter-spacing:.12em;text-transform:uppercase;
}
.office-editor-ad-region .adsense-slot{width:100%;min-height:250px;flex:0 1 600px;border-radius:10px;background:#fff}
.office-editor-ad-region .ad-placeholder{font-size:9px;line-height:1.35;color:#94a3b8}

.office-visual-inline-editor.editing-existing{z-index:210!important}
.office-visual-inline-editor.editing-existing .office-inline-format-bar{
  position:absolute;left:0;bottom:calc(100% + 5px);z-index:3;display:flex;align-items:flex-end;gap:6px;
  min-width:360px;padding:6px;border:1px solid #cbd7e5;border-radius:9px;background:#fff;
  box-shadow:0 10px 25px rgba(15,23,42,.18);box-sizing:border-box;
}
.office-inline-format-bar label{display:flex;flex-direction:column;gap:2px;color:#64748b;font-size:7.5px;font-weight:900}
.office-inline-format-bar select,.office-inline-format-bar input[type="number"]{
  height:27px;border:1px solid #d4deea;border-radius:6px;background:#fff;color:#1f2937;font-size:10px;padding:3px 5px;box-sizing:border-box;
}
.office-inline-format-bar select{width:120px}.office-inline-format-bar input[type="number"]{width:58px}
.office-inline-colors{display:flex;align-items:center;gap:3px;height:27px}
.office-inline-colors button{width:21px;height:21px;padding:2px;border:1px solid #ccd6e2;border-radius:5px;background:#fff;cursor:pointer}
.office-inline-colors button::before{content:"";display:block;width:100%;height:100%;border-radius:3px;background:var(--inline-color)}
.office-inline-colors button:hover,.office-inline-colors button.active{border-color:#2563eb;box-shadow:0 0 0 2px rgba(37,99,235,.14)}

@media(max-width:1250px){
  .office-editor-card{grid-template-columns:minmax(0,1fr) 180px!important}
}
@media(max-width:900px){
  .office-editor-card{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:114px minmax(0,1fr) 48px!important}
  .office-editor-card>#officeNativeViewport{grid-column:1!important}
  .office-editor-card>.office-editor-ad-region{display:none!important}
  .office-editor-card>.office-editor-actions{grid-column:1!important}
  .office-visual-inline-editor.editing-existing .office-inline-format-bar{min-width:300px;max-width:90vw;flex-wrap:wrap}
}


/* V70 · Edición de texto fluida + listas numeradas y viñetas */
.office-visual-quick-tools{
  grid-template-columns:repeat(9,72px)!important;
}
.office-visual-overlay.tool-numbered-list,
.office-visual-overlay.tool-bullet-list{cursor:text!important}
.office-visual-quick-tools>button[data-office-visual-tool="numbered-list"] .office-tool-glyph,
.office-visual-quick-tools>button[data-office-visual-tool="bullet-list"] .office-tool-glyph{
  font-size:17px!important;font-weight:900!important;
}
.office-list-style-popover{
  position:absolute;z-index:205;box-sizing:border-box;padding:9px;border:1px solid #cbd7e5;border-radius:12px;
  background:#fff;box-shadow:0 16px 38px rgba(15,23,42,.22)
}
.office-list-style-popover.hidden{display:none!important}
.office-list-style-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;color:#27374d;font-size:11px}
.office-list-style-head>button{width:26px;height:26px;border:1px solid #d7e1ed;border-radius:7px;background:#fff;color:#64748b;font-size:17px;cursor:pointer}
.office-list-style-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.office-list-style-option{min-height:48px;padding:6px 8px;display:flex;align-items:center;gap:9px;border:1px solid #d7e1ed;border-radius:9px;background:#fff;color:#334155;cursor:pointer;text-align:left}
.office-list-style-option:hover{border-color:#8fb3f5;background:#f4f8ff}
.office-list-style-option.active{border-color:#2563eb;background:#eaf2ff;box-shadow:0 0 0 2px rgba(37,99,235,.10)}
.office-list-style-option b{min-width:34px;color:#155bdd;font-size:16px;text-align:center}
.office-list-style-option span{font-size:9px;font-weight:850}
.office-visual-inline-editor textarea{
  overflow:hidden!important;white-space:pre!important;word-break:normal!important;overflow-wrap:normal!important;
  resize:none!important;box-sizing:border-box!important;
}
.office-visual-inline-editor:not(.editing-existing){min-width:0!important;max-width:none!important}
.office-visual-inline-editor.editing-existing textarea{white-space:pre!important}
@media(max-width:1350px){
  .office-visual-quick-tools{grid-template-columns:repeat(9,64px)!important}
  .office-visual-quick-tools>button{width:64px!important;min-width:64px!important;max-width:64px!important}
}
@media(max-width:1100px){
  .office-visual-quick-tools{grid-template-columns:repeat(9,58px)!important;grid-template-rows:repeat(2,48px)!important;height:102px!important;min-height:102px!important}
  .office-visual-quick-tools>button{width:58px!important;min-width:58px!important;max-width:58px!important;height:48px!important;min-height:48px!important;flex-direction:column!important}
  .office-list-style-grid{grid-template-columns:1fr}
}


/* V70 · Listas también en edición visual (PDF/imágenes). */
.preview-tools-panel{position:relative!important}
.preview-list-style-popover{position:absolute;z-index:210;padding:8px;border:1px solid #cbd7e5;border-radius:10px;background:#fff;box-shadow:0 12px 30px rgba(15,23,42,.20)}
.preview-list-style-popover.hidden{display:none!important}
.preview-list-style-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;color:#334155;font-size:10px;font-weight:900}
.preview-list-style-head>button{width:25px;height:25px;border:1px solid #d7e1ed;border-radius:7px;background:#fff;color:#64748b;font-size:16px}
.preview-list-style-grid{display:grid;grid-template-columns:1fr;gap:5px}
.preview-list-style-option{min-height:38px;padding:5px 7px;display:flex;align-items:center;gap:8px;border:1px solid #d7e1ed;border-radius:8px;background:#fff;color:#334155;text-align:left}
.preview-list-style-option.active,.preview-list-style-option:hover{border-color:#2563eb;background:#edf4ff}
.preview-list-style-option b{min-width:28px;color:#155bdd;font-size:14px;text-align:center}.preview-list-style-option span{font-size:8px;font-weight:850}
.inline-text-editor textarea{white-space:pre!important;overflow:hidden!important;overflow-wrap:normal!important;word-break:normal!important;resize:none!important}


/* V71 · listas visibles completas, rango de numeración y documentos compactos */
.office-visual-inline-editor textarea,
.inline-text-editor textarea{
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
/* El alto se controla desde JS según todas las líneas; evitamos que un estilo antiguo lo limite. */
.office-visual-inline-editor textarea{max-height:none!important}
.inline-text-editor textarea{max-height:none!important}

.number-pages-card{width:min(560px,calc(100vw - 28px))!important}
.number-pages-help{margin:0 0 10px;color:#64748b;font-size:10px;line-height:1.35}
.number-pages-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
.number-pages-grid>label{min-width:0}
.number-pages-range-summary{margin:10px 0;padding:8px 10px;border:1px solid #cfe0fb;border-radius:9px;background:#f4f8ff;color:#155bdd;font-size:9.5px;font-weight:850}

/* Documentos cargados: más pequeño, horizontal y visual. */
.documents-card{
  width:min(640px,calc(100vw - 24px))!important;
  max-height:min(78vh,560px)!important;
  padding:13px!important;
  border-radius:16px!important;
}
.documents-card>header{margin-bottom:5px!important;align-items:center!important}
.documents-card h2{font-size:18px!important}
.documents-card .modal-kicker{font-size:8px!important}
.documents-summary{margin-bottom:8px!important;gap:6px!important}
.documents-summary>span{padding:4px 7px!important;font-size:8.5px!important}
.documents-summary>span b{font-size:10px!important}
.documents-summary>button{padding:7px 9px!important;font-size:9px!important}
.documents-list{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  align-items:start!important;
  gap:7px!important;
  max-height:48vh!important;
  overflow:auto!important;
  margin:0!important;
  padding:1px!important;
}
.documents-list .source-chip{
  flex:none!important;
  width:auto!important;
  max-width:none!important;
  min-width:0!important;
  min-height:52px!important;
  height:52px!important;
  padding:5px 7px!important;
  gap:7px!important;
  border-radius:10px!important;
  box-shadow:0 3px 9px rgba(15,23,42,.04)!important;
}
.documents-list .source-type{min-width:38px!important;height:28px!important;line-height:28px!important;padding:0 5px!important;font-size:8px!important}
.documents-list .source-name{font-size:9px!important}
.documents-list .source-count{font-size:7.5px!important}
.documents-list .source-icon-btn{width:24px!important;height:24px!important;flex:0 0 24px!important}
@media(max-width:720px){
  .documents-card{width:min(520px,calc(100vw - 18px))!important}
  .documents-list{grid-template-columns:1fr!important}
  .number-pages-grid{grid-template-columns:1fr!important}
}


/* ==================================================================
   V72 · Anuncio lateral derecho + cabecera despejada
   ================================================================== */
/* El botón de donación deja la barra superior. Su acceso se conserva de forma
   discreta en el pie, para no competir con Guardado, Buscar y Descargar. */
.editor-primary-actions .top-donation-btn{display:none!important}
.footer-support-btn{
  display:inline-flex!important;align-items:center!important;gap:5px!important;
  padding:0!important;border:0!important;background:transparent!important;
  color:#d94a5e!important;font:inherit!important;font-size:inherit!important;
  font-weight:800!important;cursor:pointer!important;box-shadow:none!important
}
.footer-support-btn span{font-size:12px!important;line-height:1!important}
.footer-support-btn b{font:inherit!important;font-weight:800!important}
.footer-support-btn:hover{color:#b9253d!important;text-decoration:underline!important;transform:none!important}

/* Área principal: páginas a la izquierda y un único espacio publicitario
   vertical a la derecha. Ya no existe el anuncio horizontal al final. */
.pages-workspace{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 320px!important;
  grid-template-areas:
    "heading ad"
    "recovery ad"
    "empty ad"
    "pages ad"!important;
  column-gap:20px!important;
  align-content:start!important;
  align-items:start!important;
}
.pages-workspace>.pages-heading{grid-area:heading!important;min-width:0!important}
.pages-workspace>#sessionRecoveryBanner{grid-area:recovery!important;min-width:0!important}
.pages-workspace>#emptyEditorState{grid-area:empty!important;min-width:0!important}
.pages-workspace>#pagesStream{grid-area:pages!important;min-width:0!important}
.main-ad-region{
  grid-area:ad!important;
  position:sticky!important;
  top:16px!important;
  width:320px!important;
  min-width:320px!important;
  max-width:320px!important;
  min-height:640px!important;
  margin:0!important;
  padding:34px 10px 10px!important;
  align-self:start!important;
  border:1px solid #dfe6ef!important;
  border-radius:13px!important;
  background:#fff!important;
  box-shadow:0 6px 18px rgba(15,23,42,.045)!important;
}
.main-ad-region .ad-label{
  top:11px!important;left:50%!important;transform:translateX(-50%)!important;
  color:#8290a5!important;font-size:9px!important;font-weight:900!important;
  letter-spacing:.14em!important
}
.main-ad-region .adsense-slot{
  width:300px!important;
  min-height:600px!important;
  margin:0 auto!important;
  border-radius:10px!important;
  background:#fbfcfe!important
}
.main-ad-region .ad-placeholder{font-size:9px!important;color:#94a3b8!important}

/* Si el ancho disponible ya no permite una columna publicitaria cómoda,
   se oculta antes de comprimir o deformar el área de trabajo. */
@media(max-width:1180px){
  .pages-workspace{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-areas:"heading" "recovery" "empty" "pages"!important;
  }
  .main-ad-region{display:none!important}
}


/* ==================================================================
   V73 · Pantalla principal limpia: solo herramientas globales
   ================================================================== */
/* Las herramientas que requieren señalar contenido dentro de una hoja viven
   exclusivamente dentro del editor de la página. Se conservan en el DOM para
   compatibilidad interna, pero no ocupan espacio en la pantalla principal. */
.commandbar>.edit-command,
.commandbar>.insert-command{
  display:none!important;
}

/* La barra principal queda reservada a: Archivo, Páginas, Extraer,
   Documento, Peso y Seguridad. Sin scroll horizontal en escritorio. */
.editor-toolbar{
  height:174px!important;
  min-height:174px!important;
}
.commandbar{
  width:min(1320px,100%)!important;
  height:174px!important;
  min-height:174px!important;
  box-sizing:border-box!important;
  padding:9px 12px 10px!important;
  display:grid!important;
  grid-template-columns:150px 240px 180px 270px 180px 170px!important;
  justify-content:center!important;
  align-items:stretch!important;
  gap:7px!important;
  overflow:visible!important;
  scrollbar-width:none!important;
}
.commandbar::-webkit-scrollbar{display:none!important}
.commandbar>.command-group{
  width:auto!important;
  min-width:0!important;
  height:153px!important;
  min-height:153px!important;
  padding:0 7px 7px!important;
  box-sizing:border-box!important;
  border:1px solid #e1e8f0!important;
  border-top:2px solid #d6e1ee!important;
  border-radius:11px!important;
  background:#fff!important;
  box-shadow:0 2px 8px rgba(15,23,42,.025)!important;
}
.commandbar>.file-command{border-top-color:#2780ff!important}
.commandbar>.page-command{border-top-color:#6d55ff!important}
.commandbar>.extract-command{border-top-color:#00a66a!important}
.commandbar>.document-command{border-top-color:#00a7ba!important}
.commandbar>.optimization-command{border-top-color:#2a7cff!important}
.commandbar>.security-command{border-top-color:#25a747!important}
.command-group>.toolbar-label{
  height:28px!important;
  min-height:28px!important;
  margin:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:9px!important;
}
.command-buttons,.extract-control,.optimization-panel{
  height:112px!important;
  min-height:112px!important;
}
.file-command .command-buttons,
.security-command .command-buttons{
  display:grid!important;
  grid-template-columns:1fr 1fr!important;
  gap:7px!important;
}
.page-command .command-buttons,
.document-command .command-buttons{
  display:grid!important;
  grid-template-columns:1fr 1fr!important;
  grid-template-rows:1fr 1fr!important;
  gap:7px!important;
}
.file-command .tool-tile,
.security-command .tool-tile,
.page-command .tool-tile,
.document-command .tool-tile{
  width:100%!important;
  min-width:0!important;
  height:100%!important;
  min-height:0!important;
}
.extract-command .extract-control{
  width:100%!important;
  box-sizing:border-box!important;
  justify-content:center!important;
}
.optimization-command .optimization-panel{
  width:100%!important;
  height:112px!important;
  min-height:112px!important;
  box-sizing:border-box!important;
}
.pages-workspace{
  min-height:calc(100vh - 254px)!important;
}

/* Donación: se mantiene con el texto completo, pero en una posición estable
   de la cabecera y sin cubrir el estado de guardado. */
.editor-primary-actions .top-donation-btn{
  display:inline-flex!important;
  flex:0 0 auto!important;
  width:190px!important;
  min-width:190px!important;
  max-width:190px!important;
  height:46px!important;
  min-height:46px!important;
  padding:0 12px!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  border:1px solid #ffc7cf!important;
  border-radius:11px!important;
  color:#d92e45!important;
  background:#fff5f6!important;
  box-shadow:0 3px 10px rgba(217,46,69,.055)!important;
  font-size:10px!important;
  font-weight:900!important;
  line-height:1.05!important;
  white-space:nowrap!important;
  cursor:pointer!important;
}
.editor-primary-actions .top-donation-btn span{font-size:15px!important;line-height:1!important}
.editor-primary-actions .top-donation-btn b{font:inherit!important;font-weight:900!important}
.editor-primary-actions .top-donation-btn:hover{
  color:#b91f37!important;
  border-color:#ff98a8!important;
  background:#ffecef!important;
  box-shadow:0 6px 15px rgba(217,46,69,.11)!important;
  transform:translateY(-1px)!important;
}
.footer-support-btn{display:none!important}

/* Ajustes progresivos sin ocultar el texto de donación. */
@media(max-width:1450px){
  .commandbar{
    width:min(1200px,100%)!important;
    grid-template-columns:140px 220px 165px 245px 165px 155px!important;
    gap:5px!important;
  }
  .editor-primary-actions{gap:7px!important}
  .editor-primary-actions .top-donation-btn{width:176px!important;min-width:176px!important;max-width:176px!important;font-size:9px!important;padding:0 8px!important}
  .live-search-control{min-width:300px!important;width:380px!important}
}
@media(max-width:1180px){
  .editor-toolbar{height:auto!important;min-height:0!important}
  .commandbar{
    height:auto!important;min-height:0!important;
    grid-template-columns:repeat(3,minmax(180px,1fr))!important;
    grid-auto-rows:153px!important;
    padding:8px!important;
  }
  .commandbar>.command-group{height:153px!important;min-height:153px!important}
  .pages-workspace{min-height:calc(100vh - 360px)!important}
}
@media(max-width:900px){
  .commandbar{grid-template-columns:repeat(2,minmax(160px,1fr))!important}
  .editor-primary-actions .top-donation-btn{width:100%!important;max-width:none!important;min-width:0!important;grid-column:1/-1!important}
}


/* ==================================================================
   V74 · Recuperación de sesión discreta en la cabecera
   ================================================================== */
.session-recovery-control{position:relative;display:flex;align-items:center;flex:0 0 auto}
.session-recovery-toggle{position:relative;width:34px;height:34px;min-width:34px;padding:0;display:grid;place-items:center;border:1px solid #d7e1ec;border-radius:10px;background:#fff;color:#53647a;font-size:18px;font-weight:900;cursor:pointer;box-shadow:0 2px 7px rgba(15,23,42,.04)}
.session-recovery-toggle:hover,.session-recovery-toggle[aria-expanded="true"]{border-color:#9bb9ef;background:#f4f8ff;color:#155bdd;box-shadow:0 5px 12px rgba(37,99,235,.10)}
.session-recovery-toggle>i{position:absolute;right:5px;top:5px;width:7px;height:7px;border:2px solid #fff;border-radius:50%;background:#f59e0b;box-shadow:0 0 0 1px rgba(245,158,11,.25)}
.session-recovery-toggle.hidden{display:none!important}
.session-recovery-popover{position:absolute;z-index:900;top:42px;left:50%;transform:translateX(-24%);width:290px;padding:11px;display:grid;gap:10px;border:1px solid #cbd8e8;border-radius:12px;background:#fff;box-shadow:0 16px 38px rgba(15,23,42,.20)}
.session-recovery-popover.hidden{display:none!important}
.session-recovery-popover::before{content:"";position:absolute;top:-6px;left:24%;width:10px;height:10px;border-left:1px solid #cbd8e8;border-top:1px solid #cbd8e8;background:#fff;transform:rotate(45deg)}
.session-recovery-copy{min-width:0;display:flex;flex-direction:column;gap:3px}
.session-recovery-copy b{color:#20334d;font-size:10px;font-weight:900}
.session-recovery-copy span{color:#6b7b90;font-size:8.5px;line-height:1.35}
.session-recovery-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.session-recovery-actions button{height:32px;padding:0 9px;border:1px solid #2563eb;border-radius:8px;background:#2563eb;color:#fff;font-size:8.5px;font-weight:900;cursor:pointer}
.session-recovery-actions button.secondary{border-color:#d7e1ec;background:#fff;color:#526176}
.session-recovery-actions button:hover{filter:brightness(.98)}
@media(max-width:1320px){.session-recovery-control{display:flex!important}.session-recovery-popover{left:auto;right:-70px;transform:none}.session-recovery-popover::before{left:auto;right:82px}}
@media(max-width:720px){.session-recovery-popover{position:fixed;top:64px;right:10px;left:10px;width:auto;transform:none}.session-recovery-popover::before{display:none}}


/* ==================================================================
   V75 · Buscador debajo de la barra de herramientas
   ================================================================== */
/* La cabecera queda para identidad, guardado, idioma, donación y acciones.
   El buscador pasa a una franja propia inmediatamente debajo de las herramientas. */
.editor-primary-actions .live-search-control{display:none!important}
.live-search-strip{
  position:relative;
  z-index:120;
  width:100%;
  box-sizing:border-box;
  padding:7px 18px 8px;
  border-bottom:1px solid #dfe7f0;
  background:#f8fafc;
}
.live-search-strip-inner{
  width:min(1320px,100%);
  margin:0 auto;
  display:flex;
  align-items:center;
  gap:10px;
}
.live-search-strip-label{
  flex:0 0 auto;
  color:#66788f;
  font-size:8.5px;
  font-weight:900;
  letter-spacing:.08em;
  white-space:nowrap;
}
.live-search-strip .live-search-control{
  width:min(650px,100%)!important;
  min-width:300px!important;
  height:40px!important;
  margin:0!important;
  flex:0 1 650px!important;
  grid-template-columns:18px minmax(140px,1fr) auto 28px 28px 28px!important;
  border-radius:10px!important;
  box-shadow:0 2px 7px rgba(15,23,42,.035)!important;
}
.live-search-strip .live-search-field>span{display:none!important}
.live-search-strip .live-search-control input{height:36px!important;font-size:11px!important}
.live-search-strip .live-search-status{font-size:8.5px!important}

/* Al liberar el buscador de la cabecera hay más espacio para el botón de donación. */
.editor-primary-actions{flex:1 1 auto!important;justify-content:flex-end!important}

/* Compensación del área de páginas por la nueva franja, sin crear un bloque grande. */
.pages-workspace{min-height:calc(100vh - 298px)!important}

@media(max-width:1180px){
  .live-search-strip{padding-left:10px;padding-right:10px}
  .live-search-strip-inner{width:100%}
  .live-search-strip .live-search-control{width:100%!important;max-width:none!important;flex:1 1 auto!important}
  .pages-workspace{min-height:calc(100vh - 404px)!important}
}
@media(max-width:760px){
  .live-search-strip-inner{align-items:stretch;gap:5px;flex-direction:column}
  .live-search-strip-label{padding-left:2px}
  .live-search-strip .live-search-control{min-width:0!important;width:100%!important;grid-template-columns:18px minmax(90px,1fr) 26px 26px 26px!important}
  .live-search-strip .live-search-status{display:none!important}
}


/* ==================================================================
   V76 · Herramientas globales: encabezado/pie, tamaño, grises, enderezar
   ================================================================== */
.commandbar{grid-template-columns:150px 230px 165px 330px 250px 165px!important;width:min(1320px,100%)!important}
.document-command .command-buttons{grid-template-columns:repeat(3,1fr)!important;grid-template-rows:repeat(2,1fr)!important;gap:6px!important}
.document-command .tool-tile{padding:4px 2px!important}
.document-command .tool-glyph{font-size:21px!important}
.document-command .tool-tile>span:last-child{font-size:7.6px!important}
.optimization-command{display:grid!important;grid-template-rows:28px 72px 40px!important}
.optimization-command>.toolbar-label{grid-row:1!important}
.optimization-command>.optimization-panel{grid-row:2!important;height:72px!important;min-height:72px!important;display:grid!important;grid-template-columns:1fr 86px!important;grid-template-rows:1fr!important;padding:5px!important;gap:5px!important}
.optimization-command>.optimization-panel>div{min-width:0!important}
.optimization-command>.optimization-panel>div small{font-size:7px!important}
.optimization-command>.optimization-panel>div b{font-size:14px!important;margin-top:2px!important}
.optimization-command>.optimization-panel>button{width:86px!important;height:42px!important;margin:auto!important}
.optimization-command>.optimization-panel>small{display:none!important}
.global-optimization-tools{grid-row:3!important;display:grid!important;grid-template-columns:1fr 1fr!important;gap:6px!important;height:38px!important}
.global-optimization-tools .tool-tile{width:100%!important;height:38px!important;min-height:38px!important;display:flex!important;flex-direction:row!important;gap:5px!important;padding:3px 5px!important;border:1px solid #dbe4ef!important;border-radius:8px!important;background:#fff!important}
.global-optimization-tools .tool-glyph{font-size:17px!important;height:auto!important;min-height:0!important}
.global-optimization-tools .tool-tile>span:last-child{font-size:7.5px!important;line-height:1.05!important}
.tool-tile.active{border-color:#2563eb!important;background:#eef5ff!important;box-shadow:0 0 0 1px rgba(37,99,235,.10) inset!important}
.global-document-modal .settings-grid{margin-top:8px}
.global-document-modal input,.global-document-modal select{min-height:38px}
@media(max-width:1450px){.commandbar{grid-template-columns:140px 215px 155px 305px 235px 155px!important}}
@media(max-width:1180px){.commandbar{grid-template-columns:repeat(3,minmax(210px,1fr))!important}.optimization-command{grid-template-rows:28px 72px 40px!important}}


/* V77 · Buscador vuelve a cabecera, donación al lateral derecho y recuperación como notificación */
.live-search-strip{display:none!important}
.header-search-dock{flex:1 1 420px;min-width:300px;display:flex;align-items:center;justify-content:center}
.header-search-dock .live-search-control{width:min(520px,100%)!important;min-width:280px!important;display:grid!important}
.header-search-dock .live-search-field>span{display:none!important}
.header-search-dock .live-search-control input{height:38px!important;font-size:11px!important}
.header-search-dock .live-search-status{font-size:8.5px!important}
.editor-topbar-inner{align-items:center!important}
.editor-primary-actions{flex:0 0 auto!important;margin-left:auto!important}
.editor-primary-actions .top-donation-btn{display:none!important}
.main-ad-region{display:flex!important;flex-direction:column!important;align-self:flex-start!important;gap:12px!important;padding-top:18px!important}
.main-ad-region>#topDonationBtn{display:flex!important;order:-1!important;width:100%!important;min-width:0!important;max-width:none!important;height:46px!important;justify-content:center!important}
.main-ad-region>#topDonationBtn b{text-align:center!important}
.main-ad-region .ad-label{margin-top:2px!important}
.pages-workspace{grid-template-columns:minmax(0,1fr) 340px!important;grid-template-areas:"heading ad" "recovery ad" "empty ad" "pages ad"!important}
.pages-workspace>#sessionRecoveryBanner{grid-area:recovery!important;position:relative!important;top:auto!important;left:auto!important;right:auto!important;transform:none!important;width:min(620px,100%)!important;max-width:620px!important;margin:6px 0 8px 0!important;padding:11px 14px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:14px!important;border:1px solid #cfe0fb!important;border-radius:14px!important;background:linear-gradient(180deg,#ffffff,#f7fbff)!important;box-shadow:0 10px 24px rgba(37,99,235,.08)!important}
.pages-workspace>#sessionRecoveryBanner.hidden{display:none!important}
.pages-workspace>#sessionRecoveryBanner::before{display:none!important}
.pages-workspace>#sessionRecoveryBanner .session-recovery-copy b{font-size:10.5px!important;color:#1d4ed8!important}
.pages-workspace>#sessionRecoveryBanner .session-recovery-copy span{font-size:8.8px!important}
.pages-workspace>#sessionRecoveryBanner .session-recovery-actions{grid-template-columns:auto auto!important;gap:8px!important}
.pages-workspace>#sessionRecoveryBanner .session-recovery-actions button{height:34px!important;padding:0 12px!important}
.session-recovery-toggle{display:none!important}
@keyframes recoveryToastDrop{0%{opacity:0;transform:translateY(-8px)}100%{opacity:1;transform:translateY(0)}}
.pages-workspace>#sessionRecoveryBanner.recovery-notification-visible{animation:recoveryToastDrop .22s ease-out}
@media (max-width:1500px){.header-search-dock{flex:1 1 360px!important}.header-search-dock .live-search-control{width:min(450px,100%)!important}}
@media (max-width:1280px){.editor-topbar-inner{flex-wrap:wrap!important}.header-search-dock{order:3;flex:1 1 100%!important;justify-content:flex-start!important}.header-search-dock .live-search-control{width:min(100%,560px)!important}.editor-primary-actions{order:2!important}.pages-workspace{grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"heading" "recovery" "empty" "pages" "ad"!important}.main-ad-region{width:100%!important;max-width:420px!important;justify-self:end!important}}
@media (max-width:760px){.header-search-dock{min-width:0!important}.header-search-dock .live-search-control{min-width:0!important;width:100%!important;grid-template-columns:18px minmax(80px,1fr) auto 28px 28px 28px!important}.header-search-dock .live-search-status{display:none!important}.pages-workspace>#sessionRecoveryBanner{width:100%!important;max-width:none!important;flex-direction:column!important;align-items:flex-start!important}.main-ad-region>#topDonationBtn{height:44px!important}}


/* V78 · Ajustes del lateral y del estado vacío */
.main-ad-region{padding-top:12px!important;gap:10px!important}
.main-ad-region>#topDonationBtn{order:1!important;margin-bottom:0!important}
.main-ad-region .ad-label{order:2!important;display:block!important;margin:0!important;text-align:center!important;letter-spacing:.16em!important}
.main-ad-region .adsense-slot{order:3!important}

/* Quitar el bloque de encabezado de PÁGINAS/estadísticas/instrucción para limpiar la zona. */
.pages-heading{display:none!important}
.pages-workspace{padding-top:8px!important;grid-template-areas:"recovery ad" "empty ad" "pages ad"!important;align-items:start!important}

/* Cuando no hay páginas, el área para arrastrar debe empezar justo debajo de la barra. */
.editor-empty-state{height:auto!important;min-height:0!important;display:flex!important;align-items:stretch!important;justify-content:flex-start!important;padding:2px 0 0!important;margin:0!important}
#emptyEditorState{align-self:start!important}
.editor-drop-zone{width:min(100%,1180px)!important;min-height:320px!important;height:auto!important;justify-content:flex-start!important;padding:34px 24px 20px!important;margin-top:0!important}
.editor-drop-zone .drop-icons{margin-bottom:14px!important}
.editor-drop-zone h2{margin-top:0!important}

/* Si existe notificación de sesión, queda arriba sin desplazar demasiado. */
.pages-workspace>#sessionRecoveryBanner{margin:2px 0 8px 0!important}

@media (max-width:1280px){
  .pages-workspace{grid-template-areas:"recovery" "empty" "pages" "ad"!important}
  .editor-drop-zone{min-height:280px!important;padding-top:28px!important}
}
@media (max-width:760px){
  .editor-drop-zone{min-height:250px!important;padding-top:24px!important}
}


/* V79 · Buscador más simple y menos cargado visualmente */
#searchPrevBtn,#searchNextBtn{display:none!important}
.header-search-dock .live-search-control{grid-template-columns:20px minmax(140px,1fr) auto 28px!important;gap:8px!important;padding:0 10px!important}
.header-search-dock .live-search-control input{height:40px!important;font-size:12px!important}
.header-search-dock .live-search-control .live-search-status{max-width:none!important;min-width:86px!important;padding:0 6px!important;font-size:8px!important;color:#7a8ba3!important;background:#f8fafc!important;border:1px solid #e3eaf3!important;border-radius:9px!important;display:flex!important;align-items:center!important;justify-content:center!important}
.header-search-dock .live-search-control .clear-live-search{width:28px!important;height:28px!important;font-size:16px!important}
.header-search-dock .live-search-control .clear-live-search:not(.visible){display:none!important}
@media (max-width:760px){.header-search-dock .live-search-control{grid-template-columns:18px minmax(80px,1fr) 26px!important}.header-search-dock .live-search-control .live-search-status{display:none!important}}


/* V80 · Buscador mínimo: solo lupa + campo de búsqueda. */
#searchPrevBtn,#searchNextBtn,#liveSearchStatus,#clearLiveSearchBtn{display:none!important}
.header-search-dock .live-search-control{grid-template-columns:20px minmax(160px,1fr)!important;gap:9px!important;padding:0 13px!important;border-radius:14px!important}
.header-search-dock .live-search-control input{height:42px!important;font-size:12px!important;font-weight:700!important}
.header-search-dock .live-search-control>svg{width:19px!important;height:19px!important}
.header-search-dock .live-search-control.has-results{border-color:#d8e2ee!important;background:#fff!important}
.header-search-dock .live-search-control.no-results{border-color:#d8e2ee!important;background:#fff!important}
.header-search-dock .live-search-control.is-searching{border-color:#d8e2ee!important;background:#fff!important}
@media(max-width:760px){.header-search-dock .live-search-control{grid-template-columns:18px minmax(80px,1fr)!important}}


/* V81 · Corrección real de posiciones en la pantalla principal.
   1) Guardado local queda a la izquierda del buscador.
   2) Donación -> ANUNCIO -> Google AdSense en ese orden.
   3) El estado vacío empieza inmediatamente bajo la barra de herramientas. */
.editor-topbar-inner>#sessionSaveStatus{
  order:initial!important;
  flex:0 0 auto!important;
  margin-left:auto!important;
}
.header-search-dock{
  flex:1 1 430px!important;
  min-width:300px!important;
  justify-content:flex-start!important;
  margin-left:8px!important;
}
.editor-primary-actions{
  margin-left:0!important;
}

/* El antiguo grid hacía que la altura mínima del anuncio vertical se
   distribuyera entre las filas y empujara el área de arrastre hacia abajo.
   El anuncio ahora se posiciona de forma independiente a la derecha. */
.pages-workspace{
  display:block!important;
  position:relative!important;
  box-sizing:border-box!important;
  padding:10px 390px 24px 28px!important;
  min-height:calc(100vh - 250px)!important;
}
.pages-heading{display:none!important}
.pages-workspace>#sessionRecoveryBanner{
  position:relative!important;
  width:min(620px,100%)!important;
  max-width:620px!important;
  margin:0 0 8px 0!important;
}
.pages-workspace>#emptyEditorState{
  display:flex!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
}
.pages-workspace>#pagesStream{
  width:100%!important;
  margin:0!important;
}
.editor-drop-zone{
  width:100%!important;
  max-width:none!important;
  height:auto!important;
  min-height:320px!important;
  margin:0!important;
  padding:30px 24px 22px!important;
  justify-content:center!important;
}

.main-ad-region{
  position:absolute!important;
  top:10px!important;
  right:28px!important;
  left:auto!important;
  width:340px!important;
  min-width:340px!important;
  max-width:340px!important;
  min-height:0!important;
  margin:0!important;
  padding:12px 10px 10px!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  gap:9px!important;
}
.main-ad-region>#topDonationBtn{
  position:static!important;
  order:1!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  height:46px!important;
  margin:0!important;
}
.main-ad-region .ad-label{
  position:static!important;
  order:2!important;
  top:auto!important;
  left:auto!important;
  right:auto!important;
  transform:none!important;
  align-self:center!important;
  display:block!important;
  margin:0!important;
  padding:0!important;
  line-height:16px!important;
  text-align:center!important;
  color:#8290a5!important;
  font-size:9px!important;
  font-weight:900!important;
  letter-spacing:.14em!important;
}
.main-ad-region .adsense-slot{
  position:static!important;
  order:3!important;
  width:100%!important;
  min-height:600px!important;
  margin:0!important;
}

@media(max-width:1280px){
  .editor-topbar-inner{flex-wrap:wrap!important}
  .editor-topbar-inner>#sessionSaveStatus{margin-left:0!important;order:2!important}
  .header-search-dock{order:3!important;flex:1 1 calc(100% - 150px)!important;margin-left:6px!important}
  .editor-primary-actions{order:4!important;width:100%!important;justify-content:flex-end!important}
  .pages-workspace{padding:10px 18px 24px!important}
  .main-ad-region{
    position:relative!important;
    top:auto!important;right:auto!important;
    width:min(100%,420px)!important;
    min-width:0!important;max-width:420px!important;
    margin:18px 0 0 auto!important;
  }
}
@media(max-width:760px){
  .editor-topbar-inner>#sessionSaveStatus{order:2!important}
  .header-search-dock{order:3!important;flex:1 1 100%!important;min-width:0!important;margin-left:0!important}
  .editor-drop-zone{min-height:260px!important;padding:24px 16px 18px!important}
  .pages-workspace{padding:8px 10px 20px!important}
}

/* V86 · Corrección estable. Solo ajustes locales, sin tocar el layout global. */
/* Respeta el comportamiento histórico: el panel de carga desaparece al cargar archivos. */
.pages-workspace>#emptyEditorState.hidden{display:none!important}

/* OPTIMIZAR: peso a la izquierda y AJUSTES (grises/enderezar) a la derecha,
   dentro del MISMO panel existente. No crea un grupo adicional en la barra. */
.optimization-command{
  display:grid!important;
  grid-template-columns:minmax(0,1.2fr) minmax(88px,.9fr)!important;
  grid-template-rows:28px 112px!important;
  column-gap:6px!important;
  align-content:start!important;
}
.optimization-command>.toolbar-label{grid-column:1/-1!important;grid-row:1!important}
.optimization-command>.optimization-panel{
  grid-column:1!important;grid-row:2!important;
  width:100%!important;height:112px!important;min-height:112px!important;
  padding:6px!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:36px 16px 38px!important;
  gap:5px!important;
  overflow:hidden!important;
}
.optimization-command>.optimization-panel>div{grid-row:1!important;align-items:center!important;justify-content:center!important;text-align:center!important}
.optimization-command>.optimization-panel>div small{font-size:7px!important}
.optimization-command>.optimization-panel>div b{font-size:15px!important;margin-top:2px!important}
.optimization-command>#optimizationLevelLabel{grid-row:2!important;display:block!important;align-self:center!important;font-size:7px!important;text-align:center!important}
.optimization-command>#optimizeWeightBtn{
  grid-row:3!important;width:100%!important;height:38px!important;min-height:38px!important;
  align-self:stretch!important;margin:0!important;padding:0 6px!important;
}
.global-optimization-tools{
  grid-column:2!important;grid-row:2!important;
  height:112px!important;min-height:112px!important;
  display:grid!important;grid-template-columns:1fr!important;grid-template-rows:1fr 1fr!important;
  gap:6px!important;overflow:hidden!important;
}
.global-optimization-tools .tool-tile{
  width:100%!important;height:53px!important;min-height:53px!important;
  display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;
  gap:2px!important;padding:4px 3px!important;border:1px solid #dbe4ef!important;border-radius:8px!important;background:#fff!important;
}
.global-optimization-tools .tool-glyph{font-size:17px!important;height:auto!important;min-height:0!important}
.global-optimization-tools .tool-tile>span:last-child{font-size:7.2px!important;line-height:1.05!important;text-align:center!important}

/* DOCUMENTO conserva su panel original; solo acomoda el nuevo séptimo botón en 4x2. */
.document-command .command-buttons{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  grid-template-rows:repeat(2,1fr)!important;
  gap:6px!important;
}
.document-command .tool-tile{min-width:0!important;padding:4px 2px!important}

/* Borde de página: estilos exclusivos de la nueva herramienta. */
.page-border-split{position:relative!important;padding-right:16px!important}
.page-border-arrow{position:absolute!important;right:3px!important;bottom:3px!important;width:15px!important;height:18px!important;display:grid!important;place-items:center!important;border-left:1px solid rgba(100,116,139,.22)!important;color:#64748b!important;font-style:normal!important;font-size:9px!important;cursor:pointer!important;pointer-events:auto!important}
.page-border-split.active .page-border-arrow,.page-border-split:hover .page-border-arrow{color:inherit!important}
.page-border-card{width:min(760px,calc(100vw - 24px))!important}
.page-border-gallery{display:grid;grid-template-columns:repeat(5,minmax(88px,1fr));gap:8px;margin:10px 0}
.page-border-gallery>button{height:72px;padding:7px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border:1px solid #d7e1ed;border-radius:10px;background:#fff;color:#334155;font-size:9px;font-weight:850;cursor:pointer}
.page-border-gallery>button:hover{border-color:#91b4f4;background:#f6f9ff}.page-border-gallery>button.active{border-color:#2563eb;background:#edf4ff;box-shadow:0 0 0 2px rgba(37,99,235,.10)}
.border-preview{width:52px;height:30px;display:grid;place-items:center;box-sizing:border-box;color:#2563eb;font-size:18px;font-style:normal}
.border-preview.solid{border:2px solid currentColor}.border-preview.double{border:4px double currentColor}.border-preview.dashed{border:2px dashed currentColor}.border-preview.dotted{border:2px dotted currentColor}.border-preview.classic{border:3px double currentColor;outline:1px solid currentColor;outline-offset:3px}.border-preview.school,.border-preview.art{border:1px solid #cbd5e1;border-radius:4px;background:#f8fafc}
.page-border-controls{display:grid;grid-template-columns:1.6fr 1fr 1fr .9fr;gap:9px;align-items:stretch;margin:10px 0}
.page-border-controls>div,.page-border-controls>label{min-height:56px;padding:8px;display:flex;flex-direction:column;justify-content:center;gap:6px;border:1px solid #dce5ef;border-radius:10px;background:#fff;color:#526176;font-size:9px;font-weight:850;box-sizing:border-box}
.page-border-controls input[type="range"]{width:100%}.page-border-rounded{flex-direction:row!important;align-items:center!important}.page-border-rounded input{margin:0 5px 0 0}
.page-border-color-palette{display:flex;align-items:center;gap:5px;flex-wrap:wrap}.page-border-color-palette button{width:22px;height:22px;padding:2px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;cursor:pointer}.page-border-color-palette button::before{content:"";display:block;width:100%;height:100%;border-radius:4px;background:var(--c)}.page-border-color-palette button.active{border-color:#2563eb;box-shadow:0 0 0 2px rgba(37,99,235,.14)}.page-border-color-palette input[type="color"]{width:28px;height:24px;padding:1px;border:1px solid #cbd5e1;border-radius:6px;background:#fff}
.page-border-live-preview{margin-top:10px;padding:8px;border:1px solid #e1e8f0;border-radius:10px;background:#f8fafc;color:#64748b;font-size:8px;font-weight:850}.page-border-live-preview>span{display:block;margin-bottom:5px}.page-border-live-preview>div{height:92px;position:relative;border:1px solid #e2e8f0;background:#fff}.page-border-live-preview>div>i{position:absolute;inset:var(--border-margin,9px);border:var(--border-width,3px) solid var(--border-color,#2563eb);pointer-events:none}.page-border-live-preview>div.rounded>i{border-radius:9px}.page-border-live-preview>div[data-style="double"]>i{border-style:double;border-width:calc(var(--border-width,3px) + 2px)}.page-border-live-preview>div[data-style="dashed"]>i{border-style:dashed}.page-border-live-preview>div[data-style="dotted"]>i{border-style:dotted}.page-border-live-preview>div[data-style="classic"]>i{border-style:double;border-width:5px}.page-border-live-preview>div[data-style="stars"]>i::after{content:"★  ★  ★  ★  ★";position:absolute;left:5px;right:5px;top:-10px;color:var(--border-color,#2563eb);letter-spacing:10px;white-space:nowrap;overflow:hidden}.page-border-live-preview>div[data-style="waves"]>i{border-style:dashed}.page-border-live-preview>div[data-style="corners"]>i{border-color:transparent}.page-border-live-preview>div[data-style="corners"]>i::before,.page-border-live-preview>div[data-style="corners"]>i::after{content:"";position:absolute;width:25px;height:25px;border-color:var(--border-color,#2563eb);border-style:solid}.page-border-live-preview>div[data-style="corners"]>i::before{left:-3px;top:-3px;border-width:var(--border-width,3px) 0 0 var(--border-width,3px)}.page-border-live-preview>div[data-style="corners"]>i::after{right:-3px;bottom:-3px;border-width:0 var(--border-width,3px) var(--border-width,3px) 0}
.office-page-border-btn .page-border-arrow,#previewPageBorderBtn .page-border-arrow{right:3px!important;bottom:3px!important}
@media(max-width:760px){.page-border-gallery{grid-template-columns:repeat(3,1fr)}.page-border-controls{grid-template-columns:1fr 1fr}}


/* ==================================================================
   V87 · CORRECCIÓN ESTRUCTURAL ESTABLE: una sola barra + footer al final
   ------------------------------------------------------------------
   La publicidad ya NO es absoluta. La zona izquierda y el anuncio son
   dos columnas hermanas en el flujo normal, por lo que el footer siempre
   queda debajo de ambas y no se crean contenedores verticales anidados.
   ================================================================== */
.pages-workspace{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 340px!important;
  column-gap:18px!important;
  align-items:start!important;
  align-content:start!important;
  position:relative!important;
  box-sizing:border-box!important;
  width:100%!important;
  height:auto!important;
  max-height:none!important;
  min-height:0!important;
  padding:10px 28px 24px!important;
  overflow:visible!important;
}
.pages-main-column{
  min-width:0!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  overflow:visible!important;
}
.pages-main-column>.pages-heading{display:none!important}
.pages-main-column>#sessionRecoveryBanner{order:0!important;position:relative!important;width:min(620px,100%)!important;max-width:620px!important;margin:0 0 8px!important}
.pages-main-column>#emptyEditorState{order:1!important;width:100%!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;overflow:visible!important}
.pages-main-column>#emptyEditorState.hidden{display:none!important}
.pages-main-column>#pagesStream{order:2!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;margin:0!important;overflow:visible!important}

/* El anuncio vuelve al flujo normal: nada de absolute/sticky ni scroll propio. */
.pages-workspace>.main-ad-region{
  position:relative!important;
  top:auto!important;
  right:auto!important;
  bottom:auto!important;
  left:auto!important;
  width:340px!important;
  min-width:340px!important;
  max-width:340px!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  padding:12px 10px 10px!important;
  align-self:start!important;
  overflow:visible!important;
}
.pages-workspace>.main-ad-region .adsense-slot{
  width:100%!important;
  min-height:600px!important;
  height:600px!important;
  max-height:600px!important;
  overflow:hidden!important;
}

/* Solo el documento debe desplazarse verticalmente. */
main,#editorView,.editor-view,.pages-workspace,.pages-main-column{
  overflow-y:visible!important;
}
main,#editorView,.editor-view{
  height:auto!important;
  max-height:none!important;
}

/* El pie permanece en el flujo, después de la altura real del editor/anuncio. */
.site-footer{
  position:relative!important;
  clear:both!important;
  width:100%!important;
  margin:0!important;
  z-index:2!important;
}

@media(max-width:1280px){
  .pages-workspace{
    grid-template-columns:minmax(0,1fr)!important;
    row-gap:18px!important;
    padding:10px 18px 24px!important;
  }
  .pages-workspace>.main-ad-region{
    width:min(100%,420px)!important;
    min-width:0!important;
    max-width:420px!important;
    justify-self:end!important;
  }
}
@media(max-width:760px){
  .pages-workspace{padding:8px 10px 20px!important}
  .pages-workspace>.main-ad-region{width:100%!important;max-width:100%!important}
}


/* V88 · Ajustes solicitados sin tocar el layout de páginas/footer/scroll */
/* Ocultar solamente el indicador visual de autoguardado; la lógica sigue funcionando. */
#sessionSaveStatus{display:none!important}

/* Buscador compacto, inmediatamente a la izquierda de Idioma. */
.editor-topbar-inner{gap:12px!important}
.editor-primary-actions{margin-left:auto!important;display:flex!important;align-items:center!important;gap:9px!important;flex-wrap:nowrap!important}
.header-search-dock{order:-1!important;flex:0 0 330px!important;width:330px!important;min-width:260px!important;max-width:330px!important;margin:0!important;justify-content:flex-end!important}
.header-search-dock .live-search-control{width:100%!important;min-width:0!important;height:44px!important}
.editor-language{margin-left:0!important}

/* DOCUMENTO contiene ahora Grises y Enderezar junto con las demás herramientas globales. */
.document-command .command-buttons{grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:repeat(2,1fr)!important;gap:5px!important}
.document-command .tool-tile{min-width:0!important;padding:3px 1px!important}
.document-command .tool-glyph{font-size:18px!important}
.document-command .tool-tile>span:last-child{font-size:6.8px!important;line-height:1.05!important}

/* OPTIMIZAR vuelve a ser un único panel y el botón queda dentro de él. */
.optimization-command{display:grid!important;grid-template-columns:1fr!important;grid-template-rows:28px 112px!important;align-content:start!important}
.optimization-command>.toolbar-label{grid-column:1!important;grid-row:1!important}
.optimization-command>.optimization-panel{grid-column:1!important;grid-row:2!important;width:100%!important;height:112px!important;min-height:112px!important;padding:7px!important;display:grid!important;grid-template-columns:1fr!important;grid-template-rows:36px 16px 38px!important;gap:5px!important;overflow:hidden!important}
.optimization-command>.optimization-panel>div{grid-row:1!important;align-items:center!important;justify-content:center!important;text-align:center!important}
.optimization-command>#optimizationLevelLabel{grid-row:2!important;display:block!important;text-align:center!important;align-self:center!important}
.optimization-command>#optimizeWeightBtn{grid-row:3!important;width:100%!important;height:38px!important;min-height:38px!important;margin:0!important;align-self:stretch!important}
.global-optimization-tools{display:none!important}

/* Borde de página: el rango y la acción quedan explícitos. */
.page-border-target-box{margin:10px 0;padding:10px;border:1px solid #dce5ef;border-radius:11px;background:#f8fafc}
.page-border-target-mode{display:grid;grid-template-columns:130px minmax(180px,1fr);align-items:center;gap:10px;color:#526176;font-size:9px;font-weight:850}
.page-border-target-mode select{height:36px;border:1px solid #cfdbe8;border-radius:8px;background:#fff;padding:0 9px;color:#26364b;font-weight:800}
.page-border-target-box .settings-grid{margin-top:9px}
.page-border-target-note{display:block;margin-top:8px;color:#64748b;font-size:8px;line-height:1.35}
.page-border-target-note b{color:#334155}
#applyPageBorderBtn:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
@media(max-width:1220px){.header-search-dock{flex-basis:270px!important;width:270px!important;max-width:270px!important}.document-command .tool-tile>span:last-child{font-size:6.2px!important}}
@media(max-width:900px){.editor-primary-actions{flex-wrap:wrap!important}.header-search-dock{flex:1 1 100%!important;width:100%!important;max-width:none!important;order:-1!important}.page-border-target-mode{grid-template-columns:1fr!important}}

/* V88-final · selectores directos del panel OPTIMIZAR corregidos */
.optimization-command>.optimization-panel>#optimizationLevelLabel{grid-row:2!important;display:block!important;text-align:center!important;align-self:center!important;font-size:7px!important;color:#64748b!important}
.optimization-command>.optimization-panel>#optimizeWeightBtn{grid-row:3!important;width:100%!important;height:38px!important;min-height:38px!important;margin:0!important;align-self:stretch!important;justify-self:stretch!important}


/* V89 · Borde de página compacto, sin scroll interno en escritorio */
.page-border-modal{z-index:10450!important;padding:12px!important}
.page-border-card{width:min(790px,96vw)!important;max-height:none!important;overflow:visible!important;padding:16px!important;border-radius:16px!important}
.page-border-card>header{margin-bottom:4px!important}.page-border-card h2{font-size:21px!important}.page-border-card .modal-copy{margin:2px 0 10px!important;font-size:10.5px!important}
.page-border-compact-grid{display:grid;grid-template-columns:1.25fr 1.65fr .8fr .8fr .9fr;gap:8px;align-items:stretch}
.page-border-compact-grid>label,.page-border-compact-grid>div{min-width:0;padding:8px;border:1px solid #dce5ef;border-radius:10px;background:#fff;color:#526176;font-size:8.5px;font-weight:850;box-sizing:border-box}
.page-border-compact-grid>label>span,.page-border-compact-grid>div>span{display:block;margin-bottom:5px;color:#43546a;font-weight:900}
.page-border-style-combo{display:grid;grid-template-columns:34px 1fr;gap:6px;align-items:center}.page-border-style-combo>i{width:32px;height:30px;display:grid;place-items:center;border:1px solid #cfdbe8;border-radius:7px;background:#f8fafc;font-style:normal;font-size:17px;font-weight:900}.page-border-style-combo select{width:100%;height:30px;border:1px solid #cfdbe8;border-radius:7px;background:#fff;padding:0 7px;color:#26364b;font-size:9px;font-weight:800}
.page-border-color-palette{display:grid!important;grid-template-columns:repeat(10,18px)!important;gap:3px!important;align-content:center!important}.page-border-color-palette button{width:18px!important;height:18px!important;padding:1px!important;border-radius:5px!important}.page-border-color-palette button::before{border-radius:3px!important}.page-border-color-palette input[type="color"]{width:18px!important;height:18px!important;padding:0!important;border-radius:5px!important;grid-column:auto!important}
.page-border-slider{display:flex!important;flex-direction:column!important;justify-content:center!important}.page-border-slider input[type="range"]{width:100%!important}.page-border-rounded{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;gap:6px!important}.page-border-rounded>span{margin:0!important;text-align:center}.page-border-rounded input{margin:0!important}
.page-border-target-box{margin:9px 0 8px!important;padding:8px!important}.page-border-target-mode{grid-template-columns:120px minmax(190px,1fr)!important;gap:8px!important}.page-border-target-mode select{height:32px!important}.page-border-target-box .settings-grid{margin-top:7px!important;grid-template-columns:1fr 1fr!important;gap:7px!important}.page-border-target-box .settings-grid label{min-height:52px!important}.page-border-target-note{margin-top:6px!important;font-size:7.5px!important}.page-border-actions{margin-top:0!important;gap:8px!important}.page-border-actions button{min-height:36px!important}
.page-border-gallery,.page-border-live-preview{display:none!important}
@media(max-height:610px){.page-border-card{max-height:calc(100vh - 16px)!important;overflow:auto!important}}
@media(max-width:760px){.page-border-card{max-height:calc(100vh - 16px)!important;overflow:auto!important}.page-border-compact-grid{grid-template-columns:1fr 1fr!important}.page-border-color-control{grid-column:1/-1}.page-border-target-mode{grid-template-columns:1fr!important}}


/* V90 · Borde de página: Propiedades visuales, compactas y editables */
.page-border-modal{z-index:10450!important;padding:14px!important;align-items:center!important;justify-content:center!important}
.page-border-properties-card{position:relative!important;width:min(760px,96vw)!important;max-height:none!important;overflow:visible!important;padding:16px!important;border-radius:18px!important;box-shadow:0 24px 64px rgba(15,23,42,.28)!important}
.page-border-properties-head{min-height:42px!important;margin:0 0 12px!important;padding:0 2px 10px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;border-bottom:1px solid #e5edf6!important}
.page-border-properties-head>strong{font-size:21px!important;line-height:1!important;color:#152238!important;font-weight:950!important;letter-spacing:-.02em!important}
.page-border-scope-text{display:none!important}
.page-border-properties-layout{display:grid!important;grid-template-columns:290px minmax(0,1fr)!important;gap:12px!important;align-items:stretch!important}
.page-border-design-card,.page-border-controls-card{position:relative!important;padding:12px!important;border:1px solid #dce6f1!important;border-radius:14px!important;background:#fbfdff!important;box-sizing:border-box!important}
.page-border-section-label{display:block!important;margin-bottom:8px!important;color:#40536d!important;font-size:10px!important;font-weight:950!important;letter-spacing:.02em!important}
.page-border-style-picker{width:100%!important;height:72px!important;padding:8px 10px!important;display:grid!important;grid-template-columns:62px minmax(0,1fr) 24px!important;align-items:center!important;gap:10px!important;border:1px solid #bfd1ea!important;border-radius:12px!important;background:#fff!important;color:#21334d!important;cursor:pointer!important;text-align:left!important;box-shadow:0 3px 10px rgba(15,23,42,.04)!important}
.page-border-style-picker:hover,.page-border-style-picker[aria-expanded="true"]{border-color:#4f8ef7!important;box-shadow:0 0 0 3px rgba(37,99,235,.09)!important}
.page-border-style-picker>span{min-width:0!important;display:flex!important;flex-direction:column!important;gap:3px!important}.page-border-style-picker b{font-size:12px!important;font-weight:950!important}.page-border-style-picker small{font-size:8px!important;color:#7b8ba2!important;font-weight:750!important}.page-border-style-picker em{font-style:normal!important;font-size:17px!important;color:#66809f!important;text-align:center!important}
.page-border-native-select{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}
#pageBorderSelectedStylePreview,.page-border-style-menu i{position:relative!important;display:grid!important;place-items:center!important;width:58px!important;height:42px!important;border-radius:8px!important;background:#fff!important;color:var(--border-sample-color,#2563eb)!important;overflow:hidden!important;box-sizing:border-box!important}
#pageBorderSelectedStylePreview::before,.page-border-style-menu i::before{content:"";position:absolute;inset:7px;border:var(--border-sample-width,2px) solid currentColor;border-radius:2px;box-sizing:border-box}
#pageBorderSelectedStylePreview[data-style="none"]::before{border-style:dashed;opacity:.3}
#pageBorderSelectedStylePreview[data-style="double"]::before,.page-border-style-menu i[data-style="double"]::before{border-style:double;border-width:4px}
#pageBorderSelectedStylePreview[data-style="dashed"]::before,.page-border-style-menu i[data-style="dashed"]::before{border-style:dashed}
#pageBorderSelectedStylePreview[data-style="dotted"]::before,.page-border-style-menu i[data-style="dotted"]::before{border-style:dotted}
#pageBorderSelectedStylePreview[data-style="triple"]::before,.page-border-style-menu i[data-style="triple"]::before{box-shadow:0 0 0 3px #fff,0 0 0 4px currentColor,0 0 0 7px #fff,0 0 0 8px currentColor}
#pageBorderSelectedStylePreview[data-style="classic"]::before,.page-border-style-menu i[data-style="classic"]::before{border-style:double;border-width:5px;outline:1px solid currentColor;outline-offset:3px}
#pageBorderSelectedStylePreview[data-style="shadow"]::before,.page-border-style-menu i[data-style="shadow"]::before{box-shadow:5px 5px 0 color-mix(in srgb,currentColor 26%,transparent)}
#pageBorderSelectedStylePreview[data-style="stars"]::before,.page-border-style-menu i[data-style="stars"]::before{content:"★  ★  ★";inset:auto!important;border:0!important;font-size:15px;letter-spacing:2px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="diamonds"]::before,.page-border-style-menu i[data-style="diamonds"]::before{content:"◆  ◆  ◆";inset:auto!important;border:0!important;font-size:12px;letter-spacing:2px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="flowers"]::before,.page-border-style-menu i[data-style="flowers"]::before{content:"✿  ✿  ✿";inset:auto!important;border:0!important;font-size:14px;letter-spacing:2px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="waves"]::before,.page-border-style-menu i[data-style="waves"]::before{content:"〰 〰 〰";inset:auto!important;border:0!important;font-size:19px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="school"]::before,.page-border-style-menu i[data-style="school"]::before{content:"■ ● ■ ●";inset:auto!important;border:0!important;font-size:9px;letter-spacing:2px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="geometric"]::before,.page-border-style-menu i[data-style="geometric"]::before{content:"◇ ■ ◇ ■";inset:auto!important;border:0!important;font-size:10px;letter-spacing:1px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="ornamental"]::before,.page-border-style-menu i[data-style="ornamental"]::before{content:"❖ ◇ ❖";inset:auto!important;border:0!important;font-size:12px;letter-spacing:2px;white-space:nowrap}
#pageBorderSelectedStylePreview[data-style="corners"]::before,.page-border-style-menu i[data-style="corners"]::before{content:"⌜      ⌝\A⌞      ⌟";white-space:pre;inset:auto!important;border:0!important;font-size:13px;line-height:16px}
.page-border-style-menu{position:absolute!important;z-index:20!important;left:12px!important;right:12px!important;top:104px!important;padding:8px!important;display:grid!important;grid-template-columns:repeat(3,1fr)!important;gap:6px!important;border:1px solid #c8d8ec!important;border-radius:13px!important;background:#fff!important;box-shadow:0 18px 40px rgba(15,23,42,.22)!important}
.page-border-style-menu.hidden{display:none!important}.page-border-style-menu button{height:62px!important;padding:5px!important;display:grid!important;grid-template-columns:48px 1fr!important;align-items:center!important;gap:5px!important;border:1px solid #e0e8f2!important;border-radius:9px!important;background:#fff!important;color:#40536d!important;cursor:pointer!important;text-align:left!important}.page-border-style-menu button:hover,.page-border-style-menu button.active{border-color:#4f8ef7!important;background:#eef5ff!important;color:#155bdd!important}.page-border-style-menu i{width:46px!important;height:34px!important}.page-border-style-menu span{font-size:8px!important;font-weight:900!important}
.page-border-controls-card{display:flex!important;flex-direction:column!important;gap:10px!important}.page-border-color-palette{display:grid!important;grid-template-columns:repeat(10,24px)!important;gap:5px!important;align-content:start!important}.page-border-color-palette button,.page-border-custom-color{width:24px!important;height:24px!important;padding:2px!important;border:1px solid #ced9e6!important;border-radius:7px!important;background:#fff!important;box-sizing:border-box!important;cursor:pointer!important}.page-border-color-palette button::before{content:"";display:block;width:100%;height:100%;border-radius:5px;background:var(--c);border:1px solid rgba(15,23,42,.12)}.page-border-color-palette button:hover,.page-border-color-palette button.active{border-color:#2563eb!important;box-shadow:0 0 0 2px rgba(37,99,235,.12)!important}.page-border-custom-color{position:relative!important;display:grid!important;place-items:center!important;overflow:hidden!important}.page-border-custom-color input{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;opacity:0!important;cursor:pointer!important}.page-border-custom-color span{font-size:17px!important;color:#526a88!important;font-weight:800!important}
.page-border-sliders-row{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}.page-border-slider{padding:9px!important;border:1px solid #e0e8f2!important;border-radius:10px!important;background:#fff!important}.page-border-slider>span{display:flex!important;align-items:center!important;justify-content:space-between!important;margin-bottom:7px!important;color:#43546a!important;font-size:9px!important;font-weight:900!important}.page-border-slider>span b{min-width:28px!important;height:22px!important;display:grid!important;place-items:center!important;border-radius:7px!important;background:#eef5ff!important;color:#155bdd!important;font-size:9px!important}.page-border-slider input[type="range"]{width:100%!important}
.page-border-rounded{min-height:40px!important;padding:0 10px!important;display:flex!important;align-items:center!important;gap:8px!important;border:1px solid #e0e8f2!important;border-radius:10px!important;background:#fff!important;color:#43546a!important;font-size:9px!important;font-weight:900!important}.page-border-rounded input{width:16px!important;height:16px!important}
.page-border-target-box{margin:12px 0 10px!important;padding:10px 12px!important;border-radius:12px!important}.page-border-target-mode{grid-template-columns:90px minmax(180px,1fr)!important;gap:10px!important}.page-border-target-mode>span{font-size:9px!important}.page-border-target-mode select{height:38px!important;font-size:10px!important}.page-border-target-note{margin-top:6px!important;font-size:8px!important}.page-border-target-box .settings-grid{margin-top:8px!important;gap:8px!important}.page-border-target-box .settings-grid label{min-height:48px!important}
.page-border-actions{margin-top:0!important;display:grid!important;grid-template-columns:1fr 1.4fr!important;gap:9px!important}.page-border-actions button{height:42px!important;min-height:42px!important;font-size:10px!important;font-weight:900!important}
.page-border-gallery,.page-border-live-preview,.page-border-compact-grid{display:none!important}
@media(max-width:760px){.page-border-properties-card{max-height:calc(100vh - 16px)!important;overflow:auto!important}.page-border-properties-layout{grid-template-columns:1fr!important}.page-border-style-menu{grid-template-columns:repeat(2,1fr)!important}.page-border-color-palette{grid-template-columns:repeat(10,22px)!important}.page-border-color-palette button,.page-border-custom-color{width:22px!important;height:22px!important}}

/* V91 · Controles desplegables visibles y panel de borde por categorías */
.office-visual-quick-tools>button.has-color-dropdown,
.preview-edit-toolbar>button.has-preview-dropdown{position:relative!important;padding-right:24px!important}
.office-visual-quick-tools>button.has-color-dropdown .office-tool-drop-icon,
.preview-edit-toolbar>button.has-preview-dropdown .preview-tool-drop-icon{
  right:0!important;top:0!important;bottom:0!important;width:22px!important;height:auto!important;
  display:grid!important;place-items:center!important;border-left:2px solid rgba(37,99,235,.28)!important;
  border-radius:0 9px 9px 0!important;background:rgba(37,99,235,.10)!important;color:#155bdd!important;
  font-size:15px!important;font-weight:950!important;line-height:1!important;opacity:1!important;pointer-events:auto!important;
}
.office-visual-quick-tools>button.has-color-dropdown:hover .office-tool-drop-icon,
.preview-edit-toolbar>button.has-preview-dropdown:hover .preview-tool-drop-icon,
.office-visual-quick-tools>button.has-color-dropdown.active .office-tool-drop-icon,
.preview-edit-toolbar>button.has-preview-dropdown.active .preview-tool-drop-icon{background:rgba(37,99,235,.18)!important;color:#0b4dcc!important}
.page-border-split{position:relative!important;padding-right:27px!important}
.page-border-arrow{right:0!important;top:0!important;bottom:0!important;width:24px!important;height:auto!important;display:grid!important;place-items:center!important;border-left:2px solid rgba(37,99,235,.28)!important;border-radius:0 9px 9px 0!important;background:rgba(37,99,235,.10)!important;color:#155bdd!important;font-size:16px!important;font-weight:950!important;line-height:1!important;opacity:1!important;z-index:3!important}
.page-border-split:hover .page-border-arrow,.page-border-split.active .page-border-arrow{background:rgba(37,99,235,.18)!important;color:#0b4dcc!important}
.page-border-properties-layout{display:flex!important;flex-direction:column!important;gap:8px!important;align-items:stretch!important}
.page-border-accordion-section{padding:0!important;overflow:visible!important}
.page-border-accordion-toggle{width:100%!important;min-height:42px!important;padding:10px 12px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;border:0!important;border-radius:12px!important;background:#f5f9ff!important;color:#203653!important;cursor:pointer!important;font-size:11px!important;font-weight:950!important;text-align:left!important}
.page-border-accordion-toggle:hover,.page-border-accordion-toggle[aria-expanded="true"]{background:#eaf2ff!important;color:#155bdd!important}
.page-border-accordion-toggle i{font-style:normal!important;font-size:20px!important;line-height:.8!important;color:#2563eb!important;transition:transform .18s ease!important}
.page-border-accordion-toggle[aria-expanded="true"] i{transform:rotate(180deg)!important}
.page-border-accordion-body{padding:0 12px 12px!important;display:block!important}
.page-border-accordion-body.hidden{display:none!important}
.page-border-design-card,.page-border-controls-card{width:100%!important}
.page-border-style-menu{position:relative!important;left:auto!important;right:auto!important;top:auto!important;margin-top:8px!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;box-shadow:0 10px 24px rgba(15,23,42,.14)!important}
.page-border-style-menu button{min-height:56px!important;height:auto!important}
#pageBorderRange{padding:0!important;margin:0!important}
#pageBorderRange>.page-border-accordion-body{padding-bottom:10px!important}
.file-command{min-width:190px!important}
.file-command .command-buttons{gap:10px!important}
.file-command .tool-tile{min-width:86px!important;width:86px!important;min-height:96px!important;height:96px!important;padding:10px 6px!important;align-self:center!important}
.file-command .tool-glyph{font-size:25px!important;line-height:1!important}
.file-command .tool-tile>span:last-child{font-size:9px!important;line-height:1.1!important;font-weight:900!important}
.insert-command{min-width:250px!important}
.insert-command .command-buttons{grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:96px!important;gap:7px!important;align-content:center!important}
.insert-command .tool-tile{min-width:0!important}
#tableEditorModal{z-index:10600!important}
.table-editor-card{width:min(620px,94vw)!important}
.table-setup-grid{grid-template-columns:1fr 1fr 1fr!important}
.table-grid-preview{display:grid!important;grid-template-columns:repeat(var(--table-preview-cols,3),minmax(0,1fr))!important;gap:5px!important;max-height:230px!important;overflow:auto!important;padding:8px!important;border:1px solid #dbe5f0!important;border-radius:12px!important;background:#f8fbff!important}
.table-preview-cell{min-height:46px!important;padding:6px!important;border:1px solid #bfd1ea!important;border-radius:7px!important;background:#fff!important;color:#334155!important;font-size:10px!important;font-weight:750!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;cursor:pointer!important}
.table-preview-cell.active,.table-preview-cell:hover{border-color:#2563eb!important;background:#eaf2ff!important;color:#155bdd!important;box-shadow:0 0 0 2px rgba(37,99,235,.1)!important}
@media(max-width:760px){.page-border-style-menu{grid-template-columns:repeat(2,minmax(0,1fr))!important}.table-setup-grid{grid-template-columns:1fr 1fr!important}.table-setup-grid label:last-child{grid-column:1/-1}}

/* V92 · Archivo integrado, traducción y adaptación sin desbordamientos */
.editor-toolbar{height:226px!important;min-height:226px!important;overflow:visible!important}
.commandbar{width:min(1800px,100%)!important;max-width:none!important;height:226px!important;min-height:226px!important;grid-template-columns:200px 260px 190px minmax(300px,1fr) 190px 180px!important;gap:8px!important;padding:10px 12px!important;overflow:visible!important}
.commandbar>.command-group{height:205px!important;min-height:205px!important}
.commandbar>.file-command{min-width:0!important;width:100%!important}
.file-command .command-buttons{height:166px!important;min-height:166px!important;grid-template-columns:1fr 1fr!important;grid-template-rows:86px 72px!important;gap:8px!important;align-content:center!important}
.file-command .tool-tile{width:100%!important;min-width:0!important;min-height:0!important;height:100%!important;padding:7px 5px!important}
.file-command .translate-file-tool{grid-column:1/-1!important}
.file-command .translate-file-tool .tool-glyph{font-size:22px!important;letter-spacing:-.08em!important}
.file-command .translate-file-tool>span:last-child{font-size:9px!important}
.translation-card{width:min(620px,94vw)!important}
.translation-settings-grid{grid-template-columns:1fr 1fr!important}
.translation-settings-grid select{min-height:42px!important}
.translation-progress{display:grid;gap:6px;margin:12px 0 4px;color:#5d708b;font-size:9px;font-weight:800}
.translation-progress.hidden{display:none!important}
.translation-progress-track{height:9px;overflow:hidden;border-radius:999px;background:#e8eef7;box-shadow:inset 0 1px 2px rgba(15,23,42,.08)}
.translation-progress-track>span{display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2563eb,#0ea5e9);transition:width .2s ease}
.translation-status{min-height:16px;margin:9px 0 0;color:#536982;font-size:9px;line-height:1.4;font-weight:750}
.office-editor-close-tool{width:58px!important;height:58px!important;min-width:58px!important;min-height:58px!important;flex:0 0 58px!important;display:grid!important;place-items:center!important;padding:0!important;border:2px solid #ef233c!important;border-radius:13px!important;background:#fff1f2!important;color:#d71935!important;font-size:36px!important;font-weight:950!important;line-height:1!important;box-shadow:0 5px 16px rgba(215,25,53,.2)!important;z-index:12!important}
.office-editor-close-tool:hover{background:#d71935!important;border-color:#b5162d!important;color:#fff!important;transform:scale(1.04)}
.office-visual-quick-tools{overflow:visible!important;flex-wrap:wrap!important;align-content:center!important}
.office-visual-quick-tools>button[data-office-action="translate"]{color:#0b6b8f!important;border-color:#9ed8e8!important;background:#effbfe!important}
.office-visual-quick-tools>button[data-office-action="translate"] .office-tool-glyph{font-size:15px!important;letter-spacing:-.08em!important}
@media(max-width:1450px){.commandbar{grid-template-columns:200px 220px 165px minmax(220px,1fr) 165px 155px!important;gap:6px!important}.commandbar>.command-group{height:205px!important;min-height:205px!important}}
@media(max-width:1180px){.editor-toolbar{height:auto!important;min-height:0!important}.commandbar{height:auto!important;min-height:0!important;grid-template-columns:repeat(3,minmax(180px,1fr))!important;grid-auto-rows:174px!important;padding:8px!important;gap:8px!important}.commandbar>.command-group{height:174px!important;min-height:174px!important}.file-command .command-buttons{height:145px!important;min-height:145px!important;grid-template-rows:74px 63px!important}.pages-workspace{min-height:calc(100vh - 430px)!important}.office-editor-close-tool{width:54px!important;height:54px!important;min-width:54px!important;min-height:54px!important;flex-basis:54px!important;font-size:33px!important}}
@media(max-width:900px){.commandbar{grid-template-columns:repeat(2,minmax(160px,1fr))!important;grid-auto-rows:174px!important}.translation-settings-grid{grid-template-columns:1fr!important}.office-visual-quick-tools{max-height:116px!important;overflow:auto!important}}
@media(max-width:560px){.file-command .tool-tile>span:last-child{font-size:8px!important}.office-editor-close-tool{width:50px!important;height:50px!important;min-width:50px!important;min-height:50px!important;flex-basis:50px!important;font-size:31px!important}}

/* V93 · Barra final: traducción independiente y herramientas del editor en dos filas */
/* ARCHIVO conserva solo sus dos acciones de gestión; TRADUCIR tiene su propio panel. */
.commandbar{
  width:min(1800px,calc(100% - 24px))!important;
  max-width:1800px!important;
  grid-template-columns:185px 155px 235px 170px minmax(300px,1fr) 190px 180px!important;
  grid-template-rows:205px!important;
  grid-auto-flow:row!important;
  justify-content:center!important;
  align-content:start!important;
  overflow:visible!important;
}
.commandbar>.translation-command{
  min-width:0!important;
  width:100%!important;
  border-top-color:#0e9db5!important;
}
.translation-command .command-buttons{
  width:100%!important;
  height:166px!important;
  min-height:166px!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:1fr!important;
  gap:8px!important;
  align-content:center!important;
}
.translation-command .tool-tile,
.translation-command .translate-file-tool{
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  padding:7px 5px!important;
  color:#0b6b8f!important;
  border-color:#9ed8e8!important;
  background:linear-gradient(180deg,#f4fdff,#e9f8fc)!important;
}
.translation-command .translate-file-tool:hover:not(:disabled){
  border-color:#43b9cf!important;
  background:#dff6fb!important;
  box-shadow:0 6px 14px rgba(14,157,181,.15)!important;
}
.translation-command .tool-glyph{font-size:24px!important;letter-spacing:-.08em!important;line-height:1!important}
.translation-command .tool-tile>span:last-child{font-size:9px!important;line-height:1.1!important;font-weight:900!important}
.file-command .command-buttons{grid-template-rows:1fr!important}
.file-command .translate-file-tool{grid-column:auto!important}

/* El editor nativo usa diez columnas compactas: las 19 herramientas caben siempre
   en dos filas y nunca generan una tercera fila ni una barra horizontal. */
.office-editor-toolbar{
  overflow:hidden!important;
  overflow-x:hidden!important;
  align-items:flex-start!important;
}
.office-visual-quick-tools{
  display:grid!important;
  grid-template-columns:repeat(10,72px)!important;
  grid-template-rows:repeat(2,52px)!important;
  grid-auto-flow:row!important;
  grid-auto-rows:52px!important;
  width:774px!important;
  min-width:774px!important;
  max-width:774px!important;
  height:110px!important;
  min-height:110px!important;
  max-height:110px!important;
  gap:6px!important;
  align-content:start!important;
  overflow:hidden!important;
  overflow-x:hidden!important;
  overflow-y:hidden!important;
  scrollbar-width:none!important;
}
.office-visual-quick-tools::-webkit-scrollbar{display:none!important}
.office-visual-quick-tools>button{
  width:72px!important;
  min-width:72px!important;
  max-width:72px!important;
  height:52px!important;
  min-height:52px!important;
  max-height:52px!important;
  margin:0!important;
}

@media(max-width:1500px){
  .commandbar{
    width:calc(100% - 16px)!important;
    grid-template-columns:180px 145px 210px 155px minmax(220px,1fr) 160px 160px!important;
    gap:6px!important;
  }
  .office-visual-quick-tools{
    grid-template-columns:repeat(10,58px)!important;
    grid-template-rows:repeat(2,48px)!important;
    grid-auto-rows:48px!important;
    width:625px!important;
    min-width:625px!important;
    max-width:625px!important;
    height:102px!important;
    min-height:102px!important;
    max-height:102px!important;
    gap:5px!important;
  }
  .office-visual-quick-tools>button{
    width:58px!important;min-width:58px!important;max-width:58px!important;
    height:48px!important;min-height:48px!important;max-height:48px!important;
  }
}

@media(max-width:1400px){
  .office-editor-card{grid-template-rows:170px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{
    height:168px!important;min-height:168px!important;max-height:168px!important;
    flex-wrap:wrap!important;align-content:flex-start!important;padding-right:66px!important;
  }
  .office-visual-quick-tools{
    order:10!important;flex:1 1 100%!important;
    width:100%!important;min-width:0!important;max-width:100%!important;justify-content:center!important;
    grid-template-columns:repeat(10,minmax(0,1fr))!important;
  }
  .office-visual-quick-tools>button{width:100%!important;min-width:0!important;max-width:none!important}
  .office-editor-close-tool{position:absolute!important;right:6px!important;top:5px!important;margin:0!important;z-index:160!important}
}

@media(max-width:1300px){
  .commandbar{
    width:100%!important;
    grid-template-columns:repeat(3,minmax(180px,1fr))!important;
    grid-template-rows:none!important;
    grid-auto-rows:174px!important;
  }
  .commandbar>.command-group{height:174px!important;min-height:174px!important}
  .file-command .command-buttons,
  .translation-command .command-buttons{height:145px!important;min-height:145px!important}
  .file-command .command-buttons{grid-template-rows:1fr!important}
  .translation-command .command-buttons{grid-template-rows:1fr!important}
  .pages-workspace{min-height:0!important}

}

@media(max-width:900px){
  .commandbar{grid-template-columns:repeat(2,minmax(160px,1fr))!important}
  .office-editor-card{grid-template-rows:168px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{height:166px!important;min-height:166px!important;max-height:166px!important}
  .office-visual-quick-tools{grid-template-columns:repeat(10,minmax(0,1fr))!important;width:100%!important;min-width:0!important;max-width:100%!important}
  .office-visual-quick-tools>button{width:100%!important;min-width:0!important;max-width:none!important}
}

@media(max-width:700px){
  .office-editor-card{grid-template-rows:158px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{height:156px!important;min-height:156px!important;max-height:156px!important}
  .office-visual-quick-tools{
    grid-template-columns:repeat(10,minmax(0,1fr))!important;
    grid-template-rows:repeat(2,40px)!important;
    grid-auto-rows:40px!important;
    width:100%!important;min-width:0!important;height:84px!important;min-height:84px!important;max-height:84px!important;
    gap:4px!important;
  }
  .office-visual-quick-tools>button{width:100%!important;min-width:0!important;max-width:none!important;height:40px!important;min-height:40px!important;max-height:40px!important;padding:2px!important}
  .office-visual-quick-tools .office-tool-glyph{width:17px!important;height:17px!important;font-size:15px!important}
  .office-visual-quick-tools>button>span:not(.office-tool-glyph){font-size:7px!important}
}

@media(max-width:560px){
  .office-editor-card{grid-template-rows:150px minmax(0,1fr) 48px!important}
  .office-editor-toolbar{height:148px!important;min-height:148px!important;max-height:148px!important;padding-left:4px!important;padding-right:60px!important}
  .commandbar{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .office-visual-quick-tools{grid-template-columns:repeat(10,minmax(0,1fr))!important;grid-template-rows:repeat(2,34px)!important;grid-auto-rows:34px!important;width:100%!important;height:72px!important;min-height:72px!important;max-height:72px!important;gap:3px!important}
  .office-visual-quick-tools>button{width:100%!important;min-width:0!important;max-width:none!important;height:34px!important;min-height:34px!important;max-height:34px!important}
  .office-visual-quick-tools .office-tool-glyph{width:14px!important;height:14px!important;font-size:13px!important}
  .office-visual-quick-tools>button>span:not(.office-tool-glyph){font-size:6px!important}
}

/* V94 · Confirmación de traducción y barra principal a la altura de referencia */
#applyTranslationBtn[data-translation-complete="true"]{
  border-color:#0f9f6e!important;
  background:linear-gradient(145deg,#18b77e,#0f8f64)!important;
  color:#fff!important;
  box-shadow:0 7px 16px rgba(15,159,110,.2)!important;
}
#applyTranslationBtn[data-translation-complete="true"]:hover:not(:disabled){
  background:linear-gradient(145deg,#12a971,#0b7d57)!important;
}

/* La barra de la página termina justo después de las tarjetas, sin el espacio
   vertical adicional que dejaba el layout anterior. */
.editor-toolbar{
  height:164px!important;
  min-height:164px!important;
  max-height:164px!important;
}
.commandbar{
  height:164px!important;
  min-height:164px!important;
  grid-template-rows:150px!important;
  padding:7px 10px!important;
}
.commandbar>.command-group{
  height:150px!important;
  min-height:150px!important;
}
.command-group>.toolbar-label{
  height:25px!important;
  min-height:25px!important;
  font-size:8px!important;
}
.command-buttons,
.extract-command .extract-control,
.optimization-command .optimization-panel{
  height:118px!important;
  min-height:118px!important;
}
.file-command .command-buttons,
.translation-command .command-buttons{
  height:118px!important;
  min-height:118px!important;
  grid-template-rows:1fr!important;
}
.optimization-command{
  grid-template-rows:25px 118px!important;
}
.optimization-command>.optimization-panel{
  height:118px!important;
  min-height:118px!important;
}

@media(max-width:1300px){
  .editor-toolbar{height:auto!important;min-height:0!important;max-height:none!important}
  .commandbar{
    height:auto!important;
    min-height:0!important;
    grid-template-rows:none!important;
    grid-auto-rows:150px!important;
    padding:7px!important;
  }
  .commandbar>.command-group{height:150px!important;min-height:150px!important}
  .command-group>.toolbar-label{height:25px!important;min-height:25px!important}
  .command-buttons,
  .extract-command .extract-control,
  .optimization-command .optimization-panel,
  .file-command .command-buttons,
  .translation-command .command-buttons{
    height:118px!important;
    min-height:118px!important;
  }
}
