* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #f4f5f7; color: #1f2430; }

.layout { display: flex; min-height: 100vh; }

.menu {
  width: 240px;
  background: #1f2430;
  color: #fff;
  padding: 16px;
}
.menu a {
  display: block;
  color: #cfd3dc;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
}
.menu a:hover, .menu a.activo { background: #333a4d; color: #fff; }

.contenido { flex: 1; padding: 24px; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; }
th { background: #eef0f4; }

button, .btn {
  background: #2f6fed; color: #fff; border: none; padding: 8px 14px;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
button.secundario { background: #6b7280; }
button.whatsapp { background: #25d366; }

input, select, textarea {
  padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; margin: 4px 0;
  font-family: inherit;
}

.card { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* Campo de formulario con etiqueta arriba (para inputs que lo necesiten, ej: fechas) */
.campo { display: inline-flex; flex-direction: column; margin: 4px 8px 4px 0; font-size: 12px; color: #6b7280; vertical-align: top; }
.campo input, .campo select { margin-top: 2px; }

/* Overlay modal genérico (ej: editor de posiciones de impresión) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; overflow: auto;
}
.modal-caja { background: #fff; border-radius: 10px; padding: 20px; max-height: 90vh; overflow: auto; }

/* Editor visual de posiciones de impresión de factura */
.formulario-calibracion {
  position: relative; border: 2px dashed #2f6fed; background: #f4f5f7;
  margin: 8px auto 0;
}
.campo-arrastrable {
  position: absolute; background: #2f6fed; color: #fff; font-size: 11px;
  padding: 3px 6px; border-radius: 4px; white-space: nowrap; cursor: grab;
  user-select: none; transform: translate(-2px, -2px); z-index: 2; touch-action: none;
}
.campo-arrastrable:active { cursor: grabbing; }
.guia-columna {
  position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -6px; padding: 0 5px;
  background: rgba(185,28,28,0.6) content-box; cursor: ew-resize; z-index: 1; touch-action: none;
}
.guia-fila {
  position: absolute; left: 0; right: 0; height: 3px; margin-top: -6px; padding: 5px 0;
  background: rgba(21,128,61,0.6) content-box; cursor: ns-resize; z-index: 1; touch-action: none;
}
.guia-columna span, .guia-fila span {
  position: absolute; font-size: 10px; white-space: nowrap; background: #fff; padding: 0 2px; border-radius: 2px;
}
.guia-columna span { top: -2px; left: 8px; color: #b91c1c; }
.guia-fila span { left: -2px; top: 8px; color: #15803d; }
.guia-fila-previa { background: rgba(156,163,175,0.5); cursor: default; }
