body { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand h1 { font-size: 18px; letter-spacing: -.01em; }
.mark { width: 22px; height: 22px; flex: none; }
.tagline { font-size: 12px; }
.badge.local { background: rgba(74, 222, 128, .14); color: var(--ok); }

/* Con más de una herramienta el encabezado es también la navegación. */
.tools { display: flex; gap: 4px; }
.tool {
  text-decoration: none; font-size: 13px; color: var(--muted);
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}
.tool:hover { color: var(--text); background: var(--panel-2); }
.tool.current { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }

.icon-btn {
  display: grid; place-items: center; padding: 6px;
  background: transparent; border-color: transparent; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--panel-2); border-color: var(--line); }

/* Panel de opciones: fuera de la columna, que era donde estorbaba. */
.sheet {
  position: fixed; top: 56px; right: 16px; z-index: 20; width: min(360px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 88px); overflow-y: auto;
}
.sheet[hidden] { display: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px;
}
.sheet-head h2 { font-size: 14px; }
.sheet .options-body { padding: 0 14px 14px; }
.scrim { position: fixed; inset: 0; z-index: 10; }
.scrim[hidden] { display: none; }

main { flex: 1; display: grid; grid-template-columns: 380px 1fr; gap: 0; min-height: 0; }

.left {
  padding: 16px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto;
}

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 22px 16px; text-align: center; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: rgba(226, 87, 76, .08); }
.drop-title { margin: 0; font-size: 14px; }
.small { font-size: 12px; }
.muted.small { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); cursor: pointer;
}
.item.active { border-color: var(--accent); }
.item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.item .meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.item .meta.err { color: var(--err); }
.item .drop-btn { background: transparent; border: 0; color: var(--muted); padding: 2px 4px; }
.item .drop-btn:hover { color: var(--err); }

.options { display: flex; flex-direction: column; gap: 10px; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.chk input { width: 15px; height: 15px; padding: 0; accent-color: var(--accent); }

.block { width: 100%; }
.status { font-size: 12px; min-height: 16px; margin: 0; text-align: center; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }

.right { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.preview-bar button { padding: 2px 10px; line-height: 1.2; }

.stage {
  flex: 1; overflow: auto; padding: 20px;
  display: flex; align-items: flex-start; justify-content: center;
  background: #0b0d11;
}
.stage canvas { box-shadow: 0 6px 28px rgba(0, 0, 0, .55); border-radius: 2px; }
.empty { margin: auto; font-size: 13px; }

.foot { padding: 9px 18px; border-top: 1px solid var(--line); font-size: 11px; text-align: center; }
.sep { opacity: .5; margin: 0 4px; }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
  .left { border-right: 0; border-bottom: 1px solid var(--line); }
}

.tag {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 6px; border-radius: 5px;
}
.tag-pdf { background: rgba(226, 87, 76, .16); color: var(--accent); }
.tag-docx { background: rgba(74, 123, 255, .16); color: var(--word); }
.tag-x { background: var(--panel-2); color: var(--muted); }

.item .meta.warn { color: var(--warn); }
.status.warn { color: var(--warn); }

/* Unir PDF: el orden de la lista es el orden del documento, así que se ve y
   se arrastra. El número va delante porque es el dato que se comprueba. */
.grip { flex: none; color: var(--muted); cursor: grab; font-size: 13px; line-height: 1; }
.item .order {
  flex: none; min-width: 20px; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 700;
}
.item.dragging { opacity: .4; }
.item.over { border-color: var(--accent); box-shadow: 0 -2px 0 -1px var(--accent); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tools { order: 3; width: 100%; }
  .tagline { display: none; }
}

.options-body { display: flex; flex-direction: column; gap: 12px; }
.pdf-options { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.pdf-options[hidden] { display: none; }
